@amaster.ai/employee-runtime-connector 0.1.1-beta.293 → 0.1.1-beta.295

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.
@@ -9141,8 +9141,27 @@ var goalCriterionProgressReadModelSchema = external_exports.object({
9141
9141
  expectedDecisionToken: sha256Schema5.nullable(),
9142
9142
  snoozedUntil: external_exports.string().datetime().nullable()
9143
9143
  }).strict();
9144
+ var goalCompletionSummaryBaseSchema = external_exports.object({
9145
+ basis: external_exports.literal("acceptance_criteria"),
9146
+ satisfiedCount: external_exports.number().int().nonnegative(),
9147
+ applicableCount: external_exports.number().int().nonnegative()
9148
+ });
9149
+ var goalCompletionSummarySchema = external_exports.discriminatedUnion("state", [
9150
+ goalCompletionSummaryBaseSchema.extend({
9151
+ state: external_exports.literal("ready"),
9152
+ applicableCount: external_exports.number().int().positive(),
9153
+ percent: external_exports.number().int().min(0).max(100),
9154
+ authorityRevision: external_exports.number().int().positive()
9155
+ }).strict(),
9156
+ goalCompletionSummaryBaseSchema.extend({
9157
+ state: external_exports.literal("unavailable"),
9158
+ percent: external_exports.null(),
9159
+ authorityRevision: external_exports.number().int().positive().nullable()
9160
+ }).strict()
9161
+ ]);
9144
9162
  var goalCriteriaProgressReadModelSchema = external_exports.object({
9145
- items: external_exports.array(goalCriterionProgressReadModelSchema)
9163
+ items: external_exports.array(goalCriterionProgressReadModelSchema),
9164
+ completion: goalCompletionSummarySchema
9146
9165
  }).strict();
9147
9166
  var DEFAULT_CONTINUE_PROGRESS_RATIONALE = "Board \u786E\u8BA4\u5F53\u524D\u4E1A\u52A1\u7ED3\u679C\u5C1A\u672A\u8FBE\u5230\uFF0C\u7EE7\u7EED\u63A8\u8FDB\u3002";
9148
9167
  var DEFAULT_KEEP_IN_GOAL_RATIONALE = "\u516C\u53F8\u8D1F\u8D23\u4EBA\u786E\u8BA4\u8FD9\u6761\u8FBE\u6210\u6807\u51C6\u4ECD\u9002\u7528\u4E8E\u5F53\u524D\u76EE\u6807\u3002";
@@ -12949,6 +12968,21 @@ var boardReactivateBusinessDemandAutomationRuleSchema = external_exports.object(
12949
12968
  rationale: external_exports.string().trim().min(1).max(2e3)
12950
12969
  }).strict();
12951
12970
 
12971
+ // ../shared/src/goal-action-semantics.ts
12972
+ var GOAL_ACTION_INTERACTION_PURPOSE_CODES = [
12973
+ "goal_gap_authority_exception",
12974
+ "goal_gap_observed_effect",
12975
+ "goal_gap_fact_correction",
12976
+ "goal_gap_legacy_outcome_attribution",
12977
+ "goal_gap_work_purpose_catalog_candidate"
12978
+ ];
12979
+ var GOAL_ACTION_KINDS = [
12980
+ "criterion_decision",
12981
+ "legacy_outcome_attribution",
12982
+ "business_demand_decision"
12983
+ ];
12984
+ var PURPOSE_CODES = new Set(GOAL_ACTION_INTERACTION_PURPOSE_CODES);
12985
+
12952
12986
  // ../shared/src/types/governed-mcp.ts
12953
12987
  var GOVERNED_MCP_GATEWAY_ROUTE_PATH = "/tool-gateway/mcp";
12954
12988
  var GOVERNED_MCP_GATEWAY_API_PATH = `/api${GOVERNED_MCP_GATEWAY_ROUTE_PATH}`;
@@ -13599,7 +13633,7 @@ var mirrorXIssueHandlingListResponseSchema = external_exports.object({
13599
13633
  }).strict();
13600
13634
 
13601
13635
  // ../shared/src/types/inbox-action-items.ts
13602
- var INBOX_ACTION_ITEMS_SCHEMA_VERSION = "mirrorx_inbox_action_items/v1";
13636
+ var INBOX_ACTION_ITEMS_SCHEMA_VERSION = "mirrorx_inbox_action_items/v2";
13603
13637
  var INBOX_ACTION_ITEM_KINDS = [
13604
13638
  "issue",
13605
13639
  "approval",
@@ -13654,6 +13688,8 @@ var inboxActionItemSchema = external_exports.object({
13654
13688
  label: external_exports.string().min(1)
13655
13689
  }).strict(),
13656
13690
  resourceId: external_exports.string().min(1),
13691
+ attentionScope: external_exports.enum(["task", "goal", "company"]),
13692
+ goalActionKind: external_exports.enum(GOAL_ACTION_KINDS).nullable(),
13657
13693
  goalId: external_exports.string().uuid().nullable().optional(),
13658
13694
  issueId: external_exports.string().uuid().nullable(),
13659
13695
  issueIdentifier: external_exports.string().nullable(),
@@ -17764,20 +17800,22 @@ function isWithin(path, root) {
17764
17800
  function makePiRunPathWritable(path, uid, gid, fs = defaultFs) {
17765
17801
  const visit = (entryPath) => {
17766
17802
  const stat = fs.lstatSync(entryPath);
17803
+ const ownedByTarget = stat.uid === uid && stat.gid === gid;
17767
17804
  if (stat.isSymbolicLink()) {
17768
- fs.lchownSync(entryPath, uid, gid);
17805
+ if (!ownedByTarget) fs.lchownSync(entryPath, uid, gid);
17769
17806
  return;
17770
17807
  }
17771
17808
  if (stat.isDirectory()) {
17772
- fs.chmodSync(entryPath, 448);
17809
+ if ((stat.mode & 511) !== 448) fs.chmodSync(entryPath, 448);
17773
17810
  for (const entry of fs.readdirSync(entryPath)) {
17774
17811
  visit(resolve(entryPath, entry));
17775
17812
  }
17776
- fs.chownSync(entryPath, uid, gid);
17813
+ if (!ownedByTarget) fs.chownSync(entryPath, uid, gid);
17777
17814
  return;
17778
17815
  }
17779
- fs.chmodSync(entryPath, 384 | stat.mode & 73);
17780
- fs.chownSync(entryPath, uid, gid);
17816
+ const desiredMode = 384 | stat.mode & 73;
17817
+ if ((stat.mode & 511) !== desiredMode) fs.chmodSync(entryPath, desiredMode);
17818
+ if (!ownedByTarget) fs.chownSync(entryPath, uid, gid);
17781
17819
  };
17782
17820
  visit(resolve(path));
17783
17821
  }
@@ -34342,7 +34380,7 @@ function assertRequiredTaskAttachmentMaterialized(input, materialized) {
34342
34380
  }
34343
34381
 
34344
34382
  // src/amaster-runtime-daemon.mjs
34345
- var CONNECTOR_VERSION = "0.1.1-beta.293";
34383
+ var CONNECTOR_VERSION = "0.1.1-beta.295";
34346
34384
  var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
34347
34385
  var daemonRequire = createRequire(import.meta.url);
34348
34386
  var MAX_CHECKPOINT_BYTES = 20 * 1024 * 1024;
@@ -35027,6 +35065,21 @@ function buildHeartbeatPayload(config, options = {}) {
35027
35065
  function desktopDelegatedRunnerEnabled(config) {
35028
35066
  return config.runnerKind === RUNNER_KIND_DESKTOP_DELEGATED;
35029
35067
  }
35068
+ function piIsolatedChildOwnership(config) {
35069
+ const uid = Number(config.piExecutorUid ?? 0);
35070
+ const gid = Number(config.piExecutorGid ?? uid);
35071
+ if (!Number.isSafeInteger(uid) || uid <= 0 || !Number.isSafeInteger(gid) || gid <= 0) return null;
35072
+ if (desktopDelegatedRunnerEnabled(config)) return null;
35073
+ if (typeof process.getuid !== "function" || process.getuid() !== 0) return null;
35074
+ return { uid, gid };
35075
+ }
35076
+ function handoffPiRunPathsToChild(config, paths) {
35077
+ const ownership = piIsolatedChildOwnership(config);
35078
+ if (!ownership) return;
35079
+ for (const path of paths) {
35080
+ if (typeof path === "string" && path) makePiRunPathWritable(path, ownership.uid, ownership.gid);
35081
+ }
35082
+ }
35030
35083
  function writeLocalRuntimeStatus(config, runtimeStatus) {
35031
35084
  const currentState = readState(process.env);
35032
35085
  writeState(process.env, {
@@ -35734,6 +35787,10 @@ async function syncPiExecutorProviderConfig(config, command, agentDir, providerC
35734
35787
  if (!agentDir) return;
35735
35788
  const { modelsSynced, settingsSynced } = syncAmasterProviderFiles(agentDir, providerConfig);
35736
35789
  if (modelsSynced || settingsSynced) {
35790
+ handoffPiRunPathsToChild(config, [
35791
+ modelsSynced ? join19(agentDir, "models.json") : null,
35792
+ settingsSynced ? join19(agentDir, "settings.json") : null
35793
+ ]);
35737
35794
  await ingestLog(config, command, "system", "info", "Synced AMaster provider config for pi executor", {
35738
35795
  modelsSynced,
35739
35796
  settingsSynced,
@@ -39199,6 +39256,10 @@ async function executeRunCommand(config, command) {
39199
39256
  let completionOwnsManagedMcpProfile = false;
39200
39257
  const trustedPiRuntimeAssertion = commandTrustedPiRuntimeAssertion(command);
39201
39258
  const preparationStages = [];
39259
+ let preparationLogChain = Promise.resolve();
39260
+ const enqueuePreparationLog = (stream, level, message, payload = {}) => {
39261
+ preparationLogChain = preparationLogChain.then(() => ingestLog(config, command, stream, level, message, payload)).catch(() => void 0);
39262
+ };
39202
39263
  const runExecutionStage = (phase, operation) => {
39203
39264
  const startedAtMs = Date.now();
39204
39265
  const recordDuration = () => preparationStages.push({
@@ -39375,7 +39436,7 @@ async function executeRunCommand(config, command) {
39375
39436
  if (executor.kind === "pi") {
39376
39437
  assertManagedPiNonInteractiveInvocation(invocation.args, managedMcpProfile);
39377
39438
  }
39378
- await ingestLog(config, command, "system", "info", desktopDelegatedRunnerEnabled(config) && executor.kind === "pi" ? "Prepared desktop delegated Pi runtime action bridge" : executor.kind === "pi" ? "Prepared isolated Pi managed MCP profile" : `Attested isolated ${executor.kind} managed MCP profile`, {
39439
+ enqueuePreparationLog("system", "info", desktopDelegatedRunnerEnabled(config) && executor.kind === "pi" ? "Prepared desktop delegated Pi runtime action bridge" : executor.kind === "pi" ? "Prepared isolated Pi managed MCP profile" : `Attested isolated ${executor.kind} managed MCP profile`, {
39379
39440
  presentationKind: "managed_mcp_attestation",
39380
39441
  ...managedMcpProfile.attestation
39381
39442
  });
@@ -39500,6 +39561,7 @@ async function executeRunCommand(config, command) {
39500
39561
  mkdirSync10(promptDir, { recursive: true, mode: 448 });
39501
39562
  const promptPath = join19(promptDir, "conversation-system.md");
39502
39563
  writeFileSync12(promptPath, appendedSystemPrompt, { encoding: "utf8", mode: 384, flag: "wx" });
39564
+ handoffPiRunPathsToChild(config, [promptDir, promptPath]);
39503
39565
  const printIndex = invocation.args.lastIndexOf("-p");
39504
39566
  invocation.args.splice(printIndex < 0 ? invocation.args.length : printIndex, 0, "--append-system-prompt", promptPath);
39505
39567
  }
@@ -39518,24 +39580,18 @@ async function executeRunCommand(config, command) {
39518
39580
  cwd,
39519
39581
  expectedSha256: finalAgentInstructionFiles.get("AGENTS.md")?.sha256
39520
39582
  });
39521
- if (config.piExecutorUid > 0 && !desktopDelegatedRunnerEnabled(config)) {
39522
- piExecutorIdentity = await runExecutionStage("context_attestation", () => preparePiExecutorAccess({
39523
- uid: config.piExecutorUid,
39524
- gid: config.piExecutorGid,
39525
- effectiveUid: typeof process.getuid === "function" ? process.getuid() : null,
39526
- profileRoot: managedMcpProfile.profileRoot,
39527
- workspaceRoot: cwd,
39528
- allowedRoot: config.runtimeWorkspacesRoot
39529
- }));
39530
- }
39583
+ handoffPiRunPathsToChild(config, [
39584
+ ...finalContextExtensions,
39585
+ readString(asRecord(managedMcpProfile.runExitFinalContextAttestation).extensionPath)
39586
+ ]);
39531
39587
  }
39532
39588
  const promptBudgetSummary = contextManifest.budget.totalChars === null ? `${contextManifest.budget.usedChars} characters (unbounded)` : `${contextManifest.budget.usedChars}/${contextManifest.budget.totalChars} characters`;
39533
- await ingestLog(config, command, "system", "info", `Compiled ${contextManifest.mode} prompt using ${promptBudgetSummary}`, {
39589
+ enqueuePreparationLog("system", "info", `Compiled ${contextManifest.mode} prompt using ${promptBudgetSummary}`, {
39534
39590
  presentationKind: "context_manifest",
39535
39591
  contextManifest
39536
39592
  });
39537
39593
  if (contextManifest.continuationPromptContract) {
39538
- await ingestLog(config, command, "system", "info", "Compiled Runtime Action continuation prompt contract", {
39594
+ enqueuePreparationLog("system", "info", "Compiled Runtime Action continuation prompt contract", {
39539
39595
  presentationKind: "runtime_action_continuation_prompt_contract",
39540
39596
  metricName: "mirrorx_runtime_continuation_prompt_generated_total",
39541
39597
  metricValue: 1,
@@ -39544,19 +39600,21 @@ async function executeRunCommand(config, command) {
39544
39600
  });
39545
39601
  }
39546
39602
  if (contextManifest.currentRunContractShadow.status !== "match") {
39547
- await ingestLog(config, command, "system", "warn", "Current Run Contract shadow comparison did not match the legacy runtime inference", {
39603
+ enqueuePreparationLog("system", "warn", "Current Run Contract shadow comparison did not match the legacy runtime inference", {
39548
39604
  presentationKind: "current_run_contract_shadow_audit",
39549
39605
  currentRunContractShadow: contextManifest.currentRunContractShadow
39550
39606
  });
39551
39607
  }
39608
+ await preparationLogChain;
39552
39609
  await ackCommand(config, command, "spawned");
39553
- await ingestLog(config, command, "system", "info", `Starting ${executor.kind} executor`, {
39610
+ enqueuePreparationLog("system", "info", `Starting ${executor.kind} executor`, {
39554
39611
  executorKind: executor.kind,
39555
39612
  cwd,
39556
39613
  args: invocation.args,
39557
39614
  preparationElapsedMs: Math.max(0, Date.now() - preparationStartedAtMs),
39558
39615
  preparationStages
39559
39616
  });
39617
+ await preparationLogChain;
39560
39618
  forgetActiveRunCommand = rememberActiveRunCommand(command, {
39561
39619
  executorKind: executor.kind,
39562
39620
  workspacePath: cwd,
@@ -40214,6 +40272,7 @@ async function executeRunCommand(config, command) {
40214
40272
  }
40215
40273
  return { resultDelivered: Boolean(completion) };
40216
40274
  } finally {
40275
+ await preparationLogChain;
40217
40276
  if (managedMcpProfile && !managedMcpCleanup && !completionOwnsManagedMcpProfile) {
40218
40277
  managedMcpCleanup = cleanupManagedMcpProfile(managedMcpProfile, {
40219
40278
  commandId: command.commandId,
@@ -7,7 +7,7 @@ import { homedir, hostname } from "node:os";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import { BUILD_SUPPORTED_CAPABILITIES } from "./amaster-runtime-daemon/capability-registry.mjs";
9
9
 
10
- const CONNECTOR_VERSION = "0.1.1-beta.293";
10
+ const CONNECTOR_VERSION = "0.1.1-beta.295";
11
11
 
12
12
  const CONFIG_KEY_MAP = new Map([
13
13
  ["server_url", "AMASTER_EMPLOYEE_SERVER_URL"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amaster.ai/employee-runtime-connector",
3
- "version": "0.1.1-beta.293",
3
+ "version": "0.1.1-beta.295",
4
4
  "description": "MirrorX runtime connector CLI and daemon",
5
5
  "license": "MIT",
6
6
  "type": "module",