@amaster.ai/employee-runtime-connector 0.1.1-beta.34 → 0.1.1-beta.341

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 +147 -5
  2. package/dist/amaster-runtime-daemon/capability-registry.mjs +95 -0
  3. package/dist/amaster-runtime-daemon.mjs +33470 -8602
  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,144 @@ 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
+ ## Incremental type safety
22
+
23
+ `pnpm typecheck` runs the legacy entry-point syntax checks plus TypeScript strict
24
+ `checkJs` over `src/amaster-runtime-daemon/typed/**/*.mjs` and compile-time contract
25
+ tests in `type-tests/`. The first migrated boundary is the run-completion phase and
26
+ event transition table. It is imported by the existing completion-state module and
27
+ bundled normally; package layout and runtime state version are unchanged.
28
+
29
+ The package declares its own TypeScript development dependency, using the same
30
+ compiler version locked by the workspace. Source-development installs need dev
31
+ dependencies for this gate; it must not depend on the root workspace exposing
32
+ `tsc` on PATH. Published runtime consumers only need the distributed artifacts.
33
+
34
+ Put newly extracted independent daemon logic in the typed lane with explicit
35
+ inputs/outputs. New files in that directory are included automatically. Do not add
36
+ `any` or disable checking to make the gate pass. Keep untrusted I/O validation at
37
+ the boundary. `check:syntax` is only a parser check; this incremental gate does not
38
+ claim that the existing CLI/daemon or all legacy helpers are fully type-checked.
39
+
22
40
  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
41
 
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.
42
+ The governed MCP cache identity follows the installed `pi-mcp-adapter` version.
43
+ Adapter 2.26+ includes `requestHeadersCommand` even when it is unset; older
44
+ versions must retain their previous identity. Upgrade the connector together
45
+ with the adapter and verify the actual version pair using the Pi MCP contract
46
+ tests. A cache identity mismatch can reject all governed tools before execution;
47
+ deleting user configuration, credentials, sessions, or connector state cannot
48
+ repair this mismatch. Each run generates its own governed cache.
49
+
50
+ Connector capability declaration is automatic. The exact package build declares
51
+ what it implements, and runtime readiness removes dynamic capabilities when their
52
+ executor or supporting runtime is unavailable. Operators restrict what the Server
53
+ accepts with `AMASTER_RUNTIME_CONNECTOR_CAPABILITY_ALLOWLIST`; users do not need to
54
+ configure a connector-local capability list. Historical `AMASTER_CAPABILITIES` and
55
+ `--capabilities` inputs remain accepted for rollback compatibility in this release,
56
+ but are ignored and reported as deprecated. They cannot add, remove, or authorize a
57
+ capability.
58
+
59
+ `browser_credential_ref_fill_v1` is a narrow private command capability. It can
60
+ consume only a Server-issued credential ref for the exact command and writes the
61
+ resolved value to a dedicated inherited file descriptor; it does not expose the
62
+ value through prompt, argv, environment, workspace, logs, or result JSON. Normal
63
+ navigation, snapshots, form submission, waits, and challenges remain ordinary Pi
64
+ browser/task behavior.
65
+
66
+ 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
67
 
26
68
  ## Package Contents
27
69
 
70
+ ## Pi plugin ownership boundary
71
+
72
+ `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.
73
+
28
74
  - `dist/amaster-runtime.mjs`: configuration, pairing, workspace, diagnostics, and daemon lifecycle CLI.
29
75
  - `dist/amaster-runtime-daemon.mjs`: standalone daemon bundle for connector registration, heartbeat, command execution, and result ingestion.
30
-
31
76
  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
77
 
33
78
  Runtime code belongs in the container image. Persist only connector state, the result outbox, and workspaces under the configured state directory.
34
79
 
80
+ ## Enabled context-governance admission
81
+
82
+ 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.
83
+
84
+ 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`.
85
+
86
+ 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.
87
+
88
+ ## WorkBuddy Host (CodeBuddy engine)
89
+
90
+ The optional `codebuddy` executor participates in the same governed task lifecycle
91
+ as Codex, while its local execution surface remains deliberately narrower than both
92
+ Codex and the WorkBuddy desktop product.
93
+ It does not expose WorkBuddy experts, projects, Office integrations, marketplace
94
+ connectors. The connector creates a
95
+ private per-run CodeBuddy home, supplies one strict MirrorX MCP definition, uses an
96
+ exact tool allowlist, exposes the governed namespace directly with
97
+ `NoDefer(mcp__amaster__*)`, and preserves only an authority-bound native session
98
+ rollout. It never inherits the user's ordinary `.codebuddy` settings, memory,
99
+ projects, MCP servers, workflows, or marketplace state. When no dedicated provider
100
+ credential is configured, it reuses only the current OS user's WorkBuddy desktop
101
+ login through a bounded encrypted-file snapshot inside the private home. The
102
+ connector copies only the active authentication id's `workbuddy-desktop.info`
103
+ opaque encrypted bytes without decrypting, parsing, logging, or serializing token
104
+ fields. Locks, logout markers, and backups are coordination/history state rather
105
+ than authentication inputs and are not copied; any logout-marker directory entry,
106
+ including a dangling symlink, makes the desktop session unavailable. CodeBuddy can
107
+ mutate only the private snapshot.
108
+
109
+ Managed CodeBuddy runs expose the native file tools plus `mcp__amaster__*`; they do
110
+ not expose Bash, WebFetch, or WebSearch. CodeBuddy 2.137.1's Bash sandbox cannot
111
+ prevent a command from connecting to an existing loopback service, so allowing Bash
112
+ would leave a path around Governed MCP even with unsandboxed execution disabled.
113
+ Consequently these runs can inspect and edit a workspace and perform governed
114
+ MirrorX actions, but they cannot run tests, builds, package managers, or arbitrary
115
+ shell commands. This is an explicit capability gap rather than claimed Pi/Codex
116
+ parity. Governed result authority remains correlated until a structured receipt is
117
+ actually parsed; an outer transport `status` cannot shadow a nested
118
+ `structuredContent` receipt, and more than 256 unresolved governed calls fails the
119
+ run instead of evicting an unmatched call id. The managed profile also resolves the
120
+ workspace once and uses that same canonical directory for CodeBuddy trust and child
121
+ process execution; an unavailable cwd fails with a stable managed-profile error.
122
+
123
+ This executor is off by default. Enable discovery with
124
+ `AMASTER_ENABLE_CODEBUDDY_EXECUTOR=true`. `AMASTER_CODEBUDDY_COMMAND` can select an
125
+ explicit CLI; on macOS the gated discovery path can also find the CLI bundled in
126
+ `/Applications/WorkBuddy.app`. CodeBuddy `2.137.1` is the minimum supported version
127
+ because that is the oldest release on which the native `NoDefer(mcp__amaster__*)`
128
+ tool surface has been verified end to end; older versions fail readiness. The
129
+ Server task-session snapshot owns the model for
130
+ current commands; `AMASTER_CODEBUDDY_MODEL` is only a compatibility fallback for
131
+ older commands without that snapshot. Authentication resolves in two fail-closed
132
+ modes: exactly one explicitly configured `CODEBUDDY_API_KEY` or
133
+ `CODEBUDDY_AUTH_TOKEN` wins, otherwise the current OS user's WorkBuddy desktop login
134
+ must be present. Desktop login reuse validates the complete source path chain and
135
+ opens it with no-follow file descriptors before materializing the private snapshot;
136
+ all run configuration and native sessions stay isolated. The snapshot is currently
137
+ supported on macOS and Linux, including Linux `XDG_DATA_HOME`; Windows
138
+ continues to require an explicit provider credential until an ACL-equivalent safety
139
+ check exists. If command scope supplies either auth variable, that complete auth
140
+ scope overrides daemon auth; two methods in the selected scope fail closed. Provider routing may additionally use the supported
141
+ `CODEBUDDY_INTERNET_ENVIRONMENT`, `CODEBUDDY_BASE_URL`, or proxy variables. Secret
142
+ values remain run-scoped and must never be placed in arguments, logs, connector
143
+ metadata, or committed configuration.
144
+
145
+ Heartbeat readiness is explicitly a fresh `daemon_default` diagnostic, not command
146
+ admission: a later command may supply its own complete auth scope. The source
147
+ metadata check intentionally runs on each heartbeat so logout and permission changes
148
+ are observed immediately; the measured local cost is about 0.03 ms per check, so it
149
+ is not cached.
150
+
151
+ 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.
152
+
35
153
  ## Contracted Pi model calls
36
154
 
37
155
  Pi `model_call` commands with `model_call_output_contract_v1` keep provider and
@@ -65,6 +183,11 @@ An enforced stop returns `pi_tool_argument_stream_amplification` with
65
183
  byte counts, ratios, event/tool identity, thresholds, and near-miss distances;
66
184
  it omits the inline argument body.
67
185
 
186
+ The same governed workspace-file action supports both modes: omit
187
+ `documentId`, `baseRevisionId`, and `issueId` for the current Issue's initial
188
+ document, or provide `documentId` and `baseRevisionId` together for an exact
189
+ CAS revision. Both modes use the same ownership manifest and byte-ingest path.
190
+
68
191
  Pi JSON mode can also repeat a cumulative `message` snapshot beside each
69
192
  incremental `message_update`. The daemon compacts only that redundant snapshot
70
193
  from its retained parse/result buffer while preserving the delta, terminal
@@ -81,10 +204,25 @@ Pi execution uses three separate evidence layers:
81
204
  2. a durable, inspectable Runtime Action receipt or finalized Runtime Artifact;
82
205
  3. process cleanup disposition.
83
206
 
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.
207
+ 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
208
 
86
209
  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
210
 
211
+ ## Live log delivery durability
212
+
213
+ 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`.
214
+
215
+ 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.
216
+
217
+ 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.
218
+
219
+ Tuning knobs (defaults are the production values):
220
+
221
+ - `AMASTER_RUNTIME_LIVE_LOG_RETRY_BACKLOG_MAX_BYTES` (default 16 MiB): in-memory backlog bound; oldest batches are dropped with a diagnostic when exceeded.
222
+ - `AMASTER_RUNTIME_LIVE_LOG_RETRY_INTERVAL_MS` (default 2000): background backlog retry cadence.
223
+ - `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.
224
+ - `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.
225
+
88
226
  ## Mutation attestation
89
227
 
90
228
  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 +237,7 @@ connector package version under `/opt/pi-cli-runtime` and sets
99
237
  `AMASTER_RUNTIME_CLI_TARGET` to that package binary. Do not mount repository
100
238
  scripts or previously installed runtime code from `/data` over this path;
101
239
  `/data` is a state volume and must survive package upgrades and rollbacks.
240
+
241
+ ### Pi extension load diagnostics
242
+
243
+ 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
+ }