@amaster.ai/employee-runtime-connector 0.1.1-beta.99 → 0.1.2

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 (43) hide show
  1. package/README.md +178 -6
  2. package/dist/amaster-runtime-daemon/capability-registry.mjs +107 -0
  3. package/dist/amaster-runtime-daemon.mjs +34756 -12037
  4. package/dist/amaster-runtime.mjs +15 -20
  5. package/dist/templates/.mirrorx-preset-templates.json +135 -30
  6. package/dist/templates/CEO/347/273/217/350/220/245/347/256/200/346/212/245/346/250/241/346/235/277.md +88 -0
  7. package/dist/templates//344/272/247/345/223/201/347/274/272/351/231/267/346/270/205/345/215/225/346/250/241/346/235/277.md +83 -0
  8. package/dist/templates//344/272/247/345/223/201/350/277/220/350/220/245/346/226/271/346/241/210/346/250/241/346/235/277.md +53 -0
  9. package/dist/templates//344/274/201/344/270/232/346/210/230/347/225/245/350/247/204/345/210/222/346/250/241/346/235/277V0.1 /345/211/257/346/234/254.md" +27 -19
  10. package/dist/templates//344/275/216/347/251/272/347/273/217/346/265/216/350/241/214/344/270/232/346/210/230/347/225/245/350/247/204/345/210/222/346/250/241/346/235/277.md +27 -17
  11. package/dist/templates//345/205/203/345/256/207/345/256/231/344/270/216/346/225/260/345/255/227/345/206/205/345/256/271/350/241/214/344/270/232/346/210/230/347/225/245/350/247/204/345/210/222/346/250/241/346/235/277.md +23 -11
  12. package/dist/templates//345/205/254/344/274/227/345/217/267/345/233/276/346/226/207/346/210/220/345/223/201/346/250/241/346/235/277.md +49 -0
  13. package/dist/templates//345/205/254/345/217/270/346/263/225/345/212/241/346/262/273/347/220/206/344/270/216/351/243/216/351/231/251/350/247/204/345/210/222/346/250/241/346/235/277.md +431 -0
  14. package/dist/templates//345/206/205/345/256/271/345/217/221/345/270/203/344/272/244/346/216/245/345/215/225/346/250/241/346/235/277.md +128 -0
  15. package/dist/templates//345/206/205/345/256/271/350/256/241/345/210/222/344/270/216/346/216/222/346/234/237/346/250/241/346/235/277.md +52 -0
  16. package/dist/templates//345/206/205/351/203/250/344/275/277/347/224/250/346/212/245/345/221/212/346/250/241/346/235/277.md +141 -0
  17. package/dist/templates//345/206/234/344/270/232/344/270/216/351/243/237/345/223/201/346/267/261/345/212/240/345/267/245/350/241/214/344/270/232/346/210/230/347/225/245/350/247/204/345/210/222/346/250/241/346/235/277.md +27 -17
  18. package/dist/templates//345/214/273/347/226/227/345/201/245/345/272/267/344/270/216/347/224/237/345/221/275/347/247/221/345/255/246/350/241/214/344/270/232/346/210/230/347/225/245/350/247/204/345/210/222/346/250/241/346/235/277.md +27 -17
  19. package/dist/templates//345/220/210/346/210/220/347/224/237/347/211/251/345/255/246/350/241/214/344/270/232/346/210/230/347/225/245/350/247/204/345/210/222/346/250/241/346/235/277.md +23 -11
  20. package/dist/templates//345/225/206/344/270/232/350/210/252/345/244/251/350/241/214/344/270/232/346/210/230/347/225/245/350/247/204/345/210/222/346/250/241/346/235/277.md +23 -21
  21. package/dist/templates//345/260/217/347/272/242/344/271/246/345/233/276/346/226/207/346/210/220/345/223/201/346/250/241/346/235/277.md +39 -0
  22. package/dist/templates//345/270/202/345/234/272/345/210/206/346/236/220/344/270/216/347/253/236/345/257/271/350/260/203/347/240/224/346/250/241/346/235/277.md +398 -0
  23. package/dist/templates//345/272/224/344/273/230/350/264/246/346/254/276/350/264/246/351/276/204/345/210/206/346/236/220/350/241/250/346/250/241/346/235/277.xlsx +0 -0
  24. package/dist/templates//345/272/224/346/224/266/350/264/246/346/254/276/350/264/246/351/276/204/345/210/206/346/236/220/350/241/250/346/250/241/346/235/277.xlsx +0 -0
  25. package/dist/templates//345/273/272/347/255/221/344/270/216/346/210/277/345/234/260/344/272/247/350/241/214/344/270/232/346/210/230/347/225/245/350/247/204/345/210/222/346/250/241/346/235/277.md +27 -17
  26. package/dist/templates//346/226/207/346/227/205/344/270/216/346/226/207/344/275/223/346/225/231/350/202/262/350/241/214/344/270/232/346/210/230/347/225/245/350/247/204/345/210/222/346/250/241/346/235/277.md +27 -17
  27. package/dist/templates//346/234/210/345/272/246/347/250/216/345/212/241/347/224/263/346/212/245/345/207/206/345/244/207/346/270/205/345/215/225/346/250/241/346/235/277.xlsx +0 -0
  28. package/dist/templates//346/234/210/345/272/246/347/273/223/350/264/246/346/270/205/345/215/225/346/250/241/346/235/277.xlsx +0 -0
  29. package/dist/templates//346/257/217/345/221/250/347/216/260/351/207/221/345/277/253/347/205/247/346/250/241/346/235/277.xlsx +0 -0
  30. package/dist/templates//346/263/225/345/256/232/350/264/242/345/212/241/346/212/245/350/241/250/346/250/241/346/235/277.xlsx +0 -0
  31. package/dist/templates//346/266/210/350/264/271/344/270/216/351/233/266/345/224/256/350/241/214/344/270/232/346/210/230/347/225/245/350/247/204/345/210/222/346/250/241/346/235/277.md +27 -17
  32. package/dist/templates//347/211/251/346/265/201/344/270/216/344/276/233/345/272/224/351/223/276/350/241/214/344/270/232/346/210/230/347/225/245/350/247/204/345/210/222/346/250/241/346/235/277.md +27 -17
  33. package/dist/templates//347/237/255/350/247/206/351/242/221/346/210/220/347/211/207/345/210/266/344/275/234/346/250/241/346/235/277.md +50 -0
  34. package/dist/templates//347/247/221/346/212/200/344/270/216/344/272/222/350/201/224/347/275/221/350/241/214/344/270/232/346/210/230/347/225/245/350/247/204/345/210/222/346/250/241/346/235/277.md +27 -17
  35. package/dist/templates//347/247/221/347/233/256/344/275/231/351/242/235/350/241/250/344/270/216/350/257/225/347/256/227/345/271/263/350/241/241/346/250/241/346/235/277.xlsx +0 -0
  36. package/dist/templates//350/203/275/346/272/220/344/270/216/347/216/257/344/277/235/350/241/214/344/270/232/346/210/230/347/225/245/350/247/204/345/210/222/346/250/241/346/235/277.md +27 -17
  37. package/dist/templates//351/207/221/350/236/215/344/270/216/344/270/223/344/270/232/346/234/215/345/212/241/350/241/214/344/270/232/346/210/230/347/225/245/350/247/204/345/210/222/346/250/241/346/235/277.md +27 -17
  38. package/dist/templates//351/223/266/350/241/214/345/255/230/346/254/276/344/275/231/351/242/235/350/260/203/350/212/202/350/241/250/346/250/241/346/235/277.xlsx +0 -0
  39. package/dist/templates//351/227/255/347/216/257/346/265/201/347/250/213/350/257/264/346/230/216/344/270/216/345/256/241/350/256/241/350/257/201/346/215/256/346/240/267/344/276/213/346/250/241/346/235/277.md +125 -0
  40. package/dist/templates//351/242/204/347/256/227/344/270/216/345/256/236/351/231/205/345/267/256/345/274/202/345/210/206/346/236/220/346/250/241/346/235/277.xlsx +0 -0
  41. package/dist/templates//351/253/230/347/253/257/344/270/216/345/205/210/350/277/233/345/210/266/351/200/240/344/270/232/346/210/230/347/225/245/350/247/204/345/210/222/346/250/241/346/235/277.md +27 -17
  42. package/package.json +8 -4
  43. package/dist/source-acquisition-compatibility.json +0 -13
package/README.md CHANGED
@@ -12,27 +12,175 @@ For production images, install an exact version and invoke the package bin:
12
12
 
13
13
  ```sh
14
14
  npm install --omit=dev --prefix /opt/pi-cli-runtime @amaster.ai/employee-runtime-connector@0.1.0
15
- /opt/pi-cli-runtime/node_modules/.bin/amaster-runtime setup https://employee.example.com \
16
- --capabilities remote_registration,heartbeat,executor_discovery,workspace_binding,run_wakeup,runtime_actions_v2,run_exit_live_path_closure_v1,model_call,model_call_output_contract_v1,run_cancel,run_terminate,logs_cost_workspace_status
15
+ /opt/pi-cli-runtime/node_modules/.bin/amaster-runtime setup https://employee.example.com
17
16
  /opt/pi-cli-runtime/node_modules/.bin/amaster-runtime daemon start --foreground
18
17
  ```
19
18
 
20
19
  Do not use `latest`, `^`, or `~` in a runtime image. The image tag and connector package version should identify one immutable deployment.
21
20
 
21
+ ## Tool transcript payloads
22
+
23
+ Task-mode Pi tool start/end events retain bounded input and result data instead
24
+ of replacing both with lifecycle labels. Call IDs and `isError` stay unchanged;
25
+ older summary-only events still replay. This changes reporting only, not tool
26
+ execution or task acceptance. Existing known-runtime-credential redaction runs
27
+ before projection; the projection additionally redacts credential-like keys,
28
+ Bearer/credential assignments and private keys, and omits binary content blocks.
29
+
30
+ The projection limits strings to 2,000 characters, total text to 6,000 characters,
31
+ depth to 7, traversal to 240 nodes, arrays to 20 items and objects to 30 fields.
32
+ Serialized payloads above 12,000 characters use an explicit omission notice so
33
+ the JSONL event is never cut mid-record. Truncation remains visible. File paths
34
+ are data: Windows drive/UNC paths and CRLF text are JSON-escaped without shell
35
+ commands or OS-specific path conversion. The module is included in the existing
36
+ Node 20 daemon bundle on every platform.
37
+
38
+ Existing historical events cannot gain details that were never uploaded.
39
+ New details require the executing desktop/cloud connector to use the updated
40
+ bundle; deploying the frontend alone is insufficient. No connector install,
41
+ restart or release is performed by the source change.
42
+
43
+ ## Incremental type safety
44
+
45
+ `pnpm typecheck` runs the legacy entry-point syntax checks plus TypeScript strict
46
+ `checkJs` over `src/amaster-runtime-daemon/typed/**/*.mjs` and compile-time contract
47
+ tests in `type-tests/`. The first migrated boundary is the run-completion phase and
48
+ event transition table. It is imported by the existing completion-state module and
49
+ bundled normally; package layout and runtime state version are unchanged.
50
+
51
+ The package declares its own TypeScript development dependency, using the same
52
+ compiler version locked by the workspace. Source-development installs need dev
53
+ dependencies for this gate; it must not depend on the root workspace exposing
54
+ `tsc` on PATH. Published runtime consumers only need the distributed artifacts.
55
+
56
+ Put newly extracted independent daemon logic in the typed lane with explicit
57
+ inputs/outputs. New files in that directory are included automatically. Do not add
58
+ `any` or disable checking to make the gate pass. Keep untrusted I/O validation at
59
+ the boundary. `check:syntax` is only a parser check; this incremental gate does not
60
+ claim that the existing CLI/daemon or all legacy helpers are fully type-checked.
61
+
22
62
  Immutable images should pin an exact package version as their baseline. The current connector does not download or replace runtime code while running; package upgrades and rollbacks belong to the image build and rollout.
23
63
 
24
- The publish workflow verifies that npm records the publishing commit as the package `gitHead`, then updates the repository deployment pin. Remote deployment accepts that package only when its `gitHead` is an ancestor of the target source commit and the connector runtime build inputs are unchanged between them. Those inputs are the package path plus `packages/shared/src/source-acquisition-compatibility.json`, which is copied into the published package and bundled into the daemon. If another workspace source becomes a runtime build input, expand the provenance scope and tests before release. After restart, deployment also verifies the package CLI version inside the container. Do not update the deployment pin manually to bypass either provenance check.
64
+ The governed MCP cache identity follows the installed `pi-mcp-adapter` version.
65
+ Adapter 2.26+ includes `requestHeadersCommand` even when it is unset; older
66
+ versions must retain their previous identity. Upgrade the connector together
67
+ with the adapter and verify the actual version pair using the Pi MCP contract
68
+ tests. A cache identity mismatch can reject all governed tools before execution;
69
+ deleting user configuration, credentials, sessions, or connector state cannot
70
+ repair this mismatch. Each run generates its own governed cache.
71
+
72
+ Connector capability declaration is automatic. The exact package build declares
73
+ what it implements, and runtime readiness removes dynamic capabilities when their
74
+ executor or supporting runtime is unavailable. Operators restrict what the Server
75
+ accepts with `AMASTER_RUNTIME_CONNECTOR_CAPABILITY_ALLOWLIST`; users do not need to
76
+ configure a connector-local capability list. Historical `AMASTER_CAPABILITIES` and
77
+ `--capabilities` inputs remain accepted for rollback compatibility in this release,
78
+ but are ignored and reported as deprecated. They cannot add, remove, or authorize a
79
+ capability.
80
+
81
+ `browser_credential_auth_transaction_v1` is the fail-closed browser-password
82
+ capability. It is advertised only when a Pi executor is present and the installed
83
+ `@amaster.ai/pi-browser-use` entrypoint self-attests the sealed gate, private FD
84
+ client, and atomic submit transaction in its package manifest. The connector does
85
+ not infer readiness from a version number. The retired
86
+ `browser_credential_ref_fill_v1` claim is retained only in shared decode vocabulary
87
+ for historical rows and is never advertised or accepted as the new contract.
88
+
89
+ Credential values travel only over dedicated inherited file descriptors after the
90
+ browser extension validates the exact origin and form semantics. The extension
91
+ atomically fills, submits, scrubs, rotates the document context, and returns
92
+ metadata-only proof. Missing FD/client/gate/transaction/profile readiness fails
93
+ closed; there is no ordinary fill fallback.
94
+
95
+ The publish workflow verifies that npm records the publishing commit as the package `gitHead`, then updates the repository deployment pin. Remote deployment accepts that package only when its `gitHead` is an ancestor of the target source commit and the connector package path is unchanged between them. If another workspace source becomes a runtime build input, expand the provenance scope and tests before release. After restart, deployment also verifies the package CLI version inside the container. Do not update the deployment pin manually to bypass either provenance check.
25
96
 
26
97
  ## Package Contents
27
98
 
99
+ ## Pi plugin ownership boundary
100
+
101
+ `pi-cli-runtime` owns Pi plugin installation, versions, package resolution, and configuration. The connector must only start Pi, deliver a command, manage its process lifecycle, and return its result. Do not add Pi-plugin version/digest/config admission checks to connector registration, heartbeat, or ordinary command dispatch. The one security-boundary exception is the manifest capability/entrypoint attestation for `browser_credential_auth_transaction_v1`; a half-installed or older browser extension must make that capability absent before dispatch. Other plugin failures remain task execution evidence, not connector admission decisions.
102
+
28
103
  - `dist/amaster-runtime.mjs`: configuration, pairing, workspace, diagnostics, and daemon lifecycle CLI.
29
104
  - `dist/amaster-runtime-daemon.mjs`: standalone daemon bundle for connector registration, heartbeat, command execution, and result ingestion.
30
- - `dist/source-acquisition-compatibility.json`: versioned Source Acquisition compatibility manifest. Runner image builds must read this file from the exact installed connector package and fail before publishing when their Source Acquisition profile, adapter, or required package versions do not match it.
31
-
32
105
  The source of truth lives under this package's `src/` directory. The package build copies the CLI and bundles the daemon modules into publishable output; do not edit generated files under `dist/`.
33
106
 
34
107
  Runtime code belongs in the container image. Persist only connector state, the result outbox, and workspaces under the configured state directory.
35
108
 
109
+ ## Enabled context-governance admission
110
+
111
+ The Server admits governed Pi through the shared context-envelope and managed-project-instruction capabilities. The retired `final_model_context_attestation_v1` capability is no longer advertised or required.
112
+
113
+ When a `task-context-v2` command carries frozen Goal authority, the daemon verifies the exact materialized stdin or runtime system prompt before acknowledging or starting the executor, then records `mirrorx.goal-context-delivery.v1` only after the process starts without a spawn error. The metadata-only receipt binds the exact command, run, executor, authority hash, selected transport, and delivered prompt hash. It proves Connector-owned process delivery and does not claim to inspect provider payloads, model history, or native compaction.
114
+
115
+ For Server-dispatched Codex `run` and `wakeup` commands, the effective model comes from the command's `mirrorxRuntimeConnectorTaskSessionV1.configuredModel` snapshot and is passed to Codex with `--model`. `AMASTER_CODEX_MODEL` is only a compatibility fallback for older commands that do not contain that snapshot; it does not override a Server-issued model or an explicit Server-issued `null` model. A malformed or identity-mismatched snapshot fails closed with `codex_model_authority_invalid`. Its non-empty `taskKey` is an opaque Server task-session identity and is not required to equal the Issue id; the current adapter binding intentionally accepts only `codex_local`.
116
+
117
+ For admitted Pi runs, the daemon compiles source-repository `AGENTS.md` and `AGENTS.override.md` topology into one root `AGENTS.md` with explicit relative scopes, same-scope override semantics, and a higher-authority MirrorX platform block. Governed Pi preserves operator-configured user extensions and tools, disables ambient skill and context-file discovery, and injects that exact compiled file through a run-owned project-instruction extension. `pi-mcp-adapter` normally merges the operator's user-level `mcp.json` with the run-owned workspace `.pi/mcp.json`; the workspace definition wins on a same-name server, and only environment placeholders referenced by preserved user MCP definitions are granted to the child. The daemon projects the Server-issued tool catalog into run-owned MCP config and cache before spawn without revalidating that platform-owned surface. Project instructions and promoted skills use `before_agent_start` only to inject frozen content; governed tool inputs use `tool_call` for trust-boundary schema validation. No MirrorX extension validates platform-owned context or tool surfaces during execution, and no MirrorX extension uses `session_start`, `before_provider_request`, `session_before_compact`, or `session_compact`. Pi owns provider payload construction, history and native compaction. Runtime Actions, artifact receipts, completion closure and cost telemetry remain the post-run authorities.
118
+
119
+ ## WorkBuddy Host (CodeBuddy engine)
120
+
121
+ The optional `codebuddy` executor participates in the same governed task lifecycle
122
+ as Codex, while its local execution surface remains deliberately narrower than both
123
+ Codex and the WorkBuddy desktop product.
124
+ It does not expose WorkBuddy experts, projects, Office integrations, marketplace
125
+ connectors. The connector creates a
126
+ private per-run CodeBuddy home, supplies one strict MirrorX MCP definition, uses an
127
+ exact tool allowlist, exposes the governed namespace directly with
128
+ `NoDefer(mcp__amaster__*)`, and preserves only an authority-bound native session
129
+ rollout. It never inherits the user's ordinary `.codebuddy` settings, memory,
130
+ projects, MCP servers, workflows, or marketplace state. When no dedicated provider
131
+ credential is configured, it reuses only the current OS user's WorkBuddy desktop
132
+ login through a bounded encrypted-file snapshot inside the private home. The
133
+ connector copies only the active authentication id's `workbuddy-desktop.info`
134
+ opaque encrypted bytes without decrypting, parsing, logging, or serializing token
135
+ fields. Locks, logout markers, and backups are coordination/history state rather
136
+ than authentication inputs and are not copied; any logout-marker directory entry,
137
+ including a dangling symlink, makes the desktop session unavailable. CodeBuddy can
138
+ mutate only the private snapshot.
139
+
140
+ Managed CodeBuddy runs expose the native file tools plus `mcp__amaster__*`; they do
141
+ not expose Bash, WebFetch, or WebSearch. CodeBuddy 2.137.1's Bash sandbox cannot
142
+ prevent a command from connecting to an existing loopback service, so allowing Bash
143
+ would leave a path around Governed MCP even with unsandboxed execution disabled.
144
+ Consequently these runs can inspect and edit a workspace and perform governed
145
+ MirrorX actions, but they cannot run tests, builds, package managers, or arbitrary
146
+ shell commands. This is an explicit capability gap rather than claimed Pi/Codex
147
+ parity. Governed result authority remains correlated until a structured receipt is
148
+ actually parsed; an outer transport `status` cannot shadow a nested
149
+ `structuredContent` receipt, and more than 256 unresolved governed calls fails the
150
+ run instead of evicting an unmatched call id. The managed profile also resolves the
151
+ workspace once and uses that same canonical directory for CodeBuddy trust and child
152
+ process execution; an unavailable cwd fails with a stable managed-profile error.
153
+
154
+ This executor is off by default. Enable discovery with
155
+ `AMASTER_ENABLE_CODEBUDDY_EXECUTOR=true`. `AMASTER_CODEBUDDY_COMMAND` can select an
156
+ explicit CLI; on macOS the gated discovery path can also find the CLI bundled in
157
+ `/Applications/WorkBuddy.app`. CodeBuddy `2.137.1` is the minimum supported version
158
+ because that is the oldest release on which the native `NoDefer(mcp__amaster__*)`
159
+ tool surface has been verified end to end; older versions fail readiness. The
160
+ Server task-session snapshot owns the model for
161
+ current commands; `AMASTER_CODEBUDDY_MODEL` is only a compatibility fallback for
162
+ older commands without that snapshot. Authentication resolves in two fail-closed
163
+ modes: exactly one explicitly configured `CODEBUDDY_API_KEY` or
164
+ `CODEBUDDY_AUTH_TOKEN` wins, otherwise the current OS user's WorkBuddy desktop login
165
+ must be present. Desktop login reuse validates the complete source path chain and
166
+ opens it with no-follow file descriptors before materializing the private snapshot;
167
+ all run configuration and native sessions stay isolated. The snapshot is currently
168
+ supported on macOS and Linux, including Linux `XDG_DATA_HOME`; Windows
169
+ continues to require an explicit provider credential until an ACL-equivalent safety
170
+ check exists. If command scope supplies either auth variable, that complete auth
171
+ scope overrides daemon auth; two methods in the selected scope fail closed. Provider routing may additionally use the supported
172
+ `CODEBUDDY_INTERNET_ENVIRONMENT`, `CODEBUDDY_BASE_URL`, or proxy variables. Secret
173
+ values remain run-scoped and must never be placed in arguments, logs, connector
174
+ metadata, or committed configuration.
175
+
176
+ Heartbeat readiness is explicitly a fresh `daemon_default` diagnostic, not command
177
+ admission: a later command may supply its own complete auth scope. The source
178
+ metadata check intentionally runs on each heartbeat so logout and permission changes
179
+ are observed immediately; the measured local cost is about 0.03 ms per check, so it
180
+ is not cached.
181
+
182
+ This is an intentional compatibility break for the not-yet-public context-governance contract. There is no historical command migration, dual-read, or fallback from a new Server-issued envelope to an unproved executor path.
183
+
36
184
  ## Contracted Pi model calls
37
185
 
38
186
  Pi `model_call` commands with `model_call_output_contract_v1` keep provider and
@@ -66,6 +214,11 @@ An enforced stop returns `pi_tool_argument_stream_amplification` with
66
214
  byte counts, ratios, event/tool identity, thresholds, and near-miss distances;
67
215
  it omits the inline argument body.
68
216
 
217
+ The same governed workspace-file action supports both modes: omit
218
+ `documentId`, `baseRevisionId`, and `issueId` for the current Issue's initial
219
+ document, or provide `documentId` and `baseRevisionId` together for an exact
220
+ CAS revision. Both modes use the same ownership manifest and byte-ingest path.
221
+
69
222
  Pi JSON mode can also repeat a cumulative `message` snapshot beside each
70
223
  incremental `message_update`. The daemon compacts only that redundant snapshot
71
224
  from its retained parse/result buffer while preserving the delta, terminal
@@ -82,10 +235,25 @@ Pi execution uses three separate evidence layers:
82
235
  2. a durable, inspectable Runtime Action receipt or finalized Runtime Artifact;
83
236
  3. process cleanup disposition.
84
237
 
85
- An exact process-kill `EPERM` error emitted only after the first two layers have completed may be isolated as a failed `cleanupDisposition` warning without changing the command's successful business result. Both accepted shapes require `kill` and `EPERM`; generic filesystem/process permission text such as `EPERM: operation not permitted, unlink ...` is a business error. Durable evidence is limited to a completed Runtime Action, a finalized Runtime Artifact, or an accepted `company_diagnosis_brief` provider receipt whose invocation and returned Diagnosis/document/work-product identities are exact. A `runtime_action.status` readback is evidence only when its call/plan ref matches an earlier submit/commit receipt in the same transcript. The diagnostic and durable evidence reference remain in the result. Text-only or action-only-without-assistant-output streams, standalone governed reads, non-effect Runtime Action tools, rejected or pending effects, pre-terminal errors, provider failures, timeout, cancellation, resource limits, any signal, live residue, and uncertain ownership remain failures.
238
+ An exact process-kill `EPERM` error emitted only after the first two layers have completed may be isolated as a failed `cleanupDisposition` warning without changing the command's successful business result. Both accepted shapes require `kill` and `EPERM`; generic filesystem/process permission text such as `EPERM: operation not permitted, unlink ...` is a business error. Durable evidence is limited to a completed Runtime Action or a finalized Runtime Artifact. A `runtime_action.status` readback is evidence only when its call/plan ref matches an earlier submit/commit receipt in the same transcript. The diagnostic and durable evidence reference remain in the result. Text-only or action-only-without-assistant-output streams, standalone governed reads, non-effect Runtime Action tools, rejected or pending effects, pre-terminal errors, provider failures, timeout, cancellation, resource limits, any signal, live residue, and uncertain ownership remain failures.
86
239
 
87
240
  This isolation does not schedule a retry or a second business continuation. Command result delivery and the result outbox remain the sole idempotency boundary.
88
241
 
242
+ ## Live log delivery durability
243
+
244
+ Executor process logs (stdout/stderr events, including full-transcript chat turns) are streamed to the Server as batches against `/ingest/logs/batch`. Every live log entry carries a per-command monotonically increasing `seq`; the Server dedupes on `(commandId, sourceSeq)`, so a retry after an ambiguous outcome (restart, timeout, 5xx) never duplicates canonical `heartbeat_run_events`.
245
+
246
+ Full-transcript turns preserve every pi event as canonical log entries, including per-token streaming deltas (`thinking_delta`, `text_delta`, `toolcall_delta`) — the chat transcript's typewriter rendering is driven by them. No per-stream entry budget exists: every entry is delivered, and live output is never suppressed. Byte volume stays bounded by the executor flood limit, and outage-time connector memory by the retry backlog byte bound below.
247
+
248
+ A batch whose delivery outcome is ambiguous is not dropped: it enters a bounded in-memory retry backlog that is retried on a timer and drains in source order, preserving `heartbeat_run_events` ordering. If the backlog is still undelivered when the executor turn ends, the remaining entries move into the durable result outbox and the command result is deferred until the log entries are delivered first; a sustained log-ingest outage bounded by `AMASTER_RESULT_OUTBOX_MAX_ATTEMPTS` drops the entries with a stderr diagnostic rather than holding the result hostage. HTTP 400 entries keep the existing bisect-to-invalid drop semantics.
249
+
250
+ Tuning knobs (defaults are the production values):
251
+
252
+ - `AMASTER_RUNTIME_LIVE_LOG_RETRY_BACKLOG_MAX_BYTES` (default 16 MiB): in-memory backlog bound; oldest batches are dropped with a diagnostic when exceeded.
253
+ - `AMASTER_RUNTIME_LIVE_LOG_RETRY_INTERVAL_MS` (default 2000): background backlog retry cadence.
254
+ - `AMASTER_RUNTIME_LIVE_LOG_FINAL_DRAIN_ATTEMPTS` (default 3) and `AMASTER_RUNTIME_LIVE_LOG_FINAL_DRAIN_TIMEOUT_MS` (default 5000): bounded final drain at the end of an executor turn.
255
+ - `AMASTER_RUNTIME_DEFERRED_LOG_DRAIN_TIMEOUT_MS` (default 5000): per-batch timeout when delivering deferred entries before a command result or from the result outbox.
256
+
89
257
  ## Mutation attestation
90
258
 
91
259
  The daemon reports its connector contract, exact package/build, platform/architecture, and discovered executor versions on every heartbeat. The server compares those facts with `AMASTER_RUNTIME_RECOMMENDED_VERSION` and `AMASTER_RUNTIME_RECOMMENDED_BUILD_COMMIT`, persists a short-lived content-bound attestation, and correlates Runtime V2 commands to that proof.
@@ -100,3 +268,7 @@ connector package version under `/opt/pi-cli-runtime` and sets
100
268
  `AMASTER_RUNTIME_CLI_TARGET` to that package binary. Do not mount repository
101
269
  scripts or previously installed runtime code from `/data` over this path;
102
270
  `/data` is a state volume and must survive package upgrades and rollbacks.
271
+
272
+ ### Pi extension load diagnostics
273
+
274
+ Successful `pi_agent_extension_load_timing` events are forwarded as `system` / `info` records with an extension name and duration. The event payload preserves `sourceStream: stderr` and the original structured diagnostic. Successful timing records are excluded from result stderr excerpts so they do not create warning panels. Failed loads remain `stderr` / `error` with their diagnostic details; unknown or malformed events keep the existing stderr behavior. This applies to new runs after updating the connector in the runner image; historical log records are not rewritten.
@@ -0,0 +1,107 @@
1
+ export const BUILD_SUPPORTED_CAPABILITIES = Object.freeze([
2
+ "remote_registration",
3
+ "heartbeat",
4
+ "executor_discovery",
5
+ "workspace_binding",
6
+ "run_wakeup",
7
+ "context_envelope_v1",
8
+ "task_context_v2",
9
+ "managed_project_instructions_v1",
10
+ "artifact_template_catalog_v1",
11
+ "runtime_actions_v2",
12
+ "runtime_artifact_live_manifest_v1",
13
+ "continue_task_v1",
14
+ "run_exit_live_path_closure_v1",
15
+ "model_call",
16
+ "model_call_output_contract_v1",
17
+ "run_cancel",
18
+ "run_terminate",
19
+ "logs_cost_workspace_status",
20
+ "browser_credential_auth_transaction_v1",
21
+ "execution_lanes_v1",
22
+ "mirrorx_initialization_context_v1",
23
+ "mirrorx_initialization_completion_v1",
24
+ "native_session_checkpoint_v1",
25
+ ]);
26
+
27
+ const DYNAMIC_READINESS = Object.freeze({
28
+ browser_credential_auth_transaction_v1: {
29
+ reasonCode: "browser_credential_auth_runtime_incomplete",
30
+ ready: (input) => {
31
+ const readiness = input.browserCredentialAuth;
32
+ return input.executors.some((executor) => executor.kind === "pi")
33
+ && readiness?.privateChannel === true
34
+ && readiness?.executorClient === true
35
+ && readiness?.sealedGate === true
36
+ && readiness?.atomicTransaction === true
37
+ && readiness?.trustedProfileInjection === true;
38
+ },
39
+ },
40
+ native_session_checkpoint_v1: {
41
+ reasonCode: "managed_pi_checkpoint_required",
42
+ ready: (input) => input.checkpointUploadEnabled === true && input.runnerKind === "cloud_managed"
43
+ && input.executors.some((executor) => executor.kind === "pi"),
44
+ },
45
+ mirrorx_initialization_context_v1: {
46
+ reasonCode: "pi_executor_required",
47
+ ready: (input) => input.executors.some((executor) => executor.kind === "pi"),
48
+ },
49
+ mirrorx_initialization_completion_v1: {
50
+ reasonCode: "managed_linux_pi_required",
51
+ ready: (input) => process.platform === "linux" && input.runnerKind === "cloud_managed"
52
+ && input.executors.some((executor) => executor.kind === "pi"),
53
+ },
54
+ artifact_template_catalog_v1: {
55
+ reasonCode: "artifact_template_catalog_not_ready",
56
+ ready: (input) => {
57
+ const catalog = input.templateCatalog;
58
+ return catalog?.status === "ready"
59
+ && catalog.bundleAttested === true
60
+ && catalog.materialized === true
61
+ && catalog.readable === true
62
+ && catalog.executorReadable === true
63
+ && Number.isSafeInteger(catalog.fileCount)
64
+ && catalog.fileCount > 0
65
+ && typeof catalog.manifestSha256 === "string"
66
+ && /^[a-f0-9]{64}$/u.test(catalog.manifestSha256)
67
+ && typeof catalog.targetDir === "string"
68
+ && catalog.targetDir === input.runtimeTemplatesRoot;
69
+ },
70
+ },
71
+ });
72
+
73
+ function uniqueStrings(values) {
74
+ return Array.from(new Set((Array.isArray(values) ? values : [])
75
+ .map((value) => String(value ?? "").trim())
76
+ .filter(Boolean)));
77
+ }
78
+
79
+ export function buildRuntimeCapabilityReport(input) {
80
+ const legacyConfiguredCapabilities = uniqueStrings(input.legacyConfiguredCapabilities);
81
+ const runtimeUnavailable = [];
82
+ const advertised = BUILD_SUPPORTED_CAPABILITIES.filter((capability) => {
83
+ const readiness = DYNAMIC_READINESS[capability];
84
+ if (!readiness || readiness.ready(input)) return true;
85
+ runtimeUnavailable.push({
86
+ capability,
87
+ reasonCode: typeof readiness.reasonCode === "function"
88
+ ? readiness.reasonCode(input)
89
+ : readiness.reasonCode,
90
+ });
91
+ return false;
92
+ });
93
+ const buildSet = new Set(BUILD_SUPPORTED_CAPABILITIES);
94
+ const legacySet = new Set(legacyConfiguredCapabilities);
95
+ return {
96
+ schemaVersion: "mirrorx.connector-capability-report/v1",
97
+ source: "build_attested",
98
+ buildSupported: [...BUILD_SUPPORTED_CAPABILITIES],
99
+ runtimeUnavailable,
100
+ advertised,
101
+ deprecatedCapabilityOverridePresent: legacyConfiguredCapabilities.length > 0,
102
+ legacyMissingFromBuildTruth: legacyConfiguredCapabilities.length > 0
103
+ ? BUILD_SUPPORTED_CAPABILITIES.filter((capability) => !legacySet.has(capability))
104
+ : [],
105
+ legacyUnsupportedClaims: legacyConfiguredCapabilities.filter((capability) => !buildSet.has(capability)),
106
+ };
107
+ }