@amaster.ai/employee-runtime-connector 0.1.0-beta.16 → 0.1.0-beta.17

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.
@@ -2359,7 +2359,7 @@ import { homedir, hostname } from "node:os";
2359
2359
  import { basename, delimiter, dirname, extname, isAbsolute, join, relative, resolve } from "node:path";
2360
2360
  import { spawn, spawnSync } from "node:child_process";
2361
2361
  import { StringDecoder } from "node:string_decoder";
2362
- const CONNECTOR_VERSION = "0.1.0-beta.16";
2362
+ const CONNECTOR_VERSION = "0.1.0-beta.17";
2363
2363
  const MAX_INFERRED_ARTIFACT_UPLOADS = 20;
2364
2364
  const MAX_CHECKPOINT_BYTES = 20 * 1024 * 1024;
2365
2365
  const CHECKPOINT_TTL_MS = 24 * 60 * 60 * 1000;
@@ -3483,6 +3483,52 @@ function commandLegacyTaskDecompositionRequirement(command) {
3483
3483
  return legacyTaskDecompositionRequirement(asRecord(payload.contextSnapshot));
3484
3484
  }
3485
3485
 
3486
+ const TASK_DECOMPOSITION_MODES = new Set(["none", "required", "suggest_only"]);
3487
+ const TASK_DECOMPOSITION_SOURCE_TYPES = new Set([
3488
+ "system_default",
3489
+ "system_migration",
3490
+ "operator",
3491
+ "api",
3492
+ "accepted_plan",
3493
+ "workflow",
3494
+ ]);
3495
+
3496
+ function commandTaskDecompositionRequirement(command) {
3497
+ const payload = asRecord(command.payload);
3498
+ const context = asRecord(payload.contextSnapshot);
3499
+ const envelope = asRecord(context.authorizationEnvelope);
3500
+ const authority = readString(envelope.decompositionRequirementAuthority) ?? "shadow";
3501
+ if (authority === "shadow") return commandLegacyTaskDecompositionRequirement(command);
3502
+ if (authority !== "enforce") {
3503
+ throw new Error(`Invalid typed decomposition requirement authority ${authority}`);
3504
+ }
3505
+ const requirement = asRecord(envelope.decompositionRequirement);
3506
+ const source = asRecord(requirement.source);
3507
+ const mode = readString(requirement.mode);
3508
+ const sourceType = readString(source.type);
3509
+ const sourceId = readString(source.id);
3510
+ const sourceRevision = readString(source.revision);
3511
+ const requirementKeys = Object.keys(requirement).sort().join(",");
3512
+ const sourceKeys = Object.keys(source).sort().join(",");
3513
+ if (
3514
+ !TASK_DECOMPOSITION_MODES.has(mode)
3515
+ || !TASK_DECOMPOSITION_SOURCE_TYPES.has(sourceType)
3516
+ || !sourceId
3517
+ || !sourceRevision
3518
+ || requirementKeys !== "mode,source"
3519
+ || sourceKeys !== "id,revision,type"
3520
+ ) {
3521
+ throw new Error("Candidate command requires one strict typed decomposition requirement");
3522
+ }
3523
+ return {
3524
+ required: mode === "required",
3525
+ suggested: mode === "suggest_only",
3526
+ authorityMode: "enforce",
3527
+ source: "typed_task_requirement",
3528
+ sourceRef: { type: sourceType, id: sourceId, revision: sourceRevision, mode },
3529
+ };
3530
+ }
3531
+
3486
3532
  function normalizeAgentInstructionsFiles(bundle) {
3487
3533
  const files = asRecord(bundle.files);
3488
3534
  const selected = [];
@@ -3599,6 +3645,9 @@ function runtimeActionsInstruction(options = {}) {
3599
3645
  options.explicitDecompositionRequired
3600
3646
  ? "This standard task explicitly requires child task decomposition. The runtime action batch must include create_child_task or one suggest_tasks interaction unless child tasks already exist. A checklist in a comment or artifact is not decomposition. Create independently executable internal preparation tasks now. Use backlog for recorded work that should not start now, and use suggest_tasks for work that must wait for human approval. When a pending interaction is created, keep the parent in_review rather than in_progress or done."
3601
3647
  : "",
3648
+ options.decompositionSuggested
3649
+ ? "The typed task requirement suggests child task decomposition without making it a hard gate. Prefer create_child_task or suggest_tasks when decomposition materially helps; other valid mutations remain allowed."
3650
+ : "",
3602
3651
  options.canOrchestrateOrganization
3603
3652
  ? "Pending-interaction batch gate: before emitting JSON, scan every agent_hire and create_child_task. Every co-batched hire must independently set executeBeforeConfirmation true; every create_child_task must independently be backlog, set executeBeforeConfirmation true, or move into suggest_tasks. blockParentUntilDone=false and a flagged assignee hire do not exempt a child. Otherwise move the hires to a later continuation and use suggest_tasks for work that must wait for acceptance. This applies to every pending interaction, including budget or business approval."
3604
3653
  : "Pending-interaction batch gate: before emitting JSON, scan every create_child_task. Every create_child_task must independently be backlog, set executeBeforeConfirmation true, or move into suggest_tasks. blockParentUntilDone=false does not exempt a child. Use suggest_tasks for work that must wait for acceptance.",
@@ -3933,9 +3982,11 @@ function buildCommandPrompt(command, workspace, materializedAttachments = [], op
3933
3982
  const authorizationEnvelope = runtimeActionAuthorizationEnvelope(command);
3934
3983
  const canOrchestrateOrganization = canRuntimeAgentOrchestrateOrganization(context)
3935
3984
  && authorizationEnvelope.allowedActionClasses.has("organization_mutation");
3936
- const decompositionRequirement = commandLegacyTaskDecompositionRequirement(command);
3985
+ const decompositionRequirement = commandTaskDecompositionRequirement(command);
3937
3986
  const explicitDecompositionRequired = decompositionRequirement.required
3938
3987
  && runtimeActionChildIssueSummaryEntries(command).length === 0;
3988
+ const decompositionSuggested = decompositionRequirement.suggested === true
3989
+ && runtimeActionChildIssueSummaryEntries(command).length === 0;
3939
3990
  const executingAgent = asRecord(context.paperclipExecutingAgent);
3940
3991
  const currentAgentAdapterType = readString(executingAgent.adapterType);
3941
3992
  const validatorContentTypes = runtimeAttachmentContentTypes(command);
@@ -3968,6 +4019,7 @@ function buildCommandPrompt(command, workspace, materializedAttachments = [], op
3968
4019
  canOrchestrateOrganization,
3969
4020
  currentAgentAdapterType,
3970
4021
  explicitDecompositionRequired,
4022
+ decompositionSuggested,
3971
4023
  artifactVerifierCommands: options.artifactVerifierCommands,
3972
4024
  actionValidatorCommand,
3973
4025
  authorizationEnvelope,
@@ -7724,7 +7776,7 @@ function assertDelegatedParentWaitDisposition(actions) {
7724
7776
  }
7725
7777
 
7726
7778
  function assertExplicitTaskDecomposition(command, actions) {
7727
- const requirement = commandLegacyTaskDecompositionRequirement(command);
7779
+ const requirement = commandTaskDecompositionRequirement(command);
7728
7780
  if (!requirement.required) return;
7729
7781
  if (runtimeActionChildIssueSummaryEntries(command).length > 0) return;
7730
7782
  const hasDecompositionAction = actions.some((action) => {
@@ -7735,12 +7787,15 @@ function assertExplicitTaskDecomposition(command, actions) {
7735
7787
  });
7736
7788
  if (hasDecompositionAction) return;
7737
7789
  const error = new Error(
7738
- "task explicitly requires child task decomposition under the legacy text hard gate; emit create_child_task or suggest_tasks instead of only describing a checklist",
7790
+ requirement.authorityMode === "enforce"
7791
+ ? "task explicitly requires child task decomposition under the typed task requirement; emit create_child_task or suggest_tasks instead of only describing a checklist"
7792
+ : "task explicitly requires child task decomposition under the legacy text hard gate; emit create_child_task or suggest_tasks instead of only describing a checklist",
7739
7793
  );
7740
7794
  error.runtimeActionType = "decomposition";
7741
7795
  error.runtimeActionReason = error.message;
7742
7796
  error.runtimeActionDecompositionRequirementSource = requirement.source;
7743
7797
  error.runtimeActionDecompositionMatch = requirement.match;
7798
+ error.runtimeActionDecompositionSourceRef = requirement.sourceRef;
7744
7799
  throw error;
7745
7800
  }
7746
7801
 
@@ -9241,6 +9296,9 @@ function runtimeActionDiagnostics(err, options = {}) {
9241
9296
  ...(err?.runtimeActionDecompositionMatch
9242
9297
  ? { decompositionMatch: err.runtimeActionDecompositionMatch }
9243
9298
  : {}),
9299
+ ...(err?.runtimeActionDecompositionSourceRef
9300
+ ? { decompositionSourceRef: err.runtimeActionDecompositionSourceRef }
9301
+ : {}),
9244
9302
  ...(err?.runtimeActionInferenceTrace ? { inferenceTrace: err.runtimeActionInferenceTrace } : {}),
9245
9303
  ...(readString(err?.runtimeActionFieldPath) ? { fieldPath: readString(err.runtimeActionFieldPath) } : {}),
9246
9304
  ...(readString(err?.runtimeActionReceivedType) ? { receivedType: readString(err.runtimeActionReceivedType) } : {}),
@@ -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.16";
8
+ const CONNECTOR_VERSION = "0.1.0-beta.17";
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.16",
3
+ "version": "0.1.0-beta.17",
4
4
  "description": "AMaster Employee runtime connector CLI and daemon",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -15,6 +15,8 @@
15
15
  "scripts": {
16
16
  "build": "node scripts/build.mjs",
17
17
  "clean": "node scripts/clean.mjs",
18
+ "phase0b:live": "node probes/runtime-v2-phase0b/live-probe.mjs",
19
+ "phase0b:test": "node --test probes/runtime-v2-phase0b/*.test.mjs",
18
20
  "typecheck": "node --check scripts/build.mjs && node --check scripts/bundle.mjs && node --check src/amaster-runtime.mjs && node --check src/amaster-runtime-daemon.mjs",
19
21
  "test": "pnpm run build && node --test test/*.test.mjs src/amaster-runtime-daemon/*.test.mjs",
20
22
  "prepack": "pnpm run test"