@amaster.ai/employee-runtime-connector 0.1.1-beta.152 → 0.1.1-beta.154

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.
@@ -5397,7 +5397,7 @@ var COMPANY_COLD_START_ACTIONS = [
5397
5397
  "operate",
5398
5398
  "repair_cold_start_invariant"
5399
5399
  ];
5400
- var COMPANY_COLD_START_FACT_SLOTS = [
5400
+ var COMPANY_COLD_START_REQUIRED_FACT_SLOTS_COMPAT = [
5401
5401
  "goal_metric_baseline",
5402
5402
  "customer_problem_evidence",
5403
5403
  "offer_delivery_baseline",
@@ -5405,15 +5405,31 @@ var COMPANY_COLD_START_FACT_SLOTS = [
5405
5405
  "near_term_priority_ownership",
5406
5406
  "reusable_company_artifact"
5407
5407
  ];
5408
+ var COMPANY_COLD_START_REQUIRED_FACT_SLOTS_CURRENT = [
5409
+ ...COMPANY_COLD_START_REQUIRED_FACT_SLOTS_COMPAT,
5410
+ "internal_system_landscape"
5411
+ ];
5412
+ var COMPANY_COLD_START_FACT_SLOTS = COMPANY_COLD_START_REQUIRED_FACT_SLOTS_CURRENT;
5408
5413
  var companyColdStartPhaseSchema = external_exports.enum(COMPANY_COLD_START_PHASES);
5409
5414
  var companyStageSchema = external_exports.enum(COMPANY_STAGES);
5410
5415
  var coldStartStageSchema = external_exports.enum(COLD_START_STAGES);
5411
5416
  var coldStartExpectedActionSchema = external_exports.enum(COMPANY_COLD_START_ACTIONS);
5412
5417
  var companyColdStartFactSlotSchema = external_exports.enum(COMPANY_COLD_START_FACT_SLOTS);
5413
- var companyColdStartFactSlotsSchema = external_exports.array(companyColdStartFactSlotSchema).min(1).max(COMPANY_COLD_START_FACT_SLOTS.length).transform((slots) => {
5418
+ var companyColdStartFactSlotsSchema = external_exports.array(companyColdStartFactSlotSchema).min(1).max(6).transform((slots) => {
5414
5419
  const selected = new Set(slots);
5415
5420
  return COMPANY_COLD_START_FACT_SLOTS.filter((slot) => selected.has(slot));
5416
5421
  });
5422
+ function isExactFactSlotSnapshot(actual, expected) {
5423
+ return actual.length === expected.length && actual.every((slot, index) => slot === expected[index]);
5424
+ }
5425
+ var companyColdStartRequiredFactSlotsSchema = external_exports.array(companyColdStartFactSlotSchema).superRefine((slots, context) => {
5426
+ if (!isExactFactSlotSnapshot(slots, COMPANY_COLD_START_REQUIRED_FACT_SLOTS_COMPAT) && !isExactFactSlotSnapshot(slots, COMPANY_COLD_START_REQUIRED_FACT_SLOTS_CURRENT)) {
5427
+ context.addIssue({
5428
+ code: external_exports.ZodIssueCode.custom,
5429
+ message: "cold_start_required_fact_slots_not_canonical"
5430
+ });
5431
+ }
5432
+ });
5417
5433
  var COLD_START_FACT_COVERAGE_DISPOSITIONS = [
5418
5434
  "established",
5419
5435
  "explicit_unknown",
@@ -5428,7 +5444,8 @@ var COLD_START_FACT_COVERAGE_DISPOSITION_POLICY = {
5428
5444
  offer_delivery_baseline: ["established", "explicit_unknown", "not_applicable"],
5429
5445
  operating_risk_baseline: ["established", "explicit_unknown", "not_applicable"],
5430
5446
  near_term_priority_ownership: ["established"],
5431
- reusable_company_artifact: ["established"]
5447
+ reusable_company_artifact: ["established"],
5448
+ internal_system_landscape: ["established", "explicit_unknown", "not_applicable"]
5432
5449
  };
5433
5450
  var coldStartFactCoverageReceiptSchema = external_exports.object({
5434
5451
  slot: companyColdStartFactSlotSchema,
@@ -5457,7 +5474,7 @@ var companyColdStartWorksetItemReadSchema = external_exports.object({
5457
5474
  issueId: external_exports.string().uuid(),
5458
5475
  enrollmentId: external_exports.string().uuid(),
5459
5476
  priorityOrder: external_exports.number().int().positive(),
5460
- factSlots: external_exports.array(companyColdStartFactSlotSchema).min(1),
5477
+ factSlots: companyColdStartFactSlotsSchema,
5461
5478
  disposition: companyColdStartWorksetItemDispositionSchema,
5462
5479
  dispositionReceiptId: external_exports.string().min(1).max(512).nullable()
5463
5480
  }).strict();
@@ -5468,6 +5485,7 @@ var companyColdStartWorksetReadSchema = external_exports.object({
5468
5485
  goalId: external_exports.string().uuid(),
5469
5486
  organizationVersion: external_exports.number().int().nonnegative(),
5470
5487
  authorityRevision: external_exports.number().int().positive(),
5488
+ requiredFactSlots: companyColdStartRequiredFactSlotsSchema,
5471
5489
  priorityIssueId: external_exports.string().uuid(),
5472
5490
  items: external_exports.array(companyColdStartWorksetItemReadSchema).min(1)
5473
5491
  }).strict();
@@ -11168,7 +11186,12 @@ var issueDeliveryColdStartFactCoverageContextSchema = external_exports.object({
11168
11186
  worksetItemId: uuidSchema3,
11169
11187
  factSlots: external_exports.array(external_exports.object({
11170
11188
  slot: companyColdStartFactSlotSchema,
11171
- allowedDispositions: external_exports.array(coldStartFactCoverageDispositionSchema).min(1).max(3)
11189
+ allowedDispositions: external_exports.array(coldStartFactCoverageDispositionSchema).min(1).max(3),
11190
+ notApplicableWarning: external_exports.object({
11191
+ code: external_exports.literal("current_systems_present"),
11192
+ message: external_exports.string().min(1).max(500),
11193
+ evidenceRef: external_exports.string().min(1).max(512)
11194
+ }).strict().nullable().optional()
11172
11195
  }).strict()).min(1).max(6)
11173
11196
  }).strict();
11174
11197
  var issueDeliveryAcceptanceReadModelSchema = external_exports.object({
@@ -13485,6 +13508,7 @@ var agentRuntimeConfigSchema = external_exports.object({
13485
13508
  cheap: agentModelProfileConfigSchema.optional()
13486
13509
  }).strict().optional()
13487
13510
  }).catchall(external_exports.unknown());
13511
+ var agentRoleIdentityStringSchema = external_exports.string().min(1);
13488
13512
  var agentRoleSchema = external_exports.preprocess(
13489
13513
  (value) => typeof value === "string" ? normalizeAgentRoleId(value) ?? value : value,
13490
13514
  external_exports.enum(AGENT_ROLE_IDS)
@@ -14835,7 +14859,7 @@ var pluginManagedAgentDeclarationSchema = external_exports.object({
14835
14859
  message: "agentKey must start with a lowercase alphanumeric and contain only lowercase letters, digits, dots, colons, underscores, or hyphens"
14836
14860
  }),
14837
14861
  displayName: external_exports.string().min(1).max(100),
14838
- role: external_exports.string().min(1).max(100).optional(),
14862
+ role: agentRoleIdentityStringSchema.max(100).optional(),
14839
14863
  title: external_exports.string().max(200).nullable().optional(),
14840
14864
  icon: external_exports.string().max(100).nullable().optional(),
14841
14865
  capabilities: external_exports.string().max(2e3).nullable().optional(),
@@ -19942,39 +19966,22 @@ function hostFrontmatterField(frontmatter, field) {
19942
19966
  function hostEscapeXml(value) {
19943
19967
  return String(value).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
19944
19968
  }
19945
- function readManagedPiSkillMetadata(filePath) {
19946
- const resolvedFilePath = realpathSync2(filePath);
19947
- const source = readFileSync7(resolvedFilePath, "utf8");
19948
- const match = source.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
19949
- if (!match) {
19950
- return {
19951
- filePath: resolvedFilePath,
19952
- hasFrontmatter: false,
19953
- name: null,
19954
- description: null,
19955
- hidden: false
19956
- };
19957
- }
19958
- return {
19959
- filePath: resolvedFilePath,
19960
- hasFrontmatter: true,
19961
- name: hostFrontmatterField(match[1], "name"),
19962
- description: hostFrontmatterField(match[1], "description"),
19963
- hidden: hostFrontmatterField(match[1], "disable-model-invocation")?.toLowerCase() === "true"
19964
- };
19965
- }
19966
19969
  function measureManagedPiRoleSkillMetadata(expectedSkills) {
19967
19970
  const entries = expectedSkills.map((expected) => {
19968
- const metadata = readManagedPiSkillMetadata(expected.filePath);
19969
- if (!metadata.hasFrontmatter) throw new Error(`managed skill frontmatter missing: ${expected.name}`);
19970
- if (metadata.name !== expected.name || typeof metadata.description !== "string" || !metadata.description.trim() || expected.requireHidden !== false && !metadata.hidden) {
19971
+ const source = readFileSync7(realpathSync2(expected.filePath), "utf8");
19972
+ const match = source.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
19973
+ if (!match) throw new Error(`managed skill frontmatter missing: ${expected.name}`);
19974
+ const name = hostFrontmatterField(match[1], "name");
19975
+ const description = hostFrontmatterField(match[1], "description");
19976
+ const hidden = hostFrontmatterField(match[1], "disable-model-invocation")?.toLowerCase() === "true";
19977
+ if (name !== expected.name || !description || expected.requireHidden !== false && !hidden) {
19971
19978
  throw new Error(`managed skill metadata mismatch: ${expected.name}`);
19972
19979
  }
19973
19980
  return [
19974
19981
  " <skill>",
19975
- ` <name>${hostEscapeXml(metadata.name)}</name>`,
19976
- ` <description>${hostEscapeXml(metadata.description)}</description>`,
19977
- ` <location>${hostEscapeXml(metadata.filePath)}</location>`,
19982
+ ` <name>${hostEscapeXml(name)}</name>`,
19983
+ ` <description>${hostEscapeXml(description)}</description>`,
19984
+ ` <location>${hostEscapeXml(realpathSync2(expected.filePath))}</location>`,
19978
19985
  " </skill>"
19979
19986
  ].join("\n");
19980
19987
  }).join("\n");
@@ -20046,10 +20053,7 @@ function readRoleSkill(expected) {
20046
20053
  const name = frontmatterField(match[1], "name");
20047
20054
  const description = frontmatterField(match[1], "description");
20048
20055
  const hidden = frontmatterField(match[1], "disable-model-invocation")?.toLowerCase() === "true";
20049
- if (name !== expected.name
20050
- || typeof description !== "string"
20051
- || !description.trim()
20052
- || (expected.requireHidden !== false && !hidden)) {
20056
+ if (name !== expected.name || !description || (expected.requireHidden !== false && !hidden)) {
20053
20057
  throw new Error("managed skill metadata mismatch: " + expected.name);
20054
20058
  }
20055
20059
  return {
@@ -21322,29 +21326,10 @@ function createManagedPiMcpProfileApi(options = {}) {
21322
21326
  function readMainSkills(piHome) {
21323
21327
  const skillsRoot = resolve6(piHome, "skills");
21324
21328
  if (!existsSync6(skillsRoot)) return [];
21325
- const entriesByName = /* @__PURE__ */ new Map();
21326
- for (const directory of readdirSync3(skillsRoot).sort()) {
21327
- const source = join7(skillsRoot, directory);
21328
- const skillFilePath = join7(source, "SKILL.md");
21329
- if (!existsSync6(skillFilePath)) continue;
21330
- const metadata = readManagedPiSkillMetadata(skillFilePath);
21331
- if (!metadata.hasFrontmatter || typeof metadata.name !== "string" || !/^[a-z0-9-]+$/.test(metadata.name) || typeof metadata.description !== "string" || !metadata.description.trim()) {
21332
- throw new Error(`pi_managed_mcp_main_skill_metadata_invalid:${directory}`);
21333
- }
21334
- const existing = entriesByName.get(metadata.name);
21335
- if (existing) {
21336
- if (existing.filePath !== metadata.filePath) {
21337
- throw new Error(`pi_managed_mcp_main_skill_conflict:${metadata.name}`);
21338
- }
21339
- continue;
21340
- }
21341
- entriesByName.set(metadata.name, {
21342
- name: metadata.name,
21343
- filePath: metadata.filePath,
21344
- requireHidden: false
21345
- });
21346
- }
21347
- return [...entriesByName.values()];
21329
+ return readdirSync3(skillsRoot).sort().flatMap((name) => {
21330
+ const source = join7(skillsRoot, name);
21331
+ return existsSync6(join7(source, "SKILL.md")) ? [{ name, source, requireHidden: false }] : [];
21332
+ });
21348
21333
  }
21349
21334
  function resolveManagedRoleSkills(piHome, skillProfiles) {
21350
21335
  const entriesByName = /* @__PURE__ */ new Map();
@@ -21366,19 +21351,11 @@ function createManagedPiMcpProfileApi(options = {}) {
21366
21351
  }
21367
21352
  }
21368
21353
  for (const entry of readMainSkills(piHome)) {
21369
- const existing = entriesByName.get(entry.name);
21370
- if (existing) {
21371
- const existingFilePath = realpathSync3(join7(existing.source, "SKILL.md"));
21372
- if (existingFilePath !== entry.filePath) {
21373
- throw new Error(`pi_managed_mcp_main_skill_conflict:${entry.name}`);
21374
- }
21375
- continue;
21376
- }
21377
- entriesByName.set(entry.name, entry);
21354
+ if (!entriesByName.has(entry.name)) entriesByName.set(entry.name, entry);
21378
21355
  }
21379
21356
  const entries = [...entriesByName.values()].map((entry) => ({
21380
21357
  name: entry.name,
21381
- filePath: entry.filePath ?? realpathSync3(join7(entry.source, "SKILL.md")),
21358
+ filePath: realpathSync3(join7(entry.source, "SKILL.md")),
21382
21359
  ...entry.requireHidden === false ? { requireHidden: false } : {}
21383
21360
  }));
21384
21361
  const metadata = measureManagedPiRoleSkillMetadata(entries);
@@ -23370,6 +23347,7 @@ var DEADLINE_POSTURE_GUARD = "If a named time window or milestone is missed, ski
23370
23347
  var MIN_PROMPT_BUDGET_CHARS = 8192;
23371
23348
  var MAX_RESOLVED_DEPENDENCY_REQUIRED_READS = 20;
23372
23349
  var MAX_EXACT_ISSUE_EVIDENCE_REFS = 20;
23350
+ var COMPANY_INITIALIZATION_ORIGIN_KIND = "company_initialization";
23373
23351
  function promptBudgetError(code, message) {
23374
23352
  const error = new Error(message);
23375
23353
  error.code = code;
@@ -24413,7 +24391,10 @@ function runtimeAuthorizationText(context, mode, {
24413
24391
  ] : [],
24414
24392
  "Never use create_interaction, request_confirmation, comment metadata, or free text to authorize a runtime action class."
24415
24393
  ].join("\n") : "";
24416
- const exactOrganizationReplay = replayAlreadyInTask ? "" : renderExactOrganizationIntentReplayBlock(envelope);
24394
+ const initializationAuthorization = asRecord(envelope.initializationAuthorization);
24395
+ const initializationAuthority = asRecord(context.companyInitializationAuthority);
24396
+ const initializationPlanAuthorizationWithoutExactReplay = readString(envelope.sourceKind) === COMPANY_INITIALIZATION_ORIGIN_KIND && readString(initializationAuthorization.runId) && readString(initializationAuthorization.signature) && readString(initializationAuthority.schemaVersion) === "mirrorx.company-initialization-authority.v1" && (!Array.isArray(envelope.authorizedOrganizationIntents) || envelope.authorizedOrganizationIntents.length === 0);
24397
+ const exactOrganizationReplay = replayAlreadyInTask || initializationPlanAuthorizationWithoutExactReplay ? "" : renderExactOrganizationIntentReplayBlock(envelope);
24417
24398
  return [
24418
24399
  completionContract,
24419
24400
  businessOutcomeOwnershipContract,
@@ -29912,7 +29893,7 @@ function createSourceCompletionStopPolicy({
29912
29893
  }
29913
29894
 
29914
29895
  // src/amaster-runtime-daemon.mjs
29915
- var CONNECTOR_VERSION = "0.1.1-beta.152";
29896
+ var CONNECTOR_VERSION = "0.1.1-beta.154";
29916
29897
  var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
29917
29898
  var SOURCE_ACQUISITION_CAPABILITY2 = source_acquisition_compatibility_default.profileVersion;
29918
29899
  var daemonRequire = createRequire(import.meta.url);
@@ -33284,6 +33265,7 @@ function runExitClosurePrompt(state, options = {}) {
33284
33265
  const runId = commandRunId(command) ?? "unknown";
33285
33266
  const closureStrategy = readString(response.closureStrategy) ?? "select_issue_disposition";
33286
33267
  const closurePhase = readString(response.closurePhase) ?? "disposition_closure";
33268
+ const authoritativeNowIso = readString(options.nowIso) ?? (/* @__PURE__ */ new Date()).toISOString();
33287
33269
  const workDispositionClosure = closureStrategy === "record_work_disposition" || closurePhase === "work_disposition_closure";
33288
33270
  const describeRequired = options.describeRequired !== false;
33289
33271
  const allowedActions = Array.isArray(response.allowedActions) ? response.allowedActions.filter((value) => typeof value === "string") : [];
@@ -33298,6 +33280,8 @@ function runExitClosurePrompt(state, options = {}) {
33298
33280
  describeRequired ? workDispositionClosure ? "Call runtime_action.describe exactly once for record_work_disposition, then use exactly one runtime_action.submit mutation with that described shape." : "Choose one Server-allowed action, call runtime_action.describe exactly once for that action type, then use exactly one runtime_action.submit mutation with that described shape." : "Use exactly one runtime_action.submit mutation with the already-issued phase-specific schema.",
33299
33281
  workDispositionClosure ? "The Server selected record_work_disposition as the only closure strategy. For this already-productive source run, record execute_inline with truthful source-run evidence; do not also mutate issue status or create an interaction. After command terminalization, the Server writes the Business Outcome and owns the matching Board review or terminal-state transition." : closurePhase === "live_path_closure" ? "The Server selected Durable Live Path closure. Establish exactly one typed external wait, scheduled monitor, or Board disposition interaction; a comment or Work Disposition does not satisfy this gate." : closurePhase === "terminal_disposition_closure" ? "The Server selected terminal disposition closure. Establish the authorized terminal state or one Board decision interaction; do not create a new live wait merely to avoid terminalization." : "The Server selected an Issue disposition closure. Choose update_parent, create_interaction (not suggest_tasks), or add_comment only when a comment is truly the intended exit path. A comment alone does not establish completion.",
33300
33282
  workDispositionClosure ? `Use evidenceRefs ["run:${runId}", "command:${state.commandId}"], structure.deliverableType "runtime_command_result", structure.deliverableKey "runtime-command-${state.commandId}", and structure.acceptanceMethodCode "governed_business_outcome". Supply a concise truthful reason based only on the primary turn summary.` : null,
33283
+ closurePhase === "live_path_closure" ? `Authoritative current time for this closure turn: ${authoritativeNowIso}` : null,
33284
+ closurePhase === "live_path_closure" ? "For schedule_monitor or upsert_external_wait, copy all time fields verbatim from the runtime_action.describe submitExample.action. If you derive a time instead, derive it only from the authoritative current time above; never use remembered or earlier-context dates." : null,
33301
33285
  `The idempotencyKey must be runtime-command-closure:${state.commandId}${closurePhase === "work_disposition_closure" ? ":work-disposition" : closurePhase === "live_path_closure" ? ":live-path" : closurePhase === "terminal_disposition_closure" ? ":terminal-disposition" : ""}.`,
33302
33286
  describeRequired ? "Do not call runtime_action.plan or runtime_action.commit. Do not call runtime_action.describe more than once. Stop immediately after the one allowed mutation returns." : "Do not call runtime_action.describe, runtime_action.plan, or runtime_action.commit. Stop immediately after the one allowed mutation returns."
33303
33287
  ].filter(Boolean).join("\n\n");
@@ -33517,7 +33501,10 @@ async function executeRunExitClosureTurn(config, inputState, options = {}) {
33517
33501
  execution = await runExecutor(executable, closureArgs, {
33518
33502
  cwd,
33519
33503
  env,
33520
- stdin: runExitClosurePrompt(state, { describeRequired }),
33504
+ stdin: runExitClosurePrompt(state, {
33505
+ describeRequired,
33506
+ nowIso: (/* @__PURE__ */ new Date()).toISOString()
33507
+ }),
33521
33508
  timeoutSeconds: Math.max(1, readNumber(executionConfig.timeoutSeconds, config.executorTimeoutSeconds)),
33522
33509
  maxOutputBytes: Math.max(1, readNumber(executionConfig.maxOutputBytes, config.executorMaxOutputBytes)),
33523
33510
  maxRssMb: Math.max(0, readNumber(executionConfig.maxRssMb, config.executorMaxRssMb)),
@@ -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.152";
10
+ const CONNECTOR_VERSION = "0.1.1-beta.154";
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.152",
3
+ "version": "0.1.1-beta.154",
4
4
  "description": "MirrorX runtime connector CLI and daemon",
5
5
  "license": "MIT",
6
6
  "type": "module",