@amaster.ai/employee-runtime-connector 0.1.0-beta.26 → 0.1.0-beta.28
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.
|
@@ -2208,6 +2208,13 @@ function isTerminalResultOutboxStatus(status) {
|
|
|
2208
2208
|
var DEFAULT_PROMPT_BUDGET_CHARS = 32e3;
|
|
2209
2209
|
var MIN_PROMPT_BUDGET_CHARS = 8192;
|
|
2210
2210
|
var CONTINUATION_WAKE_PATTERN = /(continuation|continued|retry|approved|liveness|resume|max_turn)/i;
|
|
2211
|
+
var RECOVERY_WAKE_REASONS = /* @__PURE__ */ new Set([
|
|
2212
|
+
"finish_successful_run_handoff",
|
|
2213
|
+
"source_scoped_recovery_action"
|
|
2214
|
+
]);
|
|
2215
|
+
function isRecoveryWakeReason(wakeReason) {
|
|
2216
|
+
return RECOVERY_WAKE_REASONS.has(wakeReason);
|
|
2217
|
+
}
|
|
2211
2218
|
function jsonText(value) {
|
|
2212
2219
|
return JSON.stringify(value, null, 2);
|
|
2213
2220
|
}
|
|
@@ -2223,7 +2230,7 @@ function estimatedTokens(chars) {
|
|
|
2223
2230
|
}
|
|
2224
2231
|
function contextMode(input) {
|
|
2225
2232
|
const nativeSession = asRecord(input.nativeSession);
|
|
2226
|
-
if (nativeSession.mode === "governed_action_approval" || readString(input.context?.resumeFromRunId) || CONTINUATION_WAKE_PATTERN.test(input.wakeReason ?? "")) return "continuation";
|
|
2233
|
+
if (nativeSession.mode === "governed_action_approval" || readString(input.context?.resumeFromRunId) || isRecoveryWakeReason(input.wakeReason) || CONTINUATION_WAKE_PATTERN.test(input.wakeReason ?? "")) return "continuation";
|
|
2227
2234
|
if (nativeSession.resume === true || Object.keys(asRecord(input.context?.paperclipContinuationSummary)).length > 0) {
|
|
2228
2235
|
return "warm";
|
|
2229
2236
|
}
|
|
@@ -2324,6 +2331,47 @@ function approvalContinuationText(input) {
|
|
|
2324
2331
|
"Do not advance to another write action until that exact call returns status succeeded."
|
|
2325
2332
|
].join("\n");
|
|
2326
2333
|
}
|
|
2334
|
+
function recoveryInstructionText(input) {
|
|
2335
|
+
const context = asRecord(input.context);
|
|
2336
|
+
if (input.wakeReason === "finish_successful_run_handoff" && context.handoffRequired === true) {
|
|
2337
|
+
return readString(context.instruction) ?? [
|
|
2338
|
+
"The prior successful run did not leave a terminal task disposition.",
|
|
2339
|
+
"Do not repeat the original source work or create or revise deliverables.",
|
|
2340
|
+
"Inspect the existing task and run evidence, then choose exactly one explicit disposition: done, in_review, input, blocked, delegated, or queued.",
|
|
2341
|
+
"Record the disposition with its concrete owner or next action and update the task accordingly."
|
|
2342
|
+
].join("\n");
|
|
2343
|
+
}
|
|
2344
|
+
if (input.wakeReason === "source_scoped_recovery_action") {
|
|
2345
|
+
return [
|
|
2346
|
+
"This is a status-only source recovery. Do not repeat the original source work or create or revise deliverables.",
|
|
2347
|
+
"Inspect the existing task and run evidence, then choose exactly one explicit disposition using task-governance actions:",
|
|
2348
|
+
"- done only when the existing evidence already satisfies acceptance;",
|
|
2349
|
+
"- in_review or input when a specific human review or answer is required;",
|
|
2350
|
+
"- blocked with a named unblock owner and action;",
|
|
2351
|
+
"- delegated or queued only with a concrete continuation path.",
|
|
2352
|
+
"Record the disposition in a comment and update the parent task accordingly."
|
|
2353
|
+
].join("\n");
|
|
2354
|
+
}
|
|
2355
|
+
return "";
|
|
2356
|
+
}
|
|
2357
|
+
function runtimeAuthorizationText(context) {
|
|
2358
|
+
const envelope = asRecord(context.authorizationEnvelope);
|
|
2359
|
+
const allowed = new Set(
|
|
2360
|
+
Array.isArray(envelope.allowedActionClasses) ? envelope.allowedActionClasses.filter((value) => typeof value === "string") : []
|
|
2361
|
+
);
|
|
2362
|
+
const optionIds = asRecord(envelope.authorizationOptionIds);
|
|
2363
|
+
const missing = Object.entries(optionIds).map(([authorizationClass, optionId]) => ({
|
|
2364
|
+
authorizationClass,
|
|
2365
|
+
optionId: readString(optionId)
|
|
2366
|
+
})).filter((entry) => entry.optionId && !allowed.has(entry.authorizationClass));
|
|
2367
|
+
if (missing.length === 0) return "";
|
|
2368
|
+
return [
|
|
2369
|
+
`Current allowed action classes: ${[...allowed].join(", ") || "task_governance"}.`,
|
|
2370
|
+
"If the task requires a missing runtime action class, create a request_checkbox_confirmation interaction using the exact option id below and wait for its accepted continuation:",
|
|
2371
|
+
...missing.map((entry) => `- ${entry.authorizationClass}: ${entry.optionId}`),
|
|
2372
|
+
"Never use request_confirmation to authorize a runtime action class."
|
|
2373
|
+
].join("\n");
|
|
2374
|
+
}
|
|
2327
2375
|
function sectionText(section) {
|
|
2328
2376
|
if (!section.content) return "";
|
|
2329
2377
|
return section.title ? `## ${section.title}
|
|
@@ -2400,7 +2448,9 @@ function compileCommandPromptWithManifest(input, options = {}) {
|
|
|
2400
2448
|
const snapshotFreshness = { kind: "run_snapshot" };
|
|
2401
2449
|
const rawSections = [
|
|
2402
2450
|
{ name: "runtime_rules", title: "", priority: 100, sourceRef: `command:${input.commandId}`, content: fixedRules(input, !hasTask) },
|
|
2451
|
+
{ name: "recovery_instruction", title: "Recovery Instruction", priority: 99, sourceRef: `run:${input.runId ?? "unknown"}`, content: recoveryInstructionText(input), truncationReason: isRecoveryWakeReason(input.wakeReason) ? null : "mode_selection" },
|
|
2403
2452
|
{ name: "approval_continuation", title: "Approved Runtime Action Continuation", priority: 99, sourceRef: `run:${input.runId ?? "unknown"}`, content: approvalContinuationText(input), truncationReason: mode === "continuation" ? null : "mode_selection" },
|
|
2453
|
+
{ name: "runtime_authorization", title: "Runtime Action Authorization", priority: 98, sourceRef: `run:${input.runId ?? "unknown"}`, content: runtimeAuthorizationText(context) },
|
|
2404
2454
|
{ name: "continuation_summary", title: "Continuation Summary", priority: 97, sourceRef: readString(asRecord(context.paperclipContinuationSummary).key) ?? `issue:${input.issueId ?? "unknown"}`, observedAt: readString(asRecord(context.paperclipContinuationSummary).updatedAt), originalContent: continuationSummary, content: mode === "cold" ? "" : continuationSummary, truncationReason: mode === "cold" ? "mode_selection" : null },
|
|
2405
2455
|
{ name: "wake_comments", title: "Wake Comment Delta", priority: 95, sourceRef: commentRefs(context).map((id) => `comment:${id}`), originalContent: readString(input.comments) ?? "", content: commentsSelected ? readString(input.comments) ?? "" : "", truncationReason: commentsSelected ? null : "duplicate_task_context" },
|
|
2406
2456
|
{ name: "task", title: "Task Context", priority: 90, sourceRef: `issue:${input.issueId ?? "unknown"}`, originalContent: taskText, content: includeTask ? taskText : "", truncationReason: includeTask ? null : "mode_selection" },
|
|
@@ -4700,7 +4750,7 @@ function readWorkspaceStatus(cwd, opts = {}) {
|
|
|
4700
4750
|
}
|
|
4701
4751
|
|
|
4702
4752
|
// src/amaster-runtime-daemon.mjs
|
|
4703
|
-
var CONNECTOR_VERSION = "0.1.0-beta.
|
|
4753
|
+
var CONNECTOR_VERSION = "0.1.0-beta.28";
|
|
4704
4754
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
4705
4755
|
var MAX_CHECKPOINT_BYTES = 20 * 1024 * 1024;
|
|
4706
4756
|
var CHECKPOINT_TTL_MS = 24 * 60 * 60 * 1e3;
|
package/dist/amaster-runtime.mjs
CHANGED
|
@@ -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.
|
|
8
|
+
const CONNECTOR_VERSION = "0.1.0-beta.28";
|
|
9
9
|
|
|
10
10
|
const CAPABILITIES = [
|
|
11
11
|
"remote_registration",
|