@amaster.ai/employee-runtime-connector 0.1.1-beta.15 → 0.1.1-beta.151

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 (22) hide show
  1. package/README.md +42 -3
  2. package/dist/amaster-runtime-daemon/capability-registry.mjs +85 -0
  3. package/dist/amaster-runtime-daemon.mjs +24567 -3524
  4. package/dist/amaster-runtime.mjs +15 -20
  5. package/dist/source-acquisition-compatibility.json +127 -0
  6. package/dist/templates/.mirrorx-preset-templates.json +80 -0
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. 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
  21. 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
  22. package/package.json +5 -2
package/README.md CHANGED
@@ -12,8 +12,7 @@ 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,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
 
@@ -21,17 +20,57 @@ Do not use `latest`, `^`, or `~` in a runtime image. The image tag and connector
21
20
 
22
21
  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
22
 
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.
23
+ Connector capability declaration is automatic. The exact package build declares
24
+ what it implements, and runtime readiness removes dynamic capabilities when their
25
+ executor or supporting runtime is unavailable. Operators restrict what the Server
26
+ accepts with `AMASTER_RUNTIME_CONNECTOR_CAPABILITY_ALLOWLIST`; users do not need to
27
+ configure a connector-local capability list. Historical `AMASTER_CAPABILITIES` and
28
+ `--capabilities` inputs remain accepted for rollback compatibility in this release,
29
+ but are ignored and reported as deprecated. They cannot add, remove, or authorize a
30
+ capability.
31
+
32
+ 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. The manifest's failure-classification allowlists are therefore immutable build inputs too; Connector classification and any authorized Server parser must consume the same exact package truth. 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
33
 
26
34
  ## Package Contents
27
35
 
36
+ ## Pi plugin ownership boundary
37
+
38
+ `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.
39
+
28
40
  - `dist/amaster-runtime.mjs`: configuration, pairing, workspace, diagnostics, and daemon lifecycle CLI.
29
41
  - `dist/amaster-runtime-daemon.mjs`: standalone daemon bundle for connector registration, heartbeat, command execution, and result ingestion.
42
+ - `dist/source-acquisition-compatibility.json`: versioned Source Acquisition protocol and failure-classification manifest. It does not constrain Pi plugin packages, versions, or configuration.
43
+
44
+ Source executor diagnostics remain inside the complete run result JSON for authorized Server/read-surface handling. They contain only manifest-allowlisted failure and reason codes plus bounded phase/retry/start-state fields; raw error messages, arbitrary error codes, paths, locators, stdout, and stderr are not part of that contract. This Connector-only slice does not add a Company Sources client projection.
30
45
 
31
46
  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
47
 
33
48
  Runtime code belongs in the container image. Persist only connector state, the result outbox, and workspaces under the configured state directory.
34
49
 
50
+ ## Enabled context-governance admission
51
+
52
+ The Server requires `final_model_context_attestation_v1` for governed Pi runs because that path disables ambient context discovery and injects a run-owned compiled instruction bundle. This is a Pi delivery contract, not a connector-wide requirement: an explicitly selected self-hosted Codex runtime continues through its own Runtime Actions V2 and native-session contracts and cannot borrow the Pi attestation claim. Adding the same final-context guarantee to another executor requires executor-specific proof for scoped project-instruction semantics, the normalized final active tool schemas, the selected model's context/output limits, automatically visible skill metadata, resumed-session history, and the enforced output reserve.
53
+
54
+ 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 disables ambient extension, skill, and context-file discovery and injects that exact compiled file through a run-owned final-system-prompt extension. When the operator-owned Pi settings declare `@amaster.ai/pi-telemetry`, the daemon resolves only that package-owned entry, requires the runtime npm manifest to pin its exact installed version, verifies its name, path, and tree digest, passes it as an explicit extension, and preserves the authoritative runtime run id for trace correlation; every other ambient package extension remains disabled. A last-ordered `before_provider_request` hook then validates every provider call, including later calls after tool results: exactly one system message contains the compiled instructions, visible role-skill metadata and the normalized active tool set match their prior attestations, the provider model/output ceiling match the run contract, and the complete serialized payload plus output reserve fits the context window. Each call appends metadata-only hashes and sizes to a bounded chained receipt; a missing, broken, or oversized chain fails the run.
55
+
56
+ Pi 0.80.10's internal compaction summarizer calls the provider outside `before_provider_request`. The Enabled profile therefore records and cancels every `session_before_compact` attempt and fails immediately if `session_compact` is nevertheless observed. No model-generated compaction summary is accepted until that provider path has equivalent final-context attestation. The Server also enumerates Pi and Codex as the only supported governed executors at configuration and heartbeat dispatch boundaries; missing or unknown executor kinds fail closed.
57
+
58
+ 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.
59
+
60
+ ## Contracted Pi model calls
61
+
62
+ Pi `model_call` commands with `model_call_output_contract_v1` keep provider and
63
+ model selection paired with the output ceiling. Command target fields have the
64
+ highest precedence, followed by `AMASTER_PI_PROVIDER` / `AMASTER_PI_MODEL`, then
65
+ the Pi profile's `defaultProvider` / `defaultModel`. Each selected precedence
66
+ layer must be a complete provider/model pair: a partial command or runtime
67
+ override fails closed instead of silently falling through to a lower-precedence
68
+ default. The daemon copies only the normalized default pair into the isolated
69
+ one-shot profile, validates that the resolved model exists, applies
70
+ `maxOutputTokens` to that exact model, and records the resolved target and source
71
+ in command-result diagnostics. Missing or unknown targets also fail closed
72
+ before Pi is spawned.
73
+
35
74
  ## Pi tool-argument transport guard
36
75
 
37
76
  `AMASTER_PI_TOOL_ARGUMENT_GUARD_MODE` defaults to `shadow`; supported values are
@@ -0,0 +1,85 @@
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
+ "managed_project_instructions_v1",
9
+ "artifact_template_catalog_v1",
10
+ "final_model_context_attestation_v1",
11
+ "runtime_actions_v2",
12
+ "continue_task_v1",
13
+ "run_exit_live_path_closure_v1",
14
+ "model_call",
15
+ "model_call_output_contract_v1",
16
+ "run_cancel",
17
+ "run_terminate",
18
+ "logs_cost_workspace_status",
19
+ "source_acquisition_v1",
20
+ "headed_browser_auth",
21
+ ]);
22
+
23
+ const DYNAMIC_READINESS = Object.freeze({
24
+ artifact_template_catalog_v1: {
25
+ reasonCode: "artifact_template_catalog_not_ready",
26
+ ready: (input) => {
27
+ const catalog = input.templateCatalog;
28
+ return catalog?.status === "ready"
29
+ && catalog.bundleAttested === true
30
+ && catalog.materialized === true
31
+ && catalog.readable === true
32
+ && catalog.executorReadable === true
33
+ && Number.isSafeInteger(catalog.fileCount)
34
+ && catalog.fileCount > 0
35
+ && typeof catalog.manifestSha256 === "string"
36
+ && /^[a-f0-9]{64}$/u.test(catalog.manifestSha256)
37
+ && typeof catalog.targetDir === "string"
38
+ && catalog.targetDir === input.runtimeTemplatesRoot;
39
+ },
40
+ },
41
+ final_model_context_attestation_v1: {
42
+ reasonCode: "managed_pi_executor_required",
43
+ ready: (input) => input.runnerKind === "cloud_managed"
44
+ && input.executors.some((executor) => executor.kind === "pi"),
45
+ },
46
+ source_acquisition_v1: {
47
+ reasonCode: "source_acquisition_not_ready",
48
+ ready: (input) => input.sourceAcquisition?.ready === true,
49
+ },
50
+ headed_browser_auth: {
51
+ reasonCode: "headed_browser_runtime_not_ready",
52
+ ready: (input) => input.browserSessionBroker?.ready === true,
53
+ },
54
+ });
55
+
56
+ function uniqueStrings(values) {
57
+ return Array.from(new Set((Array.isArray(values) ? values : [])
58
+ .map((value) => String(value ?? "").trim())
59
+ .filter(Boolean)));
60
+ }
61
+
62
+ export function buildRuntimeCapabilityReport(input) {
63
+ const legacyConfiguredCapabilities = uniqueStrings(input.legacyConfiguredCapabilities);
64
+ const runtimeUnavailable = [];
65
+ const advertised = BUILD_SUPPORTED_CAPABILITIES.filter((capability) => {
66
+ const readiness = DYNAMIC_READINESS[capability];
67
+ if (!readiness || readiness.ready(input)) return true;
68
+ runtimeUnavailable.push({ capability, reasonCode: readiness.reasonCode });
69
+ return false;
70
+ });
71
+ const buildSet = new Set(BUILD_SUPPORTED_CAPABILITIES);
72
+ const legacySet = new Set(legacyConfiguredCapabilities);
73
+ return {
74
+ schemaVersion: "mirrorx.connector-capability-report/v1",
75
+ source: "build_attested",
76
+ buildSupported: [...BUILD_SUPPORTED_CAPABILITIES],
77
+ runtimeUnavailable,
78
+ advertised,
79
+ deprecatedCapabilityOverridePresent: legacyConfiguredCapabilities.length > 0,
80
+ legacyMissingFromBuildTruth: legacyConfiguredCapabilities.length > 0
81
+ ? BUILD_SUPPORTED_CAPABILITIES.filter((capability) => !legacySet.has(capability))
82
+ : [],
83
+ legacyUnsupportedClaims: legacyConfiguredCapabilities.filter((capability) => !buildSet.has(capability)),
84
+ };
85
+ }