@agentproto/runtime 2.10.1 → 2.12.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/README.md CHANGED
@@ -65,12 +65,38 @@ The `/mcp` endpoint exposes the core toolset plus several opt-in / feature-gated
65
65
  | `terminal_start` / `terminal_input` / `terminal_output` / `terminal_kill` | Raw PTY sessions |
66
66
  | `session_list` / `session_tree` / `session_usage` / `session_restart` / `session_rename` | Session management |
67
67
  | `app_install` / `app_run` / `app_list` / `app_status` / `app_stop` / `app_apply` / `app_unapply` / `app_list_applied` | App-kit apps |
68
- | `app_data_read` / `app_data_write` / `app_data_list` / `app_data_migrate` | App-scoped durable data plane (new) |
68
+ | `app_data_read` / `app_data_write` / `app_data_list` / `app_data_migrate` | App-scoped durable data plane, anchored at the app's `dataDir` (default `<dir>/data`; `app_install {dataDir}`) |
69
+ | `app_state_append` / `app_state_get` / `app_state_list` | App-scoped **state ledger** (`<dataDir>/state/events.jsonl`) — append-only, zod-validated event envelope, fold to a stage snapshot; see below |
69
70
  | `harness_preset_list` / `harness_preset_create` / `harness_preset_delete` / `harness_preset_set_default` | Persisted harness→auth-profile presets (new) |
70
71
  | `workspace_brain_query` / `workspace_brain_status` / `workspace_brain_ingest` | Per-workspace transcript recall (new) |
71
72
  | `conversation_export` | Export a daemon transcript to a target adapter's native store, e.g. `claude-code` (new) |
72
73
  | `llm_endpoint_*` (`start`, `stop`, `status`, `set_upstream_link`, `list_links`) | Local LLM Endpoint proxy sidecar — only when `features.llmEndpoint` is enabled (new) |
73
74
 
75
+ ### App state ledger (`app_state_*`)
76
+
77
+ Per installed app, an append-only JSONL event log lives at
78
+ `<dataDir>/state/events.jsonl` (`src/app-state.ts`). One JSON object per
79
+ line: `{ id (ULID), ts, appRunId?, stage, item?, kind, by, payload }` with
80
+ `kind ∈ stage-started | gate-report | approval | stage-done | blocked | note`
81
+ and `by ∈ runner | human | policy | system`. Payloads are validated per kind
82
+ (`gate-report` needs `{ok, exitCode, report?}`, `approval` needs
83
+ `{approved, who}`, `blocked` needs `{reason}`).
84
+
85
+ - **Fold** — `foldAppStateEvents(events)` reduces the ledger to a stage-board
86
+ snapshot `{ stages: { [stage]: { status: pending|running|gated-failed|
87
+ blocked|done|approved, items?, lastGate?, lastEvent? } }, updatedAt }`.
88
+ `stage-done` re-opens from any state (including `blocked`); `approval`
89
+ marks the stage `approved`; events with `item` drive that item, not the
90
+ stage status.
91
+ - **Access rule** — `app_state_append` is the daemon-owned write path and is
92
+ NOT granted to app agents: the `/mcp` factory strips it from any request
93
+ carrying `?callerSessionId=` (every daemon-spawned agent session), the same
94
+ hard-gate plumbing as the role `denyTools` gate. The daemon runner (server
95
+ side) and UI actions keep it, and it is never listed in an app's
96
+ `ui.tools` unless a human-approval action explicitly needs it. Reads
97
+ (`app_state_get`, `app_state_list`) are open, and `app_status` projects the
98
+ folded snapshot read-only as `state.snapshot` whenever a ledger exists.
99
+
74
100
  ### Auth model
75
101
 
76
102
  - `Authorization: Bearer <token>` required on **mutating** `/sessions/*` routes (POST/PATCH/DELETE) and the PTY WS upgrade.
@@ -1,5 +1,5 @@
1
1
  import { AuthProfile } from '@agentproto/auth';
2
- import { A as AdapterAuthDescriptor } from './spawn-defaults-DUnTfwVK.js';
2
+ import { A as AdapterAuthDescriptor } from './spawn-defaults-D4W661ui.js';
3
3
  import { R as RouteSpec } from './session-config-DbWP9RRj.js';
4
4
  import '@agentproto/model-catalog';
5
5
  import './context-continuity-ib9_bVYM.js';