@amaster.ai/employee-runtime-connector 0.1.1-beta.35 → 0.1.1-beta.351

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 (42) hide show
  1. package/README.md +171 -5
  2. package/dist/amaster-runtime-daemon/capability-registry.mjs +95 -0
  3. package/dist/amaster-runtime-daemon.mjs +34826 -9661
  4. package/dist/amaster-runtime.mjs +15 -18
  5. package/dist/templates/.mirrorx-preset-templates.json +185 -0
  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" +470 -0
  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 +470 -0
  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 +306 -0
  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 +466 -0
  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 +474 -0
  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 +298 -0
  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 +389 -0
  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 +458 -0
  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 +464 -0
  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 +456 -0
  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 +452 -0
  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 +432 -0
  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 +446 -0
  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 +436 -0
  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 +466 -0
  42. package/package.json +11 -5
package/README.md CHANGED
@@ -12,26 +12,168 @@ 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,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 package path is unchanged between them. This path-only comparison is valid because the published connector is self-contained; if runtime code starts importing workspace source outside this package, 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_ref_fill_v1` is a narrow private command capability. It can
82
+ consume only a Server-issued credential ref for the exact command and writes the
83
+ resolved value to a dedicated inherited file descriptor; it does not expose the
84
+ value through prompt, argv, environment, workspace, logs, or result JSON. Normal
85
+ navigation, snapshots, form submission, waits, and challenges remain ordinary Pi
86
+ browser/task behavior.
87
+
88
+ 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
89
 
26
90
  ## Package Contents
27
91
 
92
+ ## Pi plugin ownership boundary
93
+
94
+ `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 package/version/digest/schema/config checks to connector registration, heartbeat, capability advertisement, or command dispatch. A plugin failure is task execution evidence, not a connector admission decision.
95
+
28
96
  - `dist/amaster-runtime.mjs`: configuration, pairing, workspace, diagnostics, and daemon lifecycle CLI.
29
97
  - `dist/amaster-runtime-daemon.mjs`: standalone daemon bundle for connector registration, heartbeat, command execution, and result ingestion.
30
-
31
98
  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/`.
32
99
 
33
100
  Runtime code belongs in the container image. Persist only connector state, the result outbox, and workspaces under the configured state directory.
34
101
 
102
+ ## Enabled context-governance admission
103
+
104
+ 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.
105
+
106
+ 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.
107
+
108
+ 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`.
109
+
110
+ 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.
111
+
112
+ ## WorkBuddy Host (CodeBuddy engine)
113
+
114
+ The optional `codebuddy` executor participates in the same governed task lifecycle
115
+ as Codex, while its local execution surface remains deliberately narrower than both
116
+ Codex and the WorkBuddy desktop product.
117
+ It does not expose WorkBuddy experts, projects, Office integrations, marketplace
118
+ connectors. The connector creates a
119
+ private per-run CodeBuddy home, supplies one strict MirrorX MCP definition, uses an
120
+ exact tool allowlist, exposes the governed namespace directly with
121
+ `NoDefer(mcp__amaster__*)`, and preserves only an authority-bound native session
122
+ rollout. It never inherits the user's ordinary `.codebuddy` settings, memory,
123
+ projects, MCP servers, workflows, or marketplace state. When no dedicated provider
124
+ credential is configured, it reuses only the current OS user's WorkBuddy desktop
125
+ login through a bounded encrypted-file snapshot inside the private home. The
126
+ connector copies only the active authentication id's `workbuddy-desktop.info`
127
+ opaque encrypted bytes without decrypting, parsing, logging, or serializing token
128
+ fields. Locks, logout markers, and backups are coordination/history state rather
129
+ than authentication inputs and are not copied; any logout-marker directory entry,
130
+ including a dangling symlink, makes the desktop session unavailable. CodeBuddy can
131
+ mutate only the private snapshot.
132
+
133
+ Managed CodeBuddy runs expose the native file tools plus `mcp__amaster__*`; they do
134
+ not expose Bash, WebFetch, or WebSearch. CodeBuddy 2.137.1's Bash sandbox cannot
135
+ prevent a command from connecting to an existing loopback service, so allowing Bash
136
+ would leave a path around Governed MCP even with unsandboxed execution disabled.
137
+ Consequently these runs can inspect and edit a workspace and perform governed
138
+ MirrorX actions, but they cannot run tests, builds, package managers, or arbitrary
139
+ shell commands. This is an explicit capability gap rather than claimed Pi/Codex
140
+ parity. Governed result authority remains correlated until a structured receipt is
141
+ actually parsed; an outer transport `status` cannot shadow a nested
142
+ `structuredContent` receipt, and more than 256 unresolved governed calls fails the
143
+ run instead of evicting an unmatched call id. The managed profile also resolves the
144
+ workspace once and uses that same canonical directory for CodeBuddy trust and child
145
+ process execution; an unavailable cwd fails with a stable managed-profile error.
146
+
147
+ This executor is off by default. Enable discovery with
148
+ `AMASTER_ENABLE_CODEBUDDY_EXECUTOR=true`. `AMASTER_CODEBUDDY_COMMAND` can select an
149
+ explicit CLI; on macOS the gated discovery path can also find the CLI bundled in
150
+ `/Applications/WorkBuddy.app`. CodeBuddy `2.137.1` is the minimum supported version
151
+ because that is the oldest release on which the native `NoDefer(mcp__amaster__*)`
152
+ tool surface has been verified end to end; older versions fail readiness. The
153
+ Server task-session snapshot owns the model for
154
+ current commands; `AMASTER_CODEBUDDY_MODEL` is only a compatibility fallback for
155
+ older commands without that snapshot. Authentication resolves in two fail-closed
156
+ modes: exactly one explicitly configured `CODEBUDDY_API_KEY` or
157
+ `CODEBUDDY_AUTH_TOKEN` wins, otherwise the current OS user's WorkBuddy desktop login
158
+ must be present. Desktop login reuse validates the complete source path chain and
159
+ opens it with no-follow file descriptors before materializing the private snapshot;
160
+ all run configuration and native sessions stay isolated. The snapshot is currently
161
+ supported on macOS and Linux, including Linux `XDG_DATA_HOME`; Windows
162
+ continues to require an explicit provider credential until an ACL-equivalent safety
163
+ check exists. If command scope supplies either auth variable, that complete auth
164
+ scope overrides daemon auth; two methods in the selected scope fail closed. Provider routing may additionally use the supported
165
+ `CODEBUDDY_INTERNET_ENVIRONMENT`, `CODEBUDDY_BASE_URL`, or proxy variables. Secret
166
+ values remain run-scoped and must never be placed in arguments, logs, connector
167
+ metadata, or committed configuration.
168
+
169
+ Heartbeat readiness is explicitly a fresh `daemon_default` diagnostic, not command
170
+ admission: a later command may supply its own complete auth scope. The source
171
+ metadata check intentionally runs on each heartbeat so logout and permission changes
172
+ are observed immediately; the measured local cost is about 0.03 ms per check, so it
173
+ is not cached.
174
+
175
+ 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.
176
+
35
177
  ## Contracted Pi model calls
36
178
 
37
179
  Pi `model_call` commands with `model_call_output_contract_v1` keep provider and
@@ -65,6 +207,11 @@ An enforced stop returns `pi_tool_argument_stream_amplification` with
65
207
  byte counts, ratios, event/tool identity, thresholds, and near-miss distances;
66
208
  it omits the inline argument body.
67
209
 
210
+ The same governed workspace-file action supports both modes: omit
211
+ `documentId`, `baseRevisionId`, and `issueId` for the current Issue's initial
212
+ document, or provide `documentId` and `baseRevisionId` together for an exact
213
+ CAS revision. Both modes use the same ownership manifest and byte-ingest path.
214
+
68
215
  Pi JSON mode can also repeat a cumulative `message` snapshot beside each
69
216
  incremental `message_update`. The daemon compacts only that redundant snapshot
70
217
  from its retained parse/result buffer while preserving the delta, terminal
@@ -81,10 +228,25 @@ Pi execution uses three separate evidence layers:
81
228
  2. a durable, inspectable Runtime Action receipt or finalized Runtime Artifact;
82
229
  3. process cleanup disposition.
83
230
 
84
- 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.
231
+ 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.
85
232
 
86
233
  This isolation does not schedule a retry or a second business continuation. Command result delivery and the result outbox remain the sole idempotency boundary.
87
234
 
235
+ ## Live log delivery durability
236
+
237
+ 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`.
238
+
239
+ 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.
240
+
241
+ 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.
242
+
243
+ Tuning knobs (defaults are the production values):
244
+
245
+ - `AMASTER_RUNTIME_LIVE_LOG_RETRY_BACKLOG_MAX_BYTES` (default 16 MiB): in-memory backlog bound; oldest batches are dropped with a diagnostic when exceeded.
246
+ - `AMASTER_RUNTIME_LIVE_LOG_RETRY_INTERVAL_MS` (default 2000): background backlog retry cadence.
247
+ - `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.
248
+ - `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.
249
+
88
250
  ## Mutation attestation
89
251
 
90
252
  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.
@@ -99,3 +261,7 @@ connector package version under `/opt/pi-cli-runtime` and sets
99
261
  `AMASTER_RUNTIME_CLI_TARGET` to that package binary. Do not mount repository
100
262
  scripts or previously installed runtime code from `/data` over this path;
101
263
  `/data` is a state volume and must survive package upgrades and rollbacks.
264
+
265
+ ### Pi extension load diagnostics
266
+
267
+ 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,95 @@
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_ref_fill_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
+ native_session_checkpoint_v1: {
29
+ reasonCode: "managed_pi_checkpoint_required",
30
+ ready: (input) => input.checkpointUploadEnabled === true && input.runnerKind === "cloud_managed"
31
+ && input.executors.some((executor) => executor.kind === "pi"),
32
+ },
33
+ mirrorx_initialization_context_v1: {
34
+ reasonCode: "pi_executor_required",
35
+ ready: (input) => input.executors.some((executor) => executor.kind === "pi"),
36
+ },
37
+ mirrorx_initialization_completion_v1: {
38
+ reasonCode: "managed_linux_pi_required",
39
+ ready: (input) => process.platform === "linux" && input.runnerKind === "cloud_managed"
40
+ && input.executors.some((executor) => executor.kind === "pi"),
41
+ },
42
+ artifact_template_catalog_v1: {
43
+ reasonCode: "artifact_template_catalog_not_ready",
44
+ ready: (input) => {
45
+ const catalog = input.templateCatalog;
46
+ return catalog?.status === "ready"
47
+ && catalog.bundleAttested === true
48
+ && catalog.materialized === true
49
+ && catalog.readable === true
50
+ && catalog.executorReadable === true
51
+ && Number.isSafeInteger(catalog.fileCount)
52
+ && catalog.fileCount > 0
53
+ && typeof catalog.manifestSha256 === "string"
54
+ && /^[a-f0-9]{64}$/u.test(catalog.manifestSha256)
55
+ && typeof catalog.targetDir === "string"
56
+ && catalog.targetDir === input.runtimeTemplatesRoot;
57
+ },
58
+ },
59
+ });
60
+
61
+ function uniqueStrings(values) {
62
+ return Array.from(new Set((Array.isArray(values) ? values : [])
63
+ .map((value) => String(value ?? "").trim())
64
+ .filter(Boolean)));
65
+ }
66
+
67
+ export function buildRuntimeCapabilityReport(input) {
68
+ const legacyConfiguredCapabilities = uniqueStrings(input.legacyConfiguredCapabilities);
69
+ const runtimeUnavailable = [];
70
+ const advertised = BUILD_SUPPORTED_CAPABILITIES.filter((capability) => {
71
+ const readiness = DYNAMIC_READINESS[capability];
72
+ if (!readiness || readiness.ready(input)) return true;
73
+ runtimeUnavailable.push({
74
+ capability,
75
+ reasonCode: typeof readiness.reasonCode === "function"
76
+ ? readiness.reasonCode(input)
77
+ : readiness.reasonCode,
78
+ });
79
+ return false;
80
+ });
81
+ const buildSet = new Set(BUILD_SUPPORTED_CAPABILITIES);
82
+ const legacySet = new Set(legacyConfiguredCapabilities);
83
+ return {
84
+ schemaVersion: "mirrorx.connector-capability-report/v1",
85
+ source: "build_attested",
86
+ buildSupported: [...BUILD_SUPPORTED_CAPABILITIES],
87
+ runtimeUnavailable,
88
+ advertised,
89
+ deprecatedCapabilityOverridePresent: legacyConfiguredCapabilities.length > 0,
90
+ legacyMissingFromBuildTruth: legacyConfiguredCapabilities.length > 0
91
+ ? BUILD_SUPPORTED_CAPABILITIES.filter((capability) => !legacySet.has(capability))
92
+ : [],
93
+ legacyUnsupportedClaims: legacyConfiguredCapabilities.filter((capability) => !buildSet.has(capability)),
94
+ };
95
+ }