@amaster.ai/employee-runtime-connector 0.1.1-beta.132 → 0.1.1-beta.133

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.
@@ -5231,6 +5231,165 @@ var amasterRuntimeConnectorWorkspaceStatusIngestSchema = external_exports.object
5231
5231
  metadata: external_exports.record(external_exports.unknown()).default({})
5232
5232
  });
5233
5233
 
5234
+ // ../shared/src/issue-live-path.ts
5235
+ var ISSUE_LIVE_PATH_KINDS = [
5236
+ "execution",
5237
+ "continuation",
5238
+ "scheduled_monitor",
5239
+ "external_wait",
5240
+ "pending_interaction",
5241
+ "pending_approval",
5242
+ "dependency_wait",
5243
+ "recovery"
5244
+ ];
5245
+ var ISSUE_LIVE_PATH_STATES = ["current", "superseded", "released"];
5246
+ var issueLivePathKindSchema = external_exports.enum(ISSUE_LIVE_PATH_KINDS);
5247
+ var issueLivePathStateSchema = external_exports.enum(ISSUE_LIVE_PATH_STATES);
5248
+ var issueLivePathOwnerRefSchema = external_exports.discriminatedUnion("kind", [
5249
+ external_exports.object({ kind: external_exports.literal("run"), id: external_exports.string().uuid() }).strict(),
5250
+ external_exports.object({ kind: external_exports.literal("runtime_command"), id: external_exports.string().uuid() }).strict(),
5251
+ external_exports.object({ kind: external_exports.literal("wakeup_request"), id: external_exports.string().uuid() }).strict(),
5252
+ external_exports.object({ kind: external_exports.literal("continuation_intent"), id: external_exports.string().uuid() }).strict(),
5253
+ external_exports.object({ kind: external_exports.literal("monitor"), id: external_exports.string().uuid() }).strict(),
5254
+ external_exports.object({ kind: external_exports.literal("external_wait"), id: external_exports.string().min(1) }).strict(),
5255
+ external_exports.object({ kind: external_exports.literal("interaction"), id: external_exports.string().uuid() }).strict(),
5256
+ external_exports.object({ kind: external_exports.literal("approval"), id: external_exports.string().uuid() }).strict(),
5257
+ external_exports.object({ kind: external_exports.literal("dependency"), id: external_exports.string().uuid() }).strict(),
5258
+ external_exports.object({ kind: external_exports.literal("recovery_action"), id: external_exports.string().uuid() }).strict()
5259
+ ]);
5260
+ var OWNER_KINDS_BY_PATH = {
5261
+ execution: ["run", "runtime_command", "wakeup_request"],
5262
+ continuation: ["continuation_intent"],
5263
+ scheduled_monitor: ["monitor"],
5264
+ external_wait: ["external_wait"],
5265
+ pending_interaction: ["interaction"],
5266
+ pending_approval: ["approval"],
5267
+ dependency_wait: ["dependency"],
5268
+ recovery: ["recovery_action"]
5269
+ };
5270
+ var issueLivePathTransitionInputSchema = external_exports.object({
5271
+ companyId: external_exports.string().uuid(),
5272
+ issueId: external_exports.string().uuid(),
5273
+ executionEpoch: external_exports.number().int().positive(),
5274
+ toKind: issueLivePathKindSchema,
5275
+ ownerRef: issueLivePathOwnerRefSchema,
5276
+ expectedAuthorityRevision: external_exports.number().int().nonnegative(),
5277
+ idempotencyIdentity: external_exports.string().min(1).max(512),
5278
+ requestHash: external_exports.string().regex(/^sha256:[a-f0-9]{64}$/)
5279
+ }).strict().superRefine((input, context) => {
5280
+ const allowedOwnerKinds = OWNER_KINDS_BY_PATH[input.toKind];
5281
+ if (!allowedOwnerKinds.includes(input.ownerRef.kind)) {
5282
+ context.addIssue({
5283
+ code: external_exports.ZodIssueCode.custom,
5284
+ path: ["ownerRef", "kind"],
5285
+ message: `${input.ownerRef.kind} cannot own ${input.toKind}`
5286
+ });
5287
+ }
5288
+ });
5289
+ var issueLivePathClaimSchema = external_exports.object({
5290
+ id: external_exports.string().uuid(),
5291
+ companyId: external_exports.string().uuid(),
5292
+ issueId: external_exports.string().uuid(),
5293
+ executionEpoch: external_exports.number().int().positive(),
5294
+ state: issueLivePathStateSchema,
5295
+ kind: issueLivePathKindSchema,
5296
+ ownerRef: issueLivePathOwnerRefSchema,
5297
+ authorityRevision: external_exports.number().int().positive(),
5298
+ idempotencyIdentity: external_exports.string().min(1),
5299
+ requestHash: external_exports.string().regex(/^sha256:[a-f0-9]{64}$/),
5300
+ committedAt: external_exports.string().datetime({ offset: true }),
5301
+ supersededAt: external_exports.string().datetime({ offset: true }).nullable(),
5302
+ releasedAt: external_exports.string().datetime({ offset: true }).nullable()
5303
+ }).strict();
5304
+ var issueLivePathReleaseInputSchema = external_exports.object({
5305
+ companyId: external_exports.string().uuid(),
5306
+ issueId: external_exports.string().uuid(),
5307
+ executionEpoch: external_exports.number().int().positive(),
5308
+ expectedAuthorityRevision: external_exports.number().int().positive(),
5309
+ idempotencyIdentity: external_exports.string().min(1).max(512),
5310
+ requestHash: external_exports.string().regex(/^sha256:[a-f0-9]{64}$/),
5311
+ terminalReceipt: external_exports.record(external_exports.unknown())
5312
+ }).strict();
5313
+
5314
+ // ../shared/src/company-cold-start.ts
5315
+ var COMPANY_COLD_START_PHASES = [
5316
+ "not_started",
5317
+ "awaiting_strategy_confirmation",
5318
+ "preparing_workset",
5319
+ "executing_workset",
5320
+ "evaluating_admission",
5321
+ "admitted",
5322
+ "interrupted"
5323
+ ];
5324
+ var COMPANY_STAGES = [
5325
+ "initialization",
5326
+ "strategy_confirmation",
5327
+ "cold_start",
5328
+ "operating",
5329
+ "needs_attention"
5330
+ ];
5331
+ var COLD_START_STAGES = [
5332
+ "awaiting_strategy_confirmation",
5333
+ "running",
5334
+ "admitted",
5335
+ "interrupted"
5336
+ ];
5337
+ var COMPANY_COLD_START_ACTIONS = [
5338
+ "complete_initialization",
5339
+ "review_strategy",
5340
+ "submit_cold_start_workset",
5341
+ "advance_cold_start_tasks",
5342
+ "evaluate_operating_admission",
5343
+ "operate",
5344
+ "repair_cold_start_invariant"
5345
+ ];
5346
+ var COMPANY_COLD_START_FACT_SLOTS = [
5347
+ "goal_metric_baseline",
5348
+ "customer_problem_evidence",
5349
+ "offer_delivery_baseline",
5350
+ "operating_risk_baseline",
5351
+ "near_term_priority_ownership",
5352
+ "reusable_company_artifact"
5353
+ ];
5354
+ var companyColdStartPhaseSchema = external_exports.enum(COMPANY_COLD_START_PHASES);
5355
+ var companyStageSchema = external_exports.enum(COMPANY_STAGES);
5356
+ var coldStartStageSchema = external_exports.enum(COLD_START_STAGES);
5357
+ var coldStartExpectedActionSchema = external_exports.enum(COMPANY_COLD_START_ACTIONS);
5358
+ var companyColdStartFactSlotSchema = external_exports.enum(COMPANY_COLD_START_FACT_SLOTS);
5359
+ var companyColdStartWorksetItemDispositionSchema = external_exports.enum([
5360
+ "pending",
5361
+ "accepted_outcome",
5362
+ "external_wait",
5363
+ "scheduled_monitor",
5364
+ "deferred_operating_dependency",
5365
+ "cancelled"
5366
+ ]);
5367
+ var companyColdStartWorksetItemReadSchema = external_exports.object({
5368
+ id: external_exports.string().uuid(),
5369
+ issueId: external_exports.string().uuid(),
5370
+ enrollmentId: external_exports.string().uuid(),
5371
+ priorityOrder: external_exports.number().int().positive(),
5372
+ factSlots: external_exports.array(companyColdStartFactSlotSchema).min(1),
5373
+ disposition: companyColdStartWorksetItemDispositionSchema,
5374
+ dispositionReceiptId: external_exports.string().min(1).max(512).nullable()
5375
+ }).strict();
5376
+ var companyColdStartWorksetReadSchema = external_exports.object({
5377
+ id: external_exports.string().uuid(),
5378
+ companyId: external_exports.string().uuid(),
5379
+ strategyRevisionId: external_exports.string().uuid(),
5380
+ goalId: external_exports.string().uuid(),
5381
+ organizationVersion: external_exports.number().int().nonnegative(),
5382
+ authorityRevision: external_exports.number().int().positive(),
5383
+ priorityIssueId: external_exports.string().uuid(),
5384
+ items: external_exports.array(companyColdStartWorksetItemReadSchema).min(1)
5385
+ }).strict();
5386
+ var companyColdStartAdmissionReadSchema = external_exports.object({
5387
+ admitted: external_exports.boolean(),
5388
+ receiptId: external_exports.string().uuid().nullable(),
5389
+ missingFactSlots: external_exports.array(companyColdStartFactSlotSchema),
5390
+ blockingItemIds: external_exports.array(external_exports.string().uuid())
5391
+ }).strict();
5392
+
5234
5393
  // ../shared/src/amaster-runtime-command-outcome.ts
5235
5394
  var AMASTER_RUNTIME_EXPECTED_DISPOSITION_VERSION = "mirrorx.expected-run-disposition/v1";
5236
5395
  var AMASTER_RUNTIME_ORGANIZATION_MUTATION_AUTHORIZATION_PURPOSE = "runtime_action_authorization";
@@ -11712,7 +11871,8 @@ var GOVERNED_BUSINESS_TASK_ORIGIN_KINDS = [
11712
11871
  "first_business_activation",
11713
11872
  "ceo_periodic_discovery",
11714
11873
  "operator_business_task",
11715
- "company_strategy_first_wave"
11874
+ "company_strategy_first_wave",
11875
+ "company_strategy_cold_start"
11716
11876
  ];
11717
11877
  var BUSINESS_TASK_ENROLLMENT_READ_STATES = [
11718
11878
  "governed",
@@ -11784,6 +11944,18 @@ var governedBusinessTaskLineageSchema = external_exports.discriminatedUnion("kin
11784
11944
  priorityOrder: external_exports.number().int().min(1).max(10),
11785
11945
  dependencyItemClientKey: stableIdentitySchema2.nullable()
11786
11946
  }).strict(),
11947
+ external_exports.object({
11948
+ kind: external_exports.literal("company_strategy_cold_start"),
11949
+ worksetId: external_exports.string().uuid(),
11950
+ initializationId: external_exports.string().uuid(),
11951
+ strategyIssueId: external_exports.string().uuid(),
11952
+ goalId: external_exports.string().uuid(),
11953
+ strategyDocumentRevisionId: external_exports.string().uuid(),
11954
+ organizationVersion: external_exports.number().int().nonnegative(),
11955
+ candidateRef: stableIdentitySchema2,
11956
+ priorityOrder: external_exports.number().int().min(1).max(100),
11957
+ dependencyCandidateRef: stableIdentitySchema2.nullable()
11958
+ }).strict(),
11787
11959
  external_exports.object({
11788
11960
  kind: external_exports.literal("ceo_periodic_discovery"),
11789
11961
  observationId: external_exports.string().uuid(),
@@ -19177,6 +19349,34 @@ function createManagedPiMcpProfileApi(options = {}) {
19177
19349
  const mode = statSync2(filePath).mode & 511;
19178
19350
  if (mode !== 384) throw new Error(`pi_managed_mcp_permissions_failed: ${filePath} mode=${mode.toString(8)}`);
19179
19351
  }
19352
+ function resolveSourceAcquisitionExtension(sharedPiHome, sourceAcquisition) {
19353
+ const expectedDigest = sourceAcquisition?.profile?.connectorAdmission?.sourceExtensionDigest;
19354
+ if (typeof expectedDigest !== "string" || !/^[a-f0-9]{64}$/i.test(expectedDigest)) {
19355
+ throw new Error("source_acquisition_extension_profile_digest_invalid");
19356
+ }
19357
+ const extensionPath = join5(sharedPiHome, "extensions", "amaster-source-acquisition.js");
19358
+ let extensionStat;
19359
+ try {
19360
+ extensionStat = lstatSync3(extensionPath);
19361
+ } catch (error) {
19362
+ if (error?.code === "ENOENT") throw new Error("source_acquisition_extension_missing");
19363
+ throw new Error("source_acquisition_extension_unsafe");
19364
+ }
19365
+ if (!extensionStat.isFile() || extensionStat.isSymbolicLink()) {
19366
+ throw new Error("source_acquisition_extension_unsafe");
19367
+ }
19368
+ let extensionBytes;
19369
+ try {
19370
+ extensionBytes = readFileSync5(extensionPath);
19371
+ } catch (error) {
19372
+ if (error?.code === "ENOENT") throw new Error("source_acquisition_extension_missing");
19373
+ throw new Error("source_acquisition_extension_unsafe");
19374
+ }
19375
+ if (sha2563(extensionBytes) !== expectedDigest.toLowerCase()) {
19376
+ throw new Error("source_acquisition_extension_digest_mismatch");
19377
+ }
19378
+ return extensionBytes;
19379
+ }
19180
19380
  function copyPrivateFile(source, target) {
19181
19381
  if (!existsSync4(source)) return false;
19182
19382
  const sourceStat = lstatSync3(source);
@@ -20431,6 +20631,7 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
20431
20631
  extensionArgs.push("--extension", extensionPath);
20432
20632
  return extensionPath;
20433
20633
  };
20634
+ const sourceAcquisitionExtension = input.sourceAcquisition ? resolveSourceAcquisitionExtension(sharedRuntime.home, input.sourceAcquisition) : null;
20434
20635
  if (directCatalog) {
20435
20636
  const adapterExtensionPath = join5(
20436
20637
  sharedRuntime.home,
@@ -20448,11 +20649,15 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
20448
20649
  }
20449
20650
  extensionArgs.push("--extension", adapterExtensionPath);
20450
20651
  }
20652
+ if (sourceAcquisitionExtension) {
20653
+ writeProfileExtension("amaster-source-acquisition.js", sourceAcquisitionExtension);
20654
+ }
20451
20655
  if (mcpToolMode !== MANAGED_PI_DIRECT_TYPED_MCP_TOOL_MODE) {
20452
20656
  writeProfileExtension(MANAGED_PI_MCP_ARGS_NORMALIZER_FILENAME, managedPiMcpArgsNormalizerExtensionSource());
20453
20657
  }
20454
20658
  const cachePath = join5(profileRoot, "mcp-cache.json");
20455
20659
  let directAttestationInput = null;
20660
+ let effectiveToolsAttestorExtensionPath = null;
20456
20661
  const sourceExecutionIdentity = input.sourceAcquisition && typeof input.sourceAcquisition.profile?.attemptId === "string" && Number.isSafeInteger(input.sourceAcquisition.profile?.epoch) ? {
20457
20662
  commandId: input.commandId,
20458
20663
  attemptId: input.sourceAcquisition.profile.attemptId,
@@ -20469,7 +20674,7 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
20469
20674
  }
20470
20675
  const adapterVersion = piMcpAdapterVersion(sharedRuntime.home);
20471
20676
  if (directCatalog) {
20472
- writeProfileExtension(
20677
+ effectiveToolsAttestorExtensionPath = writeProfileExtension(
20473
20678
  MANAGED_PI_EFFECTIVE_TOOLS_ATTESTOR_FILENAME,
20474
20679
  managedPiEffectiveToolsAttestorExtensionSource()
20475
20680
  );
@@ -20617,6 +20822,14 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
20617
20822
  enabledRoleSkillMetadataBytes = roleSkills.serializedMetadataBytes;
20618
20823
  enabledRoleSkillMetadataSha256 = roleSkills.serializedMetadataSha256;
20619
20824
  }
20825
+ if (input.sourceAcquisition && effectiveToolsAttestorExtensionPath) {
20826
+ const attestorPathIndex = extensionArgs.indexOf(effectiveToolsAttestorExtensionPath);
20827
+ if (attestorPathIndex < 1 || extensionArgs[attestorPathIndex - 1] !== "--extension") {
20828
+ throw new Error("pi_managed_mcp_attestor_extension_order_invalid");
20829
+ }
20830
+ extensionArgs.splice(attestorPathIndex - 1, 2);
20831
+ extensionArgs.push("--extension", effectiveToolsAttestorExtensionPath);
20832
+ }
20620
20833
  const env = {
20621
20834
  ...sharedRuntime.settingsEnv,
20622
20835
  ...buildIsolatedEnvironment2(input.baseEnv, input.commandEnv),
@@ -21382,6 +21595,21 @@ function signalExecutorProcess(child, signal, processGroupId = processGroupIdFor
21382
21595
  return false;
21383
21596
  }
21384
21597
 
21598
+ // src/amaster-runtime-daemon/executor-stdin.mjs
21599
+ var BENIGN_EMPTY_STDIN_CLOSE_ERROR_CODES = /* @__PURE__ */ new Set([
21600
+ "EPIPE",
21601
+ "ERR_STREAM_DESTROYED"
21602
+ ]);
21603
+ function closeExecutorStdin(stdin, input, onDeliveryError) {
21604
+ const hasInput = Boolean(input);
21605
+ stdin.once("error", (error) => {
21606
+ if (!hasInput && BENIGN_EMPTY_STDIN_CLOSE_ERROR_CODES.has(error?.code)) return;
21607
+ onDeliveryError(error);
21608
+ });
21609
+ if (hasInput) stdin.end(input);
21610
+ else stdin.end();
21611
+ }
21612
+
21385
21613
  // src/amaster-runtime-daemon/durability.mjs
21386
21614
  function resultOutboxFileName(commandId, now = Date.now()) {
21387
21615
  const safeCommandId = String(commandId ?? "command").replace(/[^a-zA-Z0-9._-]/g, "_");
@@ -28761,7 +28989,7 @@ function createSourceCompletionStopPolicy({
28761
28989
  }
28762
28990
 
28763
28991
  // src/amaster-runtime-daemon.mjs
28764
- var CONNECTOR_VERSION = "0.1.1-beta.132";
28992
+ var CONNECTOR_VERSION = "0.1.1-beta.133";
28765
28993
  var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
28766
28994
  var SOURCE_ACQUISITION_CAPABILITY2 = source_acquisition_compatibility_default.profileVersion;
28767
28995
  var daemonRequire = createRequire(import.meta.url);
@@ -31810,8 +32038,12 @@ function runExecutor(command, args, options) {
31810
32038
  closeSignal = signal;
31811
32039
  maybeFinishQuiescent();
31812
32040
  });
31813
- if (options.stdin) child.stdin.end(options.stdin);
31814
- else child.stdin.end();
32041
+ closeExecutorStdin(child.stdin, options.stdin, (error) => {
32042
+ if (settled) return;
32043
+ spawnError = `executor_stdin_delivery_failed: ${error.message}`;
32044
+ spawnErrorCode = sourceAcquisitionSpawnErrno(error.code);
32045
+ requestStop("executor_stdin_delivery_failed");
32046
+ });
31815
32047
  });
31816
32048
  }
31817
32049
  async function ingestLog(config, command, stream, level, message, payload = {}) {
@@ -33952,9 +34184,6 @@ async function executeRunCommand(config, command) {
33952
34184
  if (executor.kind === "pi" && managedMcpProfile.toolAllowlist && !sourceAcquisition) {
33953
34185
  invocation.args = applyManagedPiToolAllowlist(invocation.args, managedMcpProfile);
33954
34186
  }
33955
- if (executor.kind === "pi" && Array.isArray(managedMcpProfile.extensionArgs) && managedMcpProfile.extensionArgs.length > 0) {
33956
- invocation.args = [...invocation.args, ...managedMcpProfile.extensionArgs];
33957
- }
33958
34187
  if (executor.kind === "pi") {
33959
34188
  invocation.args = [
33960
34189
  ...invocation.args,
@@ -33964,6 +34193,9 @@ async function executeRunCommand(config, command) {
33964
34193
  "--no-approve"
33965
34194
  ];
33966
34195
  }
34196
+ if (executor.kind === "pi" && Array.isArray(managedMcpProfile.extensionArgs) && managedMcpProfile.extensionArgs.length > 0) {
34197
+ invocation.args = [...invocation.args, ...managedMcpProfile.extensionArgs];
34198
+ }
33967
34199
  await ingestLog(config, command, "system", "info", desktopDelegatedRunnerEnabled(config) && executor.kind === "pi" ? "Prepared desktop delegated Pi runtime action bridge" : `Attested isolated ${executor.kind} managed MCP profile`, {
33968
34200
  presentationKind: "managed_mcp_attestation",
33969
34201
  ...managedMcpProfile.attestation
@@ -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.132";
10
+ const CONNECTOR_VERSION = "0.1.1-beta.133";
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.132",
3
+ "version": "0.1.1-beta.133",
4
4
  "description": "MirrorX runtime connector CLI and daemon",
5
5
  "license": "MIT",
6
6
  "type": "module",