@amaster.ai/employee-runtime-connector 0.1.1-beta.300 → 0.1.1-beta.302

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.
package/README.md CHANGED
@@ -214,6 +214,8 @@ This isolation does not schedule a retry or a second business continuation. Comm
214
214
 
215
215
  Executor process logs (stdout/stderr events, including full-transcript chat turns) are streamed to the Server as batches against `/ingest/logs/batch`. Every live log entry carries a per-command monotonically increasing `seq`; the Server dedupes on `(commandId, sourceSeq)`, so a retry after an ambiguous outcome (restart, timeout, 5xx) never duplicates canonical `heartbeat_run_events`.
216
216
 
217
+ Full-transcript turns preserve every pi event as canonical log entries, including per-token streaming deltas (`thinking_delta`, `text_delta`, `toolcall_delta`) — the chat transcript's typewriter rendering is driven by them. No per-stream entry budget exists: every entry is delivered, and live output is never suppressed. Byte volume stays bounded by the executor flood limit, and outage-time connector memory by the retry backlog byte bound below.
218
+
217
219
  A batch whose delivery outcome is ambiguous is not dropped: it enters a bounded in-memory retry backlog that is retried on a timer and drains in source order, preserving `heartbeat_run_events` ordering. If the backlog is still undelivered when the executor turn ends, the remaining entries move into the durable result outbox and the command result is deferred until the log entries are delivered first; a sustained log-ingest outage bounded by `AMASTER_RESULT_OUTBOX_MAX_ATTEMPTS` drops the entries with a stderr diagnostic rather than holding the result hostage. HTTP 400 entries keep the existing bisect-to-invalid drop semantics.
218
220
 
219
221
  Tuning knobs (defaults are the production values):
@@ -5852,7 +5852,7 @@ function normalizeAgentRoleId(role) {
5852
5852
  // ../shared/src/constants.ts
5853
5853
  var COMPANY_STATUSES = ["active", "paused", "archived"];
5854
5854
  var COMPANY_SANDBOX_DESIRED_STATES = ["running", "stopped", "deleting"];
5855
- var DEFAULT_COMPANY_ATTACHMENT_MAX_BYTES = 10 * 1024 * 1024;
5855
+ var DEFAULT_COMPANY_ATTACHMENT_MAX_BYTES = 50 * 1024 * 1024;
5856
5856
  var MAX_COMPANY_ATTACHMENT_MAX_BYTES = 1024 * 1024 * 1024;
5857
5857
  var DEPLOYMENT_MODES = ["local_trusted", "authenticated"];
5858
5858
  var DEPLOYMENT_EXPOSURES = ["private", "public"];
@@ -12200,10 +12200,11 @@ var ceoProjectedBusinessContextSchema = external_exports.object({
12200
12200
  });
12201
12201
  }
12202
12202
  });
12203
+ var ceoPeriodicAgentOutputDeliveryIntentSchema = external_exports.object({
12204
+ kind: external_exports.literal("agent_output")
12205
+ }).strict();
12203
12206
  var ceoPeriodicDeliveryIntentSchema = external_exports.discriminatedUnion("kind", [
12204
- external_exports.object({
12205
- kind: external_exports.literal("agent_output")
12206
- }).strict(),
12207
+ ceoPeriodicAgentOutputDeliveryIntentSchema,
12207
12208
  external_exports.object({
12208
12209
  kind: external_exports.literal("board_resolution"),
12209
12210
  decisionContract: external_exports.object({
@@ -12213,11 +12214,11 @@ var ceoPeriodicDeliveryIntentSchema = external_exports.discriminatedUnion("kind"
12213
12214
  }).strict()
12214
12215
  }).strict()
12215
12216
  ]);
12216
- var ceoPeriodicAcceptanceIdentitySchema = external_exports.object({
12217
+ var ceoPeriodicAcceptanceIdentityShape = {
12217
12218
  deliverableKinds: external_exports.array(external_exports.enum(ISSUE_DELIVERY_ALLOWED_KINDS)).min(1).max(4),
12218
- conditionCodes: external_exports.array(external_exports.string().trim().regex(/^[a-z0-9][a-z0-9._-]{0,127}$/u)).min(1).max(10),
12219
- deliveryIntent: ceoPeriodicDeliveryIntentSchema
12220
- }).strict().superRefine((value, ctx) => {
12219
+ conditionCodes: external_exports.array(external_exports.string().trim().regex(/^[a-z0-9][a-z0-9._-]{0,127}$/u)).min(1).max(10)
12220
+ };
12221
+ function validateCeoPeriodicAcceptanceIdentity(value, ctx) {
12221
12222
  const kinds = new Set(value.deliverableKinds);
12222
12223
  if (value.deliveryIntent.kind === "agent_output") {
12223
12224
  if (kinds.has("decision")) {
@@ -12243,7 +12244,15 @@ var ceoPeriodicAcceptanceIdentitySchema = external_exports.object({
12243
12244
  message: "board_resolution currently requires decision-only delivery"
12244
12245
  });
12245
12246
  }
12246
- });
12247
+ }
12248
+ var ceoPeriodicAcceptanceIdentitySchema = external_exports.object({
12249
+ ...ceoPeriodicAcceptanceIdentityShape,
12250
+ deliveryIntent: ceoPeriodicDeliveryIntentSchema
12251
+ }).strict().superRefine(validateCeoPeriodicAcceptanceIdentity);
12252
+ var ceoPeriodicReachableAcceptanceIdentitySchema = external_exports.object({
12253
+ ...ceoPeriodicAcceptanceIdentityShape,
12254
+ deliveryIntent: ceoPeriodicAgentOutputDeliveryIntentSchema
12255
+ }).strict().superRefine(validateCeoPeriodicAcceptanceIdentity);
12247
12256
  var ceoPeriodicRoutingRosterEntrySchema = external_exports.object({
12248
12257
  agentId: external_exports.string().uuid(),
12249
12258
  roleSlot: external_exports.object({
@@ -12350,6 +12359,23 @@ var ceoPeriodicDiscoveredWorkInputSchema = external_exports.union([
12350
12359
  ceoPeriodicStructuredDiscoveredWorkInputSchema,
12351
12360
  ceoPeriodicLegacyDiscoveredWorkInputSchema
12352
12361
  ]);
12362
+ var ceoPeriodicReachableLegacyDiscoveredWorkInputSchema = external_exports.object({
12363
+ ...ceoPeriodicDiscoveredWorkInputShape,
12364
+ acceptanceIdentity: ceoPeriodicReachableAcceptanceIdentitySchema,
12365
+ workKind: external_exports.string().trim().regex(/^[a-z0-9][a-z0-9._-]{0,127}$/u)
12366
+ }).strict().superRefine(validateCeoPeriodicDiscoveredWorkShape);
12367
+ var ceoPeriodicReachableStructuredDiscoveredWorkInputSchema = external_exports.object({
12368
+ ...ceoPeriodicDiscoveredWorkInputShape,
12369
+ acceptanceIdentity: ceoPeriodicReachableAcceptanceIdentitySchema,
12370
+ workPurpose: ceoWorkPurposeSelectionSchema
12371
+ }).strict().superRefine(validateCeoPeriodicDiscoveredWorkShape).transform((value) => ({
12372
+ ...value,
12373
+ workKind: resolveMirrorxWorkPurposeSelection(value.workPurpose).workKind
12374
+ }));
12375
+ var ceoPeriodicReachableDiscoveredWorkInputSchema = external_exports.union([
12376
+ ceoPeriodicReachableStructuredDiscoveredWorkInputSchema,
12377
+ ceoPeriodicReachableLegacyDiscoveredWorkInputSchema
12378
+ ]);
12353
12379
  var ceoPeriodicSourceContextRefSchema = external_exports.object({
12354
12380
  kind: external_exports.literal("document_revision"),
12355
12381
  sourceIssueId: external_exports.string().uuid(),
@@ -12443,7 +12469,7 @@ var ceoPeriodicWorkDispatchInputSchema = external_exports.object({
12443
12469
  continuations: external_exports.array(ceoPeriodicContinuationInputSchema).max(20).default([]),
12444
12470
  candidates: ceoPeriodicDemandCandidatesSchema.default([]),
12445
12471
  noWorkReason: ceoPeriodicNoWorkReasonSchema.optional(),
12446
- work: external_exports.array(ceoPeriodicDiscoveredWorkInputSchema).max(CEO_PERIODIC_MAX_CANDIDATES_PER_OBSERVATION)
12472
+ work: external_exports.array(ceoPeriodicReachableDiscoveredWorkInputSchema).max(CEO_PERIODIC_MAX_CANDIDATES_PER_OBSERVATION)
12447
12473
  }).strict();
12448
12474
  var AUTOMATIC_WORK_LIFECYCLE_STATES = [
12449
12475
  "discovered",
@@ -12979,6 +13005,25 @@ var boardReactivateBusinessDemandAutomationRuleSchema = external_exports.object(
12979
13005
  rationale: external_exports.string().trim().min(1).max(2e3)
12980
13006
  }).strict();
12981
13007
 
13008
+ // ../shared/src/goal-work-progress.ts
13009
+ var goalWorkProgressBaseSchema = external_exports.object({
13010
+ basis: external_exports.literal("linked_tasks"),
13011
+ completedCount: external_exports.number().int().nonnegative(),
13012
+ remainingCount: external_exports.number().int().nonnegative(),
13013
+ totalCount: external_exports.number().int().nonnegative()
13014
+ });
13015
+ var goalWorkProgressSummarySchema = external_exports.discriminatedUnion("state", [
13016
+ goalWorkProgressBaseSchema.extend({
13017
+ state: external_exports.literal("ready"),
13018
+ totalCount: external_exports.number().int().positive(),
13019
+ percent: external_exports.number().int().min(0).max(100)
13020
+ }).strict(),
13021
+ goalWorkProgressBaseSchema.extend({
13022
+ state: external_exports.literal("unavailable"),
13023
+ percent: external_exports.null()
13024
+ }).strict()
13025
+ ]);
13026
+
12982
13027
  // ../shared/src/goal-action-semantics.ts
12983
13028
  var GOAL_ACTION_INTERACTION_PURPOSE_CODES = [
12984
13029
  "goal_gap_authority_exception",
@@ -27508,7 +27553,8 @@ function shouldPreservePiEventForFullTranscript(event) {
27508
27553
  if (!event || typeof event !== "object") return false;
27509
27554
  if (isProviderBookkeepingEvent(event)) return false;
27510
27555
  const type = tcReadString(event.type);
27511
- return type !== null && PI_FULL_TRANSCRIPT_EVENT_TYPES.has(type);
27556
+ if (!PI_FULL_TRANSCRIPT_EVENT_TYPES.has(type)) return false;
27557
+ return true;
27512
27558
  }
27513
27559
 
27514
27560
  // src/amaster-runtime-daemon/executor-protocol/codex.mjs
@@ -28516,6 +28562,7 @@ function parsePiJsonl(stdout) {
28516
28562
  let terminalEventIndex = null;
28517
28563
  let sawAgentSettled = false;
28518
28564
  let settledEventIndex = null;
28565
+ let terminalAgentWillRetry = false;
28519
28566
  let eventIndex = -1;
28520
28567
  const messages = [];
28521
28568
  const mcpToolResults = [];
@@ -28537,12 +28584,13 @@ function parsePiJsonl(stdout) {
28537
28584
  if (event.type === "auto_retry_start") {
28538
28585
  const message = readString(event.errorMessage);
28539
28586
  const lastError = errorEvents.at(-1);
28540
- const matched = Number.isSafeInteger(event.attempt) && event.attempt > 0 && (event.attempt === 1 || event.attempt === retry?.attempt + 1) && turnStartIndex >= 0 && lastError?.provider === true && lastError.message === message && lastError.eventIndex === terminalEventIndex && terminalEventType === "agent_end";
28587
+ const agentRetryAuthorized = terminalAgentWillRetry;
28588
+ const matched = Number.isSafeInteger(event.attempt) && event.attempt > 0 && (event.attempt === 1 || event.attempt === retry?.attempt + 1) && turnStartIndex >= 0 && (lastError?.provider === true || agentRetryAuthorized && lastError?.agentRetryEligible === true) && lastError?.message === message && lastError?.eventIndex === terminalEventIndex && terminalEventType === "agent_end";
28541
28589
  const priorErrors = retry && event.attempt === retry.attempt + 1 ? retry.errors : [];
28542
28590
  retry = matched ? {
28543
28591
  attempt: event.attempt,
28544
28592
  startIndex: eventIndex,
28545
- errors: [...priorErrors, ...errorEvents.filter((error) => error.eventIndex >= turnStartIndex && error.provider && error.message === message)]
28593
+ errors: [...priorErrors, ...errorEvents.filter((error) => error.eventIndex >= turnStartIndex && error.message === message && (error.provider || agentRetryAuthorized && error.agentRetryEligible))]
28546
28594
  } : null;
28547
28595
  continue;
28548
28596
  }
@@ -28593,6 +28641,7 @@ function parsePiJsonl(stdout) {
28593
28641
  if (event.type === "turn_end" || event.type === "agent_end") {
28594
28642
  terminalEventType = event.type;
28595
28643
  terminalEventIndex = eventIndex;
28644
+ terminalAgentWillRetry = event.type === "agent_end" && (event.willRetry === true || event.will_retry === true);
28596
28645
  }
28597
28646
  stopReason = readString(event.stopReason ?? event.stop_reason) ?? piNestedMessageStopReason(event) ?? stopReason;
28598
28647
  const terminalError = piStopReasonErrorText(event) ?? piNestedMessageErrorText(event);
@@ -28600,7 +28649,8 @@ function parsePiJsonl(stdout) {
28600
28649
  errorEvents.push({
28601
28650
  message: terminalError,
28602
28651
  eventIndex,
28603
- provider: classifyPiProviderError({ errorMessage: terminalError })?.errorFamily === "transient_upstream"
28652
+ provider: classifyPiProviderError({ errorMessage: terminalError })?.errorFamily === "transient_upstream",
28653
+ agentRetryEligible: true
28604
28654
  });
28605
28655
  successfulAssistantIndex = -1;
28606
28656
  if (PI_PROVIDER_PROTOCOL_RE.test(terminalError)) {
@@ -28637,7 +28687,7 @@ function parsePiJsonl(stdout) {
28637
28687
  eventIndex
28638
28688
  });
28639
28689
  } else {
28640
- errorEvents.push({ message: eventError, eventIndex, provider: false });
28690
+ errorEvents.push({ message: eventError, eventIndex, provider: false, agentRetryEligible: false });
28641
28691
  successfulAssistantIndex = -1;
28642
28692
  if (PI_PROVIDER_PROTOCOL_RE.test(eventError)) {
28643
28693
  diagnostics.push({
@@ -34391,7 +34441,7 @@ function assertRequiredTaskAttachmentMaterialized(input, materialized) {
34391
34441
  }
34392
34442
 
34393
34443
  // src/amaster-runtime-daemon.mjs
34394
- var CONNECTOR_VERSION = "0.1.1-beta.300";
34444
+ var CONNECTOR_VERSION = "0.1.1-beta.302";
34395
34445
  var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
34396
34446
  var daemonRequire = createRequire(import.meta.url);
34397
34447
  var MAX_CHECKPOINT_BYTES = 20 * 1024 * 1024;
@@ -36692,7 +36742,6 @@ function createLiveOutputLogger(config, command, executorKind, protectedValues =
36692
36742
  const buffers = { stdout: "", stderr: "" };
36693
36743
  const displayCounts = { stdout: 0, stderr: 0, system: 0 };
36694
36744
  const sourceCounts = { stdout: 0, stderr: 0 };
36695
- const suppressedCounts = { stdout: 0, stderr: 0, system: 0 };
36696
36745
  const eventTypeCounts = /* @__PURE__ */ new Map();
36697
36746
  let jsonlEventCount = 0;
36698
36747
  let meaningfulProgressEventCount = 0;
@@ -36746,10 +36795,6 @@ function createLiveOutputLogger(config, command, executorKind, protectedValues =
36746
36795
  );
36747
36796
  const piToolArgumentTracker = executorKind === "pi" ? createPiToolArgumentAmplificationTracker(options.piToolArgumentGuard) : null;
36748
36797
  const fullTranscriptEnabled = executorKind === "pi" && readString(asRecord(asRecord(command).payload).transcriptDetail) === AMASTER_RUNTIME_TRANSCRIPT_DETAIL_FULL;
36749
- const maxEntriesPerStream = parsePositiveInteger(
36750
- process.env.AMASTER_RUNTIME_LIVE_LOG_MAX_ENTRIES_PER_STREAM,
36751
- fullTranscriptEnabled ? 2e3 : 200
36752
- );
36753
36798
  const countEventType = (event) => {
36754
36799
  const eventType = readString(asRecord(event).type) ?? "unknown";
36755
36800
  const key = eventTypeCounts.has(eventType) || eventTypeCounts.size < 32 ? eventType : "other";
@@ -36936,10 +36981,6 @@ function createLiveOutputLogger(config, command, executorKind, protectedValues =
36936
36981
  };
36937
36982
  const enqueue = (entry) => {
36938
36983
  const stream = entry.stream === "stderr" || entry.stream === "system" ? entry.stream : "stdout";
36939
- if ((displayCounts[stream] ?? 0) >= maxEntriesPerStream) {
36940
- suppressedCounts[stream] = (suppressedCounts[stream] ?? 0) + 1;
36941
- return;
36942
- }
36943
36984
  displayCounts[stream] = (displayCounts[stream] ?? 0) + 1;
36944
36985
  const entryBytes = runtimeLogBatchEntryBytes(command, entry);
36945
36986
  let candidateBatchBytes = pendingBatchBytes + (pendingBatch.length > 0 ? 1 : 0) + entryBytes;
@@ -37087,20 +37128,14 @@ function createLiveOutputLogger(config, command, executorKind, protectedValues =
37087
37128
  stopBacklogRetry();
37088
37129
  flushPendingBatch();
37089
37130
  await queue;
37090
- const suppressedSummaries = Object.entries(suppressedCounts).filter(([, count2]) => count2 > 0).map(([stream, count2]) => ({ stream, count: count2 }));
37091
- if (suppressedSummaries.length > 0 || logEntriesBacklogDropped > 0) {
37092
- const suppressedCount = suppressedSummaries.reduce((total, summary) => total + summary.count, 0);
37131
+ if (logEntriesBacklogDropped > 0) {
37093
37132
  const summaryEntry = {
37094
37133
  stream: "system",
37095
- level: logEntriesBacklogDropped > 0 ? "warn" : "info",
37096
- message: logEntriesBacklogDropped > 0 ? `Runtime output delivery exceeded the retry backlog bound: ${logEntriesBacklogDropped} oldest entr${logEntriesBacklogDropped === 1 ? "y" : "ies"} dropped before delivery` : `Runtime output summarized: ${suppressedCount} event(s) suppressed after ${maxEntriesPerStream} live log entries per stream`,
37134
+ level: "warn",
37135
+ message: `Runtime output delivery exceeded the retry backlog bound: ${logEntriesBacklogDropped} oldest entr${logEntriesBacklogDropped === 1 ? "y" : "ies"} dropped before delivery`,
37097
37136
  payload: {
37098
37137
  presentationKind: "output_summary",
37099
37138
  executorKind,
37100
- suppressedCount,
37101
- suppressedByStream: suppressedSummaries,
37102
- maxEntriesPerStream,
37103
- deliveryIncomplete: logEntriesBacklogDropped > 0,
37104
37139
  backlogDropped: logEntriesBacklogDropped
37105
37140
  }
37106
37141
  };
@@ -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.300";
10
+ const CONNECTOR_VERSION = "0.1.1-beta.302";
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.300",
3
+ "version": "0.1.1-beta.302",
4
4
  "description": "MirrorX runtime connector CLI and daemon",
5
5
  "license": "MIT",
6
6
  "type": "module",