@amaster.ai/employee-runtime-connector 0.1.1-beta.351 → 0.1.1-beta.353

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.
@@ -8,12 +8,26 @@ var __export = (target, all) => {
8
8
 
9
9
  // src/amaster-runtime-daemon/goal-context-attestation.mjs
10
10
  import { createHash } from "node:crypto";
11
+
12
+ // ../shared/src/canonical-json.ts
13
+ function canonicalGoalOutcomeValue(value) {
14
+ if (value instanceof Date) return JSON.stringify(value.toISOString());
15
+ if (Array.isArray(value)) return `[${Array.from(value, canonicalGoalOutcomeValue).join(",")}]`;
16
+ if (value && typeof value === "object") return `{${Object.entries(value).filter(([, child]) => child !== void 0).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([key, child]) => `${JSON.stringify(key)}:${canonicalGoalOutcomeValue(child)}`).join(",")}}`;
17
+ return JSON.stringify(value ?? null);
18
+ }
19
+
20
+ // ../shared/src/task-context-versions.ts
21
+ var TASK_CONTEXT_MANIFEST_VERSION = "task-context-v1";
22
+ var TASK_CONTEXT_V2 = "task-context-v2";
23
+
24
+ // src/amaster-runtime-daemon/goal-context-attestation.mjs
11
25
  var hash = (value) => createHash("sha256").update(value).digest("hex");
12
26
  function goalAuthorityBlock(context) {
13
27
  const manifest = context?.taskContextManifest;
14
- if (manifest?.version !== "task-context-v2") return null;
28
+ if (manifest?.version !== TASK_CONTEXT_V2) return null;
15
29
  if (!manifest.goalOutcomeContext?.binding || !manifest.goalOutcomeContext?.snapshotHash) throw new Error("goal_authority_context_missing");
16
- return "<mirrorx-goal-authority>\n" + JSON.stringify({
30
+ return "<mirrorx-goal-authority>\n" + canonicalGoalOutcomeValue({
17
31
  version: manifest.version,
18
32
  freshness: manifest.freshness,
19
33
  goalOutcomeContext: manifest.goalOutcomeContext,
@@ -33,7 +47,7 @@ function attestGoalContextDelivery({ authority, prompt, systemPrompt, commandId,
33
47
  commandId,
34
48
  runId,
35
49
  executorKind,
36
- taskContextVersion: "task-context-v2",
50
+ taskContextVersion: TASK_CONTEXT_V2,
37
51
  deliveryStage: "process_spawn",
38
52
  transport: deliveredPrompt.transport,
39
53
  authoritySha256: hash(authority),
@@ -6168,6 +6182,12 @@ var ERROR_PRESENTATIONS = {
6168
6182
  nextAction: null,
6169
6183
  tone: "danger"
6170
6184
  },
6185
+ pi_provider_request_timeout: {
6186
+ label: "\u6A21\u578B\u8BF7\u6C42\u8D85\u65F6",
6187
+ summary: "\u6A21\u578B\u670D\u52A1\u672A\u5728\u8BF7\u6C42\u65F6\u9650\u5185\u5B8C\u6210\u54CD\u5E94\uFF0C\u672C\u6B21\u6267\u884C\u5DF2\u505C\u6B62\u3002",
6188
+ nextAction: "\u7CFB\u7EDF\u5C06\u81EA\u52A8\u91CD\u8BD5\uFF1B\u82E5\u4ECD\u672A\u6062\u590D\uFF0C\u8BF7\u7A0D\u540E\u91CD\u65B0\u6267\u884C\u3002",
6189
+ tone: "warning"
6190
+ },
6171
6191
  runtime_connector_command_failed: {
6172
6192
  label: "\u6267\u884C\u547D\u4EE4\u5931\u8D25",
6173
6193
  summary: "\u8FD0\u884C\u5668\u62A5\u544A\u547D\u4EE4\u672A\u80FD\u5B8C\u6210\uFF0C\u5177\u4F53\u539F\u56E0\u8BF7\u67E5\u770B\u9519\u8BEF\u8BE6\u60C5\u3002",
@@ -7666,7 +7686,6 @@ var TASK_GOVERNANCE_BLOCKER_REASONS = [
7666
7686
  "missing_expected_outcome",
7667
7687
  "missing_acceptance_criteria"
7668
7688
  ];
7669
- var TASK_CONTEXT_MANIFEST_VERSION = "task-context-v1";
7670
7689
  var TASK_CONTEXT_MEMORY_SCOPES = ["none", "task"];
7671
7690
  var TASK_CONTEXT_FRESHNESS_MODES = ["current", "frozen"];
7672
7691
  var TASK_CONTEXT_WIKI_MODES = ["disabled", "optional"];
@@ -27758,7 +27777,8 @@ function sanitizeRuntimeWebEvidence(input) {
27758
27777
  // src/amaster-runtime-daemon/executor-protocol/pi.mjs
27759
27778
  var PI_PROVIDER_AUTH_RE = /(?:(?:\b401\b|\b403\b)[^\n]*(?:unauthorized|forbidden|auth(?:entication|orization)?|api[_\s-]?key)|(?:invalid|missing|expired|revoked)\s+(?:provider\s+)?api[_\s-]?key|provider\s+authentication\s+required)/i;
27760
27779
  var PI_PROVIDER_QUOTA_EXHAUSTED_RE = /(?:\binsufficient[_\s-]?user[_\s-]?quota\b|河狸币余额不足|\b402\b[^\n]*(?:余额不足|insufficient[_\s-]?balance|payment\s+required))/i;
27761
- var PI_PROVIDER_TRANSIENT_RE = /(?:Stream ended without finish_reason|\b(?:429|5\d{2})\b|rate[-\s]?limit(?:ed)?|too\s+many\s+requests|billing\s+admission\s+failed|service\s+unavailable|upstream[^\n]*(?:unavailable|failed|timeout)|connect(?:ion)?[^\n]*refused|temporar(?:y|ily)[^\n]*(?:unavailable|failed)|try\s+again\s+later)/i;
27780
+ var PI_PROVIDER_REQUEST_TIMEOUT_RE = /^Request timed out\.?$/i;
27781
+ var PI_PROVIDER_TRANSIENT_RE = /(?:Request timed out|Stream ended without finish_reason|\b(?:429|5\d{2})\b|rate[-\s]?limit(?:ed)?|too\s+many\s+requests|billing\s+admission\s+failed|service\s+unavailable|upstream[^\n]*(?:unavailable|failed|timeout)|connect(?:ion)?[^\n]*refused|temporar(?:y|ily)[^\n]*(?:unavailable|failed)|try\s+again\s+later)/i;
27762
27782
  var PI_PROVIDER_PROTOCOL_RE = /provider[^\n]*finish_reason[^\n]*unexpected_state/i;
27763
27783
  var PI_PROVIDER_RETRY_AFTER_SECONDS_RE = /retry[-\s]?after\s*[:=]?\s*(\d{1,6})\s*(?:seconds?|secs?|s)\b/i;
27764
27784
  var PI_TERMINAL_CLEANUP_PERMISSION_RE = /(?:\bkill\b[^\n]*\bEPERM\b|\bEPERM\b[^\n]*\bkill\b)/i;
@@ -27877,6 +27897,12 @@ function extractPiProviderRetryNotBefore(errorMessage, now) {
27877
27897
  function classifyPiProviderError(input, now = /* @__PURE__ */ new Date()) {
27878
27898
  const errorMessage = readString(asRecord(input).errorMessage);
27879
27899
  if (!errorMessage) return null;
27900
+ if (PI_PROVIDER_REQUEST_TIMEOUT_RE.test(errorMessage)) {
27901
+ return {
27902
+ errorCode: "pi_provider_request_timeout",
27903
+ errorFamily: "transient_upstream"
27904
+ };
27905
+ }
27880
27906
  if (PI_PROVIDER_PROTOCOL_RE.test(errorMessage)) {
27881
27907
  return {
27882
27908
  errorCode: "pi_provider_protocol_failure",
@@ -33930,8 +33956,9 @@ function assertRequiredTaskAttachmentMaterialized(input, materialized) {
33930
33956
  }
33931
33957
 
33932
33958
  // src/amaster-runtime-daemon.mjs
33933
- var CONNECTOR_VERSION = "0.1.1-beta.351";
33959
+ var CONNECTOR_VERSION = "0.1.1-beta.353";
33934
33960
  var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
33961
+ var SUPPORTED_TASK_CONTEXT_VERSIONS = Object.freeze([TASK_CONTEXT_MANIFEST_VERSION, TASK_CONTEXT_V2]);
33935
33962
  var daemonRequire = createRequire(import.meta.url);
33936
33963
  var MAX_CHECKPOINT_BYTES = 20 * 1024 * 1024;
33937
33964
  var CHECKPOINT_TTL_MS = 24 * 60 * 60 * 1e3;
@@ -34502,7 +34529,7 @@ function buildRegisterPayload(config) {
34502
34529
  arch: process.arch,
34503
34530
  metadata: {
34504
34531
  daemon: "amaster-runtime-daemon.mjs",
34505
- taskContextVersions: ["task-context-v1", "task-context-v2"],
34532
+ taskContextVersions: SUPPORTED_TASK_CONTEXT_VERSIONS,
34506
34533
  connectorVersion: CONNECTOR_VERSION,
34507
34534
  ...buildCommit ? { buildCommit } : {},
34508
34535
  authMode: config.token ? "bearer_token" : config.authHeader ? "custom_header" : "none",
@@ -34578,6 +34605,7 @@ function buildHeartbeatPayload(config, options = {}) {
34578
34605
  },
34579
34606
  metadata: {
34580
34607
  authMode: config.token ? "bearer_token" : config.authHeader ? "custom_header" : "none",
34608
+ taskContextVersions: SUPPORTED_TASK_CONTEXT_VERSIONS,
34581
34609
  capabilityReport: {
34582
34610
  ...capabilityReport,
34583
34611
  connectorVersion: CONNECTOR_VERSION,
@@ -39429,7 +39457,7 @@ async function executeRunCommand(config, command) {
39429
39457
  });
39430
39458
  } catch (err) {
39431
39459
  const rolloutError = `${executor.kind}_managed_mcp_session_rollout_failed: ${err instanceof Error ? err.message : String(err)}`;
39432
- if (approvalRequiredSession || config.checkpointUploadEnabled) {
39460
+ if (approvalRequiredSession) {
39433
39461
  nativeSessionRolloutError = rolloutError;
39434
39462
  } else {
39435
39463
  nativeSessionRollout = {
@@ -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.351";
10
+ const CONNECTOR_VERSION = "0.1.1-beta.353";
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.351",
3
+ "version": "0.1.1-beta.353",
4
4
  "description": "MirrorX runtime connector CLI and daemon",
5
5
  "license": "MIT",
6
6
  "type": "module",