@amaster.ai/employee-runtime-connector 0.1.0-beta.2 → 0.1.0-beta.3

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
@@ -21,6 +21,8 @@ Do not use `latest`, `^`, or `~` in a runtime image. The image tag and connector
21
21
 
22
22
  Immutable images should pin an exact package version as their baseline. The current connector does not download or replace runtime code while running; package upgrades and rollbacks belong to the image build and rollout.
23
23
 
24
+ The publish workflow verifies that npm records the publishing commit as the package `gitHead`, then updates the repository deployment pin. Remote deployment accepts that package only when its `gitHead` is an ancestor of the target source commit and the connector package path is unchanged between them. This path-only comparison is valid because the published connector is self-contained; if runtime code starts importing workspace source outside this package, expand the provenance scope and tests before release. After restart, deployment also verifies the package CLI version inside the container. Do not update the deployment pin manually to bypass either provenance check.
25
+
24
26
  ## Package Contents
25
27
 
26
28
  - `dist/amaster-runtime.mjs`: configuration, pairing, workspace, diagnostics, and daemon lifecycle CLI.
@@ -2314,7 +2314,7 @@ import { copyFileSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSy
2314
2314
  import { homedir, hostname } from "node:os";
2315
2315
  import { basename, delimiter, dirname, extname, isAbsolute, join, relative, resolve } from "node:path";
2316
2316
  import { spawn, spawnSync } from "node:child_process";
2317
- const CONNECTOR_VERSION = "0.1.0-beta.2";
2317
+ const CONNECTOR_VERSION = "0.1.0-beta.3";
2318
2318
  const MAX_INFERRED_ARTIFACT_UPLOADS = 20;
2319
2319
  const MAX_CHECKPOINT_BYTES = 20 * 1024 * 1024;
2320
2320
  const CHECKPOINT_TTL_MS = 24 * 60 * 60 * 1000;
@@ -3508,7 +3508,9 @@ function runtimeActionsInstruction(options = {}) {
3508
3508
  : [];
3509
3509
  return [
3510
3510
  "Runtime action bridge:",
3511
- "If direct AMaster API requests are unavailable from the executor sandbox, do not stop at blocked. Instead finish with this exact marker and a JSON object:",
3511
+ "Choose exactly one mutation path for each requested action: direct AMaster API or the runtime action bridge. Never replay the same mutation through both paths.",
3512
+ "If direct AMaster API requests succeed for all requested mutations, finish with a normal summary and do not emit or mention the AMASTER_RUNTIME_ACTIONS marker.",
3513
+ "If direct AMaster API requests are unavailable from the executor sandbox, do not stop at blocked. Use the runtime action bridge for the unapplied mutations.",
3512
3514
  "Use runtime actions as a continuation patch, not as a full replay. If the wake reason or latest comments say a confirmation was accepted, rejected, or that no more child tasks/interactions should be created, do not recreate those earlier actions. Add the final result comment and update the parent task instead.",
3513
3515
  "If the wake reason is issue_children_completed, treat the completed child tasks as already resolved blockers. Do not recreate blocker child tasks, do not repeat the first-run blocker plan, and do not create another review path unless new human input is truly required. Summarize the completed child work and use update_parent status done when no human review is needed.",
3514
3516
  "Use update_parent status done when no human review is needed. Prefer creating a pending review path such as request_confirmation, request_checkbox_confirmation, ask_user_questions, or suggest_tasks before status in_review; if a bare in_review update is emitted, AMaster will create a fallback request_confirmation before PATCH.",
@@ -3530,7 +3532,7 @@ function runtimeActionsInstruction(options = {}) {
3530
3532
  options.canOrchestrateOrganization
3531
3533
  ? "When assigning a newly hired agent's first task in the same action batch, set clientKey on the agent_hire action and set assigneeAgentClientKey or agentClientKey on the create_child_task action to that same key. Do not leave the first task assigned to the current CEO/executing agent unless the CEO should actually do the work."
3532
3534
  : "",
3533
- "Output format: write the marker AMASTER_RUNTIME_ACTIONS, then exactly one fenced json object. Use this literal shape with real action objects: {\"version\":1,\"actions\":[{\"type\":\"add_comment\",\"body\":\"Progress or result summary\"}]}.",
3535
+ "Fallback output format: write the marker AMASTER_RUNTIME_ACTIONS, then exactly one fenced json object. Use this literal shape with real action objects: {\"version\":1,\"actions\":[{\"type\":\"add_comment\",\"body\":\"Progress or result summary\"}]}.",
3534
3536
  "The runtime action block must be strict JSON parseable by JSON.parse. Do not use ellipses, placeholders such as [...], comments, trailing commas, single quotes, markdown tables outside quoted strings, or raw double quotes inside string values. Escape quotes and newlines in string values, or generate the block with JSON.stringify / @amaster/runtime-sdk before printing it.",
3535
3537
  "Before final output, validate the runtime action block with JSON.parse. If it would fail, fix the JSON and only then print AMASTER_RUNTIME_ACTIONS.",
3536
3538
  `Allowed action types: ${allowedActionTypes}.`,
@@ -5269,9 +5271,10 @@ function extractRuntimeActionEnvelope(text) {
5269
5271
  const structuredEnvelope = tryExtractStructuredRuntimeActionEnvelope(text);
5270
5272
  if (structuredEnvelope) return structuredEnvelope;
5271
5273
 
5272
- const markerIndex = text.indexOf("AMASTER_RUNTIME_ACTIONS");
5273
- if (markerIndex === -1) return null;
5274
- const jsonStart = text.indexOf("{", markerIndex);
5274
+ const markerMatch = /^[ \t]*AMASTER_RUNTIME_ACTIONS[ \t]*$/m.exec(text);
5275
+ if (!markerMatch) return null;
5276
+ const markerEnd = markerMatch.index + markerMatch[0].length;
5277
+ const jsonStart = text.indexOf("{", markerEnd);
5275
5278
  if (jsonStart === -1) {
5276
5279
  const err = new Error("AMASTER_RUNTIME_ACTIONS JSON could not be parsed: missing JSON object");
5277
5280
  err.runtimeActionType = "parse";
@@ -5290,7 +5293,9 @@ function extractRuntimeActionEnvelope(text) {
5290
5293
 
5291
5294
  function tryExtractStructuredRuntimeActionEnvelope(text) {
5292
5295
  const source = String(text ?? "");
5293
- const markerRe = /(^|\r?\n)[ \t]*AMASTER_RUNTIME_ACTIONS\b/g;
5296
+ // Completion detection is permissive about fenced JSON, but the protocol
5297
+ // marker itself must still be the only content on its line.
5298
+ const markerRe = /(^|\r?\n)[ \t]*AMASTER_RUNTIME_ACTIONS[ \t]*(?:\r?\n|$)/g;
5294
5299
  let match;
5295
5300
  while ((match = markerRe.exec(source)) !== null) {
5296
5301
  let cursor = markerRe.lastIndex;
@@ -6116,8 +6121,13 @@ function runtimeActionReviewConfirmation(action, runtimeAuth, command, actionCon
6116
6121
  payload: {
6117
6122
  version: 1,
6118
6123
  prompt: copy.prompt,
6119
- acceptLabel: "确认,继续推进",
6120
- rejectLabel: "需要修订",
6124
+ resolutionMode: "review",
6125
+ acceptLabel: "接受并继续",
6126
+ requestChangesLabel: "退回修改",
6127
+ requestChangesReasonLabel: "说明需要补充或修改的内容",
6128
+ rejectLabel: "拒绝并停止",
6129
+ rejectRequiresReason: true,
6130
+ rejectReasonLabel: "说明停止该任务的原因",
6121
6131
  detailsMarkdown,
6122
6132
  target: {
6123
6133
  type: "custom",
@@ -6599,9 +6609,14 @@ function normalizeRequestConfirmationPayload(payload, action) {
6599
6609
  return {
6600
6610
  version: normalized.version === 1 ? normalized.version : 1,
6601
6611
  prompt,
6612
+ ...(readString(normalized.resolutionMode) === "review" ? { resolutionMode: "review" } : {}),
6602
6613
  ...(readString(normalized.acceptLabel) ?? readString(action.acceptLabel)
6603
6614
  ? { acceptLabel: readString(normalized.acceptLabel) ?? readString(action.acceptLabel) }
6604
6615
  : {}),
6616
+ ...(readString(normalized.requestChangesLabel) ? { requestChangesLabel: readString(normalized.requestChangesLabel) } : {}),
6617
+ ...(readString(normalized.requestChangesReasonLabel)
6618
+ ? { requestChangesReasonLabel: readString(normalized.requestChangesReasonLabel) }
6619
+ : {}),
6605
6620
  ...(readString(normalized.rejectLabel) ?? readString(action.rejectLabel)
6606
6621
  ? { rejectLabel: readString(normalized.rejectLabel) ?? readString(action.rejectLabel) }
6607
6622
  : {}),
@@ -5,7 +5,7 @@ import { dirname, join, resolve } from "node:path";
5
5
  import { homedir, hostname } from "node:os";
6
6
  import { fileURLToPath } from "node:url";
7
7
 
8
- const CONNECTOR_VERSION = "0.1.0-beta.2";
8
+ const CONNECTOR_VERSION = "0.1.0-beta.3";
9
9
 
10
10
  const CAPABILITIES = [
11
11
  "remote_registration",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amaster.ai/employee-runtime-connector",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0-beta.3",
4
4
  "description": "AMaster Employee runtime connector CLI and daemon",
5
5
  "license": "MIT",
6
6
  "type": "module",