@astralyn/pi 1.4.4 → 1.4.6
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/CHANGELOG.md +34 -0
- package/README.md +1 -0
- package/dist/bundle/chunks/chunk-5M3YJ54Z.js +82 -0
- package/dist/bundle/chunks/chunk-6QGV3IWD.js +6 -0
- package/dist/bundle/chunks/chunk-ALHAFUHP.js +7 -0
- package/dist/bundle/chunks/chunk-AXFWZIHH.js +4 -0
- package/dist/bundle/chunks/chunk-EYKC6ESU.js +2 -0
- package/dist/bundle/chunks/chunk-KDO6L76C.js +230 -0
- package/dist/bundle/chunks/chunk-RBTJBQWX.js +1500 -0
- package/dist/bundle/chunks/chunk-RLNMABLM.js +9 -0
- package/dist/bundle/chunks/cli-FH77R7JR.js +51 -0
- package/dist/bundle/chunks/execute-5ZQUS52M.js +505 -0
- package/dist/bundle/chunks/runtime-R5CMHJ5P.js +2 -0
- package/dist/bundle/chunks/virtual-modules-KCQU7LOC.js +2 -0
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +2 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +2 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +18 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +6 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/isolated-session.d.ts +23 -0
- package/dist/core/isolated-session.d.ts.map +1 -0
- package/dist/core/isolated-session.js +55 -0
- package/dist/core/isolated-session.js.map +1 -0
- package/dist/core/model-config.d.ts +1 -3
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +1 -3
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/settings-manager.d.ts +4 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +38 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +1 -0
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +3 -0
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/tasks/codec.d.ts +12 -0
- package/dist/core/tasks/codec.d.ts.map +1 -0
- package/dist/core/tasks/codec.js +139 -0
- package/dist/core/tasks/codec.js.map +1 -0
- package/dist/core/tasks/execution.d.ts +64 -0
- package/dist/core/tasks/execution.d.ts.map +1 -0
- package/dist/core/tasks/execution.js +272 -0
- package/dist/core/tasks/execution.js.map +1 -0
- package/dist/core/tasks/output.d.ts +12 -5
- package/dist/core/tasks/output.d.ts.map +1 -1
- package/dist/core/tasks/output.js +38 -37
- package/dist/core/tasks/output.js.map +1 -1
- package/dist/core/tasks/presentation.d.ts +14 -5
- package/dist/core/tasks/presentation.d.ts.map +1 -1
- package/dist/core/tasks/presentation.js +56 -185
- package/dist/core/tasks/presentation.js.map +1 -1
- package/dist/core/tasks/runtime.d.ts +9 -9
- package/dist/core/tasks/runtime.d.ts.map +1 -1
- package/dist/core/tasks/runtime.js +63 -252
- package/dist/core/tasks/runtime.js.map +1 -1
- package/dist/core/tasks/scheduler.d.ts +16 -0
- package/dist/core/tasks/scheduler.d.ts.map +1 -0
- package/dist/core/tasks/scheduler.js +42 -0
- package/dist/core/tasks/scheduler.js.map +1 -0
- package/dist/core/tasks/session.d.ts +1 -0
- package/dist/core/tasks/session.d.ts.map +1 -1
- package/dist/core/tasks/session.js +15 -27
- package/dist/core/tasks/session.js.map +1 -1
- package/dist/core/tasks/store.js +4 -4
- package/dist/core/tasks/store.js.map +1 -1
- package/dist/core/tasks/types.d.ts +63 -49
- package/dist/core/tasks/types.d.ts.map +1 -1
- package/dist/core/tasks/types.js +3 -9
- package/dist/core/tasks/types.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +6 -4
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +34 -14
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/shell-execution.js +4 -4
- package/dist/core/tools/shell-execution.js.map +1 -1
- package/dist/core/tools/shell-tool.d.ts.map +1 -1
- package/dist/core/tools/shell-tool.js +23 -30
- package/dist/core/tools/shell-tool.js.map +1 -1
- package/dist/core/usage-totals.d.ts +1 -3
- package/dist/core/usage-totals.d.ts.map +1 -1
- package/dist/core/usage-totals.js +17 -8
- package/dist/core/usage-totals.js.map +1 -1
- package/dist/extensions/agent/activity.d.ts +13 -0
- package/dist/extensions/agent/activity.d.ts.map +1 -0
- package/dist/extensions/agent/activity.js +75 -0
- package/dist/extensions/agent/activity.js.map +1 -0
- package/dist/extensions/agent/index.d.ts +4 -0
- package/dist/extensions/agent/index.d.ts.map +1 -0
- package/dist/extensions/agent/index.js +11 -0
- package/dist/extensions/agent/index.js.map +1 -0
- package/dist/extensions/agent/progress.d.ts +31 -0
- package/dist/extensions/agent/progress.d.ts.map +1 -0
- package/dist/extensions/agent/progress.js +145 -0
- package/dist/extensions/agent/progress.js.map +1 -0
- package/dist/extensions/agent/render.d.ts +6 -0
- package/dist/extensions/agent/render.d.ts.map +1 -0
- package/dist/extensions/agent/render.js +120 -0
- package/dist/extensions/agent/render.js.map +1 -0
- package/dist/extensions/agent/report.d.ts +9 -0
- package/dist/extensions/agent/report.d.ts.map +1 -0
- package/dist/extensions/agent/report.js +40 -0
- package/dist/extensions/agent/report.js.map +1 -0
- package/dist/extensions/agent/settings-panel.d.ts +43 -0
- package/dist/extensions/agent/settings-panel.d.ts.map +1 -0
- package/dist/extensions/agent/settings-panel.js +125 -0
- package/dist/extensions/agent/settings-panel.js.map +1 -0
- package/dist/extensions/agent/settings.d.ts +15 -0
- package/dist/extensions/agent/settings.d.ts.map +1 -0
- package/dist/extensions/agent/settings.js +201 -0
- package/dist/extensions/agent/settings.js.map +1 -0
- package/dist/extensions/agent/tool.d.ts +13 -0
- package/dist/extensions/agent/tool.d.ts.map +1 -0
- package/dist/extensions/agent/tool.js +84 -0
- package/dist/extensions/agent/tool.js.map +1 -0
- package/dist/extensions/agent/types.d.ts +43 -0
- package/dist/extensions/agent/types.d.ts.map +1 -0
- package/dist/extensions/agent/types.js +6 -0
- package/dist/extensions/agent/types.js.map +1 -0
- package/dist/extensions/agent/worker.d.ts +16 -0
- package/dist/extensions/agent/worker.d.ts.map +1 -0
- package/dist/extensions/agent/worker.js +68 -0
- package/dist/extensions/agent/worker.js.map +1 -0
- package/dist/extensions/codemode/execute.js +1 -1
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/codemode/execute.lazy.d.ts +2 -2
- package/dist/extensions/codemode/execute.lazy.d.ts.map +1 -1
- package/dist/extensions/codemode/execute.lazy.js +2 -2
- package/dist/extensions/codemode/execute.lazy.js.map +1 -1
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/index.js +2 -0
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/mcp/cli.lazy.d.ts +2 -2
- package/dist/extensions/mcp/cli.lazy.d.ts.map +1 -1
- package/dist/extensions/mcp/cli.lazy.js +2 -2
- package/dist/extensions/mcp/cli.lazy.js.map +1 -1
- package/dist/extensions/mcp/index.d.ts.map +1 -1
- package/dist/extensions/mcp/index.js +2 -2
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/extensions/mcp/runtime.lazy.d.ts +2 -2
- package/dist/extensions/mcp/runtime.lazy.d.ts.map +1 -1
- package/dist/extensions/mcp/runtime.lazy.js +2 -2
- package/dist/extensions/mcp/runtime.lazy.js.map +1 -1
- package/dist/extensions/provider/compat-fields.js +1 -1
- package/dist/extensions/provider/compat-fields.js.map +1 -1
- package/dist/extensions/tasks/tool/actions.d.ts.map +1 -1
- package/dist/extensions/tasks/tool/actions.js +1 -9
- package/dist/extensions/tasks/tool/actions.js.map +1 -1
- package/dist/extensions/tasks/tool/schema.js +1 -1
- package/dist/extensions/tasks/tool/schema.js.map +1 -1
- package/dist/extensions/tasks/tool/types.d.ts +2 -8
- package/dist/extensions/tasks/tool/types.d.ts.map +1 -1
- package/dist/extensions/tasks/tool/types.js +0 -2
- package/dist/extensions/tasks/tool/types.js.map +1 -1
- package/dist/extensions/tasks/ui/completion-render.d.ts.map +1 -1
- package/dist/extensions/tasks/ui/completion-render.js +27 -26
- package/dist/extensions/tasks/ui/completion-render.js.map +1 -1
- package/dist/extensions/tasks/ui/inspector.d.ts +5 -3
- package/dist/extensions/tasks/ui/inspector.d.ts.map +1 -1
- package/dist/extensions/tasks/ui/inspector.js +18 -6
- package/dist/extensions/tasks/ui/inspector.js.map +1 -1
- package/dist/extensions/tasks/ui/layout.d.ts.map +1 -1
- package/dist/extensions/tasks/ui/layout.js +111 -75
- package/dist/extensions/tasks/ui/layout.js.map +1 -1
- package/dist/extensions/tasks/ui/list.d.ts.map +1 -1
- package/dist/extensions/tasks/ui/list.js +43 -28
- package/dist/extensions/tasks/ui/list.js.map +1 -1
- package/dist/extensions/tasks/ui/manager.d.ts.map +1 -1
- package/dist/extensions/tasks/ui/manager.js +8 -2
- package/dist/extensions/tasks/ui/manager.js.map +1 -1
- package/dist/extensions/tasks/ui/model.d.ts +4 -0
- package/dist/extensions/tasks/ui/model.d.ts.map +1 -1
- package/dist/extensions/tasks/ui/model.js +12 -1
- package/dist/extensions/tasks/ui/model.js.map +1 -1
- package/dist/extensions/tasks/ui/render.js +3 -4
- package/dist/extensions/tasks/ui/render.js.map +1 -1
- package/dist/extensions/tasks/ui/task-view.d.ts +0 -5
- package/dist/extensions/tasks/ui/task-view.d.ts.map +1 -1
- package/dist/extensions/tasks/ui/task-view.js +0 -7
- package/dist/extensions/tasks/ui/task-view.js.map +1 -1
- package/dist/extensions/tasks/ui/tree.js +1 -1
- package/dist/extensions/tasks/ui/tree.js.map +1 -1
- package/dist/extensions/tasks/ui/views.d.ts +10 -6
- package/dist/extensions/tasks/ui/views.d.ts.map +1 -1
- package/dist/extensions/tasks/ui/views.js +64 -28
- package/dist/extensions/tasks/ui/views.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +2 -1
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +7 -4
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +10 -3
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/docs/bundled/README.md +1 -0
- package/docs/bundled/extensions/agent.md +68 -0
- package/docs/bundled/extensions/statusline.md +1 -1
- package/docs/bundled/tasks.md +15 -14
- package/docs/docs.json +4 -0
- package/docs/extensions.md +33 -6
- package/docs/sdk.md +2 -2
- package/docs/session-format.md +27 -23
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/schemas/settings.schema.json +12 -0
- package/dist/bundle/chunks/chunk-SBVVM3NV.js +0 -2361
- package/dist/bundle/chunks/chunk-VGSZTBVJ.js +0 -2
- package/dist/bundle/chunks/virtual-modules-ETYFHSUG.js +0 -2
- package/dist/core/tasks/history.d.ts +0 -4
- package/dist/core/tasks/history.d.ts.map +0 -1
- package/dist/core/tasks/history.js +0 -121
- package/dist/core/tasks/history.js.map +0 -1
- package/dist/extensions/codemode/search.d.ts +0 -33
- package/dist/extensions/codemode/search.d.ts.map +0 -1
- package/dist/extensions/codemode/search.js +0 -117
- package/dist/extensions/codemode/search.js.map +0 -1
package/docs/extensions.md
CHANGED
|
@@ -1214,6 +1214,17 @@ Use `ctx.modelRegistry.streamSimple(model, context, options)` for provider-neutr
|
|
|
1214
1214
|
|
|
1215
1215
|
Both return an `AssistantMessageEventStream`. Iterate it for response events and await `.result()` for the final message. Setup failures produce error events and error results.
|
|
1216
1216
|
|
|
1217
|
+
### ctx.getExtensionSettings() / ctx.setExtensionSettings()
|
|
1218
|
+
|
|
1219
|
+
Extensions can store one JSON object in their own global namespace under `extensionSettings` in `settings.json`:
|
|
1220
|
+
|
|
1221
|
+
```typescript
|
|
1222
|
+
const settings = ctx.getExtensionSettings("my-extension");
|
|
1223
|
+
await ctx.setExtensionSettings("my-extension", { ...settings, model: "provider/model-id" });
|
|
1224
|
+
```
|
|
1225
|
+
|
|
1226
|
+
Reads return a detached object and reject malformed existing configuration. Writes replace only that namespace, merge with the latest file under the SettingsManager lock, skip unchanged values, and resolve only after successful persistence. Project settings do not override this global API. Namespace names contain lowercase letters, digits, and hyphens, start with a letter, and have at most 64 characters. Await writes before reporting success; captured contexts become stale after session replacement like the rest of `ExtensionContext`.
|
|
1227
|
+
|
|
1217
1228
|
### ctx.signal
|
|
1218
1229
|
|
|
1219
1230
|
The current agent abort signal, or `undefined` when no agent turn is active.
|
|
@@ -1245,9 +1256,9 @@ Session-bound `TasksContext` supervises native and extension-owned execution. Fo
|
|
|
1245
1256
|
|
|
1246
1257
|
| Method | Contract |
|
|
1247
1258
|
|---|---|
|
|
1248
|
-
| `execute<T>(execution)` | Returns `{ kind: "result", result, status
|
|
1259
|
+
| `execute<T>(execution)` | Returns `{ kind: "result", result, status, error? }` or `{ kind: "background", task }` |
|
|
1249
1260
|
| `list()` / `get(id)` | Bounded, read-only (frozen) retained snapshots; IDs support unique prefixes |
|
|
1250
|
-
| `read(id, options?)` | Bounded head, tail, or byte-offset output |
|
|
1261
|
+
| `read(id, options?)` | Bounded head, tail, or byte-offset model-readable output; excludes human-only display text |
|
|
1251
1262
|
| `wait(id, timeoutMs?, signal?, interruptSignal?)` | Observation only; timeout, cancellation, or `interruptSignal` ends the wait, not execution |
|
|
1252
1263
|
| `waitAny(timeoutMs?, signal?, interruptSignal?)` | Observes the first task running at call time to settle; returns `undefined` for an empty cohort, timeout, interruption, or closed host. Later tasks are excluded |
|
|
1253
1264
|
| `kill(id)` | Requests cancellation; `stopping` is not a terminal status |
|
|
@@ -1257,18 +1268,34 @@ Session-bound `TasksContext` supervises native and extension-owned execution. Fo
|
|
|
1257
1268
|
| `retain(id)` | Returns an idempotent release function protecting retained data, without delaying notifications |
|
|
1258
1269
|
| `holdDelivery(id)` | Explicitly retains data and delays automatic delivery until released |
|
|
1259
1270
|
|
|
1260
|
-
`TaskExecution<T>` supplies `kind`, `title`, `toolCallId`, `run(control)`, optional
|
|
1271
|
+
`TaskExecution<T>` supplies `kind`, `title`, `toolCallId`, and `run(control)`, plus optional fields:
|
|
1272
|
+
|
|
1273
|
+
| Field | Contract |
|
|
1274
|
+
|---|---|
|
|
1275
|
+
| `label` | Human source name for the panel and completion card, such as `Bash` or `Agent`; defaults to `kind` |
|
|
1276
|
+
| `output` | `"log"` (default) or `"report"`. A log's outcome is at its end, so a background completion gives the model an 8 KiB tail. A report leads with its conclusion, so it arrives from its beginning, whole when it fits the 48 KiB context budget, as its foreground result would; a completed report renders as Markdown in `/tasks` |
|
|
1277
|
+
| `input` | `{ label, text, truncated, language? }`: what the task was asked to do, such as a command or briefing. Shown in Details and the expanded completion card, highlighted when `language` is set |
|
|
1278
|
+
| `facts` | Up to 16 labelled `[label, value]` Details rows, such as `["Directory", cwd]` |
|
|
1279
|
+
| `concurrency` | `{ key, limit }`: at most `limit` executions sharing `key` run at once. Later ones wait as `queued` tasks and `run` starts when a slot frees |
|
|
1280
|
+
| `background`, `signal`, `onUpdate` | Requested handoff, parent cancellation, and foreground progress forwarding |
|
|
1281
|
+
|
|
1282
|
+
`kind` is an executor-owned source label matching `[a-z][a-z0-9-]{0,63}`; the runtime never dispatches on it. Presentation is declared data: the panel and completion card render `label`, `input`, `facts`, and `output` the same way for every executor. Input and facts restore with terminal task history; facts also appear in the completion notification. At most eight background executions, queued ones included, are retained as active at once; foreground executions are not limited by them. Foreground and background results have separate history quotas.
|
|
1283
|
+
|
|
1284
|
+
A caller can be handed off to the background while its task is queued, before `run` starts, or after `run` calls `accept()`. A queued task becomes `running` when its `run` starts; cancelling it settles it as `cancelled` without starting it.
|
|
1261
1285
|
|
|
1262
|
-
`run` returns `TaskCompletion<T>`: `{ result, status?, error?,
|
|
1286
|
+
`run` returns `TaskCompletion<T>`: `{ result, status?, display?, error?, facts?, usage? }`. The original tool result is returned to a foreground caller; task history keeps only its bounded text. Optional `display` is bounded human-only Output suffix text, excluded from `tasks read`, settled waits, and completion context. Terminal `facts` replace launch facts with the same label, as the shell does with `["Exit", "42"]`. Explicit terminal statuses are `completed`, `partial`, `failed`, `cancelled`, and `timeout`. The host settles usage once, preferring `usage`, then `result.usage`, then the latest published usage; managed foreground results omit usage to avoid billing it twice.
|
|
1263
1287
|
|
|
1264
|
-
`TaskControl<T>` exposes `id`, `signal`, `mode`, `accept()`, `publish(
|
|
1288
|
+
`TaskControl<T>` exposes `id`, `signal`, `mode`, `onModeChange(listener)`, `accept()`, `publish(update)`, `attachOutput(path, cleanup?)`, and `cancel()`. `publish({ result, display?, usage? })` replaces the bounded model-readable result and optionally the human-only Output suffix and cumulative usage; `/tasks` combines result and display, while model reads and completion notifications use only the result. A task with an attached output file is read from that file instead. Call `accept()` after whole-invocation preflight, before allowing a background handoff. Use the control's signal throughout execution. Parent-call cancellation is disconnected after handoff, while runtime shutdown still cancels the task. Mode subscriptions concern only this task; executors do not need the global registry to observe their own handoff or cancel themselves.
|
|
1265
1289
|
|
|
1266
|
-
Completion messages store a
|
|
1290
|
+
Completion messages store `{ version: 3, task }` in `details`, a bounded terminal `TaskSnapshot`; only their bounded `content` enters model context. Built-in `tasks wait` binds delivery to the actual tool call, and the host confirms it after successful persistence; a settled waitAny binds only its winning task. Ordinary extension reads/waits, including `waitAny`, do not acknowledge delivery, and arbitrary tool-result detail fields cannot acknowledge a task.
|
|
1267
1291
|
|
|
1268
1292
|
```typescript
|
|
1269
1293
|
const outcome = await ctx.tasks.execute({
|
|
1270
1294
|
kind: "report-job",
|
|
1295
|
+
label: "Review",
|
|
1271
1296
|
title: "Inspect project",
|
|
1297
|
+
output: "report",
|
|
1298
|
+
facts: [["Directory", ctx.cwd]],
|
|
1272
1299
|
toolCallId,
|
|
1273
1300
|
signal,
|
|
1274
1301
|
background: params.background,
|
package/docs/sdk.md
CHANGED
|
@@ -280,7 +280,7 @@ try {
|
|
|
280
280
|
|
|
281
281
|
For a longer-lived embedding, keep the host alive, subscribe to snapshots and choose bounded waits or release notification delivery according to your model-turn policy. Do not use a panel or repeated reads as the billing or cleanup mechanism.
|
|
282
282
|
|
|
283
|
-
Automatic completion messages carry
|
|
283
|
+
Automatic completion messages carry `{ version: 3, task }` in `details`: the bounded terminal snapshot with its input, facts, diagnostics, up to 40 KiB of output and explicit truncation flags. This snapshot is self-contained for transcript replay and is not sent to the model. `content` is separately bounded prose: a log contributes an 8 KiB tail, while a report arrives from its beginning, whole when it fits the 48 KiB budget. After compaction, one request-local reminder lists still-active background tasks to prevent duplicate work; it is not persisted and does not start a turn. Each settlement appends one version-3 `task-record` holding the terminal snapshot and its usage, with no migration of earlier result records. See [Background records](session-format.md#background-records).
|
|
284
284
|
|
|
285
285
|
`backgroundAllowed: false` on `createAgentSession()` is a host capability ceiling, independent of task kind. It prevents enabling background execution through `bindExtensions` or direct runtime activation, including after reload. Requests for `background: true` are rejected before startup; foreground execution remains available. Omitting this option permits host opt-in but does not enable background execution by itself. This capability restriction is not an OS sandbox.
|
|
286
286
|
|
|
@@ -292,7 +292,7 @@ An executor that ignores abort and settles after its originating runtime/branch
|
|
|
292
292
|
|
|
293
293
|
`session.getSessionStats()` returns `sessionFile`, `sessionId`, `userMessages`, `assistantMessages`, `toolCalls`, `toolResults`, `totalMessages`, `tokens`, `cost`, and optional `contextUsage`. `tokens` contains `input`, `output`, `cacheRead`, `cacheWrite`, and `total` (the sum of those four categories); `cost` is accumulated reported cost.
|
|
294
294
|
|
|
295
|
-
Usage totals cover all session entries, including other branches and compacted history: assistant requests, usage-bearing tool results, compaction/branch summaries, and the first valid
|
|
295
|
+
Usage totals cover all session entries, including other branches and compacted history: assistant requests, usage-bearing tool results, compaction/branch summaries, and the first valid task usage settlement per execution ID, from a `task-record` or a released session's `task-usage` entry. Managed foreground results omit duplicate usage. Background records do not increment message/tool counts, and reads, waits, handoff and history restoration do not add billing. Worker retry, failure, cancellation and compaction usage is included when supplied; missing provider usage is not fabricated. Quarantined late settlements are excluded.
|
|
296
296
|
|
|
297
297
|
This differs from the bundled Statusline's active-branch totals. Neither accumulated worker usage nor Background billing changes the parent context-occupancy estimate or the latest parent request's cache-hit ratio.
|
|
298
298
|
|
package/docs/session-format.md
CHANGED
|
@@ -336,46 +336,50 @@ Use `customType` to identify your extension's entries on reload. Interactive mod
|
|
|
336
336
|
|
|
337
337
|
### Background records
|
|
338
338
|
|
|
339
|
-
Managed execution uses ordinary version-3 custom entries; it does not add a new session-file version or persist live execution handles. Every managed execution — including a foreground one — appends its
|
|
339
|
+
Managed execution uses ordinary version-3 custom entries; it does not add a new session-file version or persist live execution handles. Every managed execution — including a foreground one — appends exactly one record when it settles, holding its bounded terminal snapshot and the usage settled for it. A foreground snapshot omits `result`: its tool result already holds the output, and restoration reads it from the tool result with the same `toolCallId` on the branch.
|
|
340
340
|
|
|
341
341
|
| `customType` | `data` | Purpose |
|
|
342
342
|
|---|---|---|
|
|
343
|
-
| `task-
|
|
344
|
-
| `task-result` | `{ version: 2, task }` | Bounded terminal `TaskSnapshot` |
|
|
343
|
+
| `task-record` | `{ version: 3, task, usage? }` | Bounded terminal `TaskSnapshot` and its settlement of provider-reported nested usage |
|
|
345
344
|
|
|
346
|
-
`
|
|
345
|
+
`task.id` is the execution ID, not a worker display number. `usage` has the `Usage` shape above and is absent when the executor reported none. Consumers count only the first valid usage settlement per ID within the entries they aggregate; malformed records, unsupported versions, blank IDs, and non-finite or negative usage/cost values are ignored. A later valid duplicate is not an adjustment. Do not create these host-owned entries yourself or bill again from a result/read/notification.
|
|
347
346
|
|
|
348
|
-
A `TaskSnapshot` has `id`, `kind` (executor-owned source label, such as `bash`, `powershell`, or an extension-defined label), `title`, `toolCallId`, `anchorId`, `mode`, `status`, and numeric millisecond `startedAt`; optional fields include `endedAt`, `
|
|
347
|
+
A `TaskSnapshot` has `id`, `kind` (executor-owned source label, such as `bash`, `powershell`, or an extension-defined label), `label` (human source name, such as `Bash` or `Agent`), `title`, `output` (`log` or `report`), `toolCallId`, `anchorId`, `mode`, `status`, and numeric millisecond `startedAt`; optional fields include `endedAt`, `input`, `facts`, `display`, `outputPath`, `result`, and `error`. `input` is `{ label, text, truncated, language? }`, what the task was asked to do; `facts` are up to 16 `[label, value]` Details rows, such as `["Exit", "1"]`. `result` is the bounded model-readable text and `display` is bounded human-only Output suffix text; both use `{ text, truncated }`. Only the result, error and facts reach model context. Truncation flags record clipping at the producing/retention boundary. Mode (`foreground` or `background`) is independent of status. Persisted terminal statuses are `completed`, `partial`, `failed`, `cancelled`, or `timeout`; live snapshots can also be `queued`, `running`, or `stopping`.
|
|
349
348
|
|
|
350
|
-
The retained
|
|
349
|
+
The retained result text is bounded (up to 48 KiB) and carries no executor-private details; images are replaced with a text omission marker. Source truncation is explicit; the reader never recognizes truncation by matching output text. `outputPath`, if present, points to an ephemeral executor-owned file which may already have been removed on eviction or runtime shutdown; restored records drop it. Save important output separately.
|
|
351
350
|
|
|
352
|
-
Terminal history is restored only from the selected branch's valid version-
|
|
351
|
+
Terminal history is restored only from the selected branch's valid version-3 records. Released sessions also contain `task-result` records (versions 1 and 2) and separate version-1 `task-usage` entries, `{ version: 1, taskId, usage }`. Those results are ignored without migration, while their usage entries still count toward session totals. This is read-only history: no processes or workers are restarted or reattached, and restoration does not replay usage settlement or completion events. Forks can carry historical entries on their copied path, never live execution handles.
|
|
353
352
|
|
|
354
|
-
These `custom` entries do not enter model context. Automatic delivery creates a `custom_message` with `customType: "task-completion"`, `display: true`, and
|
|
353
|
+
These `custom` entries do not enter model context. Automatic terminal delivery creates a `custom_message` with `customType: "task-completion"`, `display: true`, and `{ version: 3, task }` in `details`. The session formats `content` from the same snapshot, with a total limit of 48 KiB and 2,000 lines. A `log` task contributes only an 8 KiB output tail to the automatic model turn; a `report` task contributes its beginning, whole when it fits. Only `content` is sent to the model.
|
|
355
354
|
|
|
356
|
-
Completion details
|
|
357
|
-
|
|
358
|
-
`output` is the end of the final result text, bounded to 40 KiB including JSON escaping for replay and expanded rendering; the smaller model-facing projection does not change this stored field. Source flags survive further clipping. Missing shell metadata is left unspecified. The renderer sanitizes terminal control sequences and applies separate display row limits.
|
|
355
|
+
Completion details are bounded to 120 KiB of serialized JSON including escaping. `task` is the terminal snapshot without `display`. Its `input` is clipped to 8 KiB, and its `result` keeps the end of a log or the beginning of a report, up to 40 KiB for replay and expanded rendering. The smaller model-facing projection does not change these stored fields. Source flags survive further clipping. The renderer sanitizes terminal control sequences and applies separate display row limits.
|
|
359
356
|
|
|
360
357
|
A shell completion's `details` can look like this:
|
|
361
358
|
|
|
362
359
|
```json
|
|
363
360
|
{
|
|
364
|
-
"version":
|
|
365
|
-
"
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
361
|
+
"version": 3,
|
|
362
|
+
"task": {
|
|
363
|
+
"id": "bash-12345678-abcd-4321-abcd-123456789012",
|
|
364
|
+
"kind": "bash",
|
|
365
|
+
"label": "Bash",
|
|
366
|
+
"title": "npm run build",
|
|
367
|
+
"output": "log",
|
|
368
|
+
"input": { "label": "Command", "text": "npm run build", "truncated": false, "language": "bash" },
|
|
369
|
+
"facts": [["Directory", "/project"], ["Exit", "0"]],
|
|
370
|
+
"toolCallId": "call_1",
|
|
371
|
+
"anchorId": "a1b2c3d4",
|
|
372
|
+
"mode": "background",
|
|
373
|
+
"status": "completed",
|
|
374
|
+
"startedAt": 1733234400000,
|
|
375
|
+
"endedAt": 1733234405000,
|
|
376
|
+
"outputPath": "/tmp/pi-bash-example.log",
|
|
377
|
+
"result": { "text": "Build finished", "truncated": false }
|
|
378
|
+
}
|
|
375
379
|
}
|
|
376
380
|
```
|
|
377
381
|
|
|
378
|
-
The message carries everything needed for replay after `/reload`, branch navigation, history eviction or restart; rendering does not open the saved log or query a live task. Unsupported or malformed completion details, including
|
|
382
|
+
The message carries everything needed for replay after `/reload`, branch navigation, history eviction or restart; rendering does not open the saved log or query a live task. Unsupported or malformed completion details, including versions 1 and 2, use bounded plain message text. There is no legacy text parser, dual-format reconstruction or migration.
|
|
379
383
|
|
|
380
384
|
A completion is acknowledged only after its message is persisted. A terminal `tasks wait` binds a host-owned receipt to the tool-call ID. Only persisting that tool result acknowledges delivery, even if its details were rewritten; aborting during an output read cannot consume a notification. Direct `TasksContext.wait()` is observational. Snapshots and repeated reads do not create more usage. Historical extension-owned `background-task` notifications and old `bg create` tool results remain transcript history shown as saved text, not new runnable tasks.
|
|
381
385
|
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astralyn/pi",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.6",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@astralyn/pi",
|
|
9
|
-
"version": "1.4.
|
|
9
|
+
"version": "1.4.6",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@earendil-works/pi-agent-core": "1.4.0",
|
package/package.json
CHANGED
|
@@ -8,6 +8,18 @@
|
|
|
8
8
|
"type": "string",
|
|
9
9
|
"description": "JSON Schema reference."
|
|
10
10
|
},
|
|
11
|
+
"extensionSettings": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"patternProperties": {
|
|
14
|
+
"^.*$": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"patternProperties": {
|
|
17
|
+
"^.*$": {}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"description": "Per-extension global JSON namespaces, written through the extension settings API."
|
|
22
|
+
},
|
|
11
23
|
"lastChangelogVersion": {
|
|
12
24
|
"type": "string"
|
|
13
25
|
},
|