@zq-silk/yui 0.12.3 → 0.12.4

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.
@@ -784,8 +784,8 @@ const taskChildren = [
784
784
  {
785
785
  name: "retire",
786
786
  summary: "Retire an incorrect historical Agent Run without deleting its audit record.",
787
- usage: "yui task run retire <task>/<run> --reason <text>",
788
- options: ["--reason"]
787
+ usage: "yui task run retire <task>/<run> --reason <text> [--expected-progress-at <timestamp>] [--agent-id <id>] [--adapter-id <id>] [--native-session-id <id>] [--launch-id <id>]",
788
+ options: ["--reason", "--expected-progress-at", "--progress-at", "--agent-id", "--adapter-id", "--native-session-id", "--launch-id"]
789
789
  }
790
790
  ]
791
791
  },
@@ -1,7 +1,7 @@
1
1
  import { usageError } from "../errors/cliError.js";
2
2
  import { ensureFileTaskController } from "../controller/clientRuntime.js";
3
3
  import { acknowledgeDurableJob, cancelDurableJob, getDurableJob, startDurableJob } from "../controller/jobClient.js";
4
- import { resolveJobCaller, taskActor } from "./taskActor.js";
4
+ import { resolveJobCaller, taskLocalActor } from "./taskActor.js";
5
5
  /**
6
6
  * The textual `--owner` forms accepted by `job start`. The public help text in
7
7
  * the command catalog must document exactly these forms.
@@ -102,14 +102,14 @@ async function acknowledgeJob(args, options) {
102
102
  // rr5/f5(a): only the Task Leader may acknowledge an
103
103
  // unknown-needs-attention job. A non-Leader (Worker, Operator, or plain
104
104
  // user) is rejected at the CLI boundary.
105
- const actor = taskActor(options.environment, ref.taskId);
105
+ if (options.store === undefined) {
106
+ throw usageError("job acknowledge requires a Task store to resolve the Leader assertion.");
107
+ }
108
+ const actor = taskLocalActor(options.store, options.environment, ref.taskId, options.home);
106
109
  if (actor !== "leader") {
107
110
  throw usageError("Only the Task Leader may acknowledge a DurableJob: "
108
111
  + `${ref.taskId}.`);
109
112
  }
110
- if (options.store === undefined) {
111
- throw usageError("job acknowledge requires a Task store to resolve the Leader assertion.");
112
- }
113
113
  // Carry the full managed task caller, including its ephemeral launch key.
114
114
  // A durable leaderAssertion by itself is intentionally not sufficient.
115
115
  const caller = resolveJobCaller(options.environment, ref.taskId, options.store);
@@ -30,6 +30,24 @@ export function taskActor(environment, taskId) {
30
30
  }
31
31
  return "user";
32
32
  }
33
+ /**
34
+ * Resolve authority for a recoverable Task-local mutation. A managed Leader
35
+ * does not gain that authority from long-lived process environment alone: the
36
+ * command must carry the exact current Turn assertion and it must still match
37
+ * the durable active Run, receipt, Role binding, native Session, and Home.
38
+ * Plain-user and global-Operator behavior remains unchanged.
39
+ */
40
+ export function taskLocalActor(store, environment, taskId, yuiHome) {
41
+ const actor = taskActor(environment, taskId);
42
+ if (actor !== "leader")
43
+ return actor;
44
+ const assertion = leaderActionAssertion(environment ?? {});
45
+ if (assertion === undefined || assertion === "invalid"
46
+ || taskLeaderActionRunId(store, taskId, environment, yuiHome) === undefined) {
47
+ throw usageError(`Task-local Leader authority requires the exact current-Turn assertion: ${taskId}.`);
48
+ }
49
+ return actor;
50
+ }
33
51
  export function projectActor(environment) {
34
52
  const env = environment ?? {};
35
53
  if (env.YUI_SESSION_SCOPE === "task")