@zq-silk/yui 2.22.0 → 2.25.0

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.
Files changed (89) hide show
  1. package/README.md +9 -4
  2. package/dist/artifacts/artifactCapability.js +6 -6
  3. package/dist/artifacts/gitArtifactRef.js +10 -10
  4. package/dist/artifacts/jobArtifact.js +5 -5
  5. package/dist/artifacts/managedGit.js +15 -12
  6. package/dist/artifacts/taskArtifactRepository.js +35 -33
  7. package/dist/cli/commandCatalog.js +2 -2
  8. package/dist/cli/updateCommand.js +20 -3
  9. package/dist/cli/updateOrchestrator.js +13 -0
  10. package/dist/cli/updatePorts.js +27 -0
  11. package/dist/cli.js +9 -2
  12. package/dist/commands/configCommands.js +64 -1
  13. package/dist/commands/projectCommands.js +9 -9
  14. package/dist/commands/taskCompletionGate.js +1 -1
  15. package/dist/commands/taskIntegrationCommands.js +1 -1
  16. package/dist/commands/taskPublicationAdoptCommand.js +1 -1
  17. package/dist/commands/taskRoleRuntimeStatus.js +4 -0
  18. package/dist/commands/taskUpstreamCommands.js +1 -1
  19. package/dist/config/configCatalog.js +3 -0
  20. package/dist/config/gitConfig.js +20 -0
  21. package/dist/config/yuiConfig.js +1 -0
  22. package/dist/context/currentSkills.js +32 -1
  23. package/dist/context/sessionBootstrapManifest.js +17 -4
  24. package/dist/context/sessionSkillNotice.js +33 -12
  25. package/dist/controlPlaneCli.js +4 -4
  26. package/dist/controller/clientRuntime.js +37 -18
  27. package/dist/controller/controller.js +16 -1
  28. package/dist/controller/fileSchedulerStoreAdapter.js +2 -0
  29. package/dist/controller/hostLifecycle.js +153 -0
  30. package/dist/controller/hostLifecycleChecks.js +27 -0
  31. package/dist/controller/hostUpgrade.js +344 -0
  32. package/dist/controller/jobArtifactControl.js +3 -3
  33. package/dist/controller/jobDefinitionControl.js +1 -1
  34. package/dist/controller/runtime.js +67 -16
  35. package/dist/controller/sessionNotify.js +5 -46
  36. package/dist/execution/codexThreadNaming.js +54 -43
  37. package/dist/executor/fileRoleLaunchPlanner.js +18 -3
  38. package/dist/integration/gitIntegrationService.js +1 -1
  39. package/dist/kernel/builtinCapabilities.js +3 -3
  40. package/dist/repository/gitCommand.js +153 -0
  41. package/dist/repository/gitCompatibility.js +3 -2
  42. package/dist/repository/gitWorkspace.js +579 -563
  43. package/dist/repository/gitWorktreeInventory.js +15 -19
  44. package/dist/repository/projectRefresh.js +1 -1
  45. package/dist/repository/taskBaseFreshness.js +1 -4
  46. package/dist/repository/taskWorkspacePreparer.js +1 -1
  47. package/dist/runtime/agentEndpoint.js +11 -1
  48. package/dist/runtime/agentEndpointIdentity.js +2 -0
  49. package/dist/runtime/agentHost.js +167 -42
  50. package/dist/runtime/agentHostImplementation.js +3 -1
  51. package/dist/runtime/codexAppServerRuntime.js +3 -0
  52. package/dist/runtime/codexInteractiveHost.js +62 -17
  53. package/dist/runtime/codexNativeAccess.js +1 -1
  54. package/dist/runtime/contextRecovery.js +15 -0
  55. package/dist/runtime/hostSessionLifecycle.js +83 -0
  56. package/dist/runtime/hostUpgradeGate.js +43 -0
  57. package/dist/runtime/lifecycleChecks.js +47 -0
  58. package/dist/runtime/lifecycleReservation.js +9 -1
  59. package/dist/runtime/nativeExecutable.js +5 -2
  60. package/dist/runtime/nativeTitleReceipt.js +31 -0
  61. package/dist/runtime/nativeTitleSync.js +192 -0
  62. package/dist/runtime/platform.js +11 -0
  63. package/dist/runtime/providerRetry.js +4 -4
  64. package/dist/runtime/structuredProviderHost.js +42 -10
  65. package/dist/storage/sqliteSchema.js +30 -0
  66. package/dist/storage/storageVersions.js +1 -1
  67. package/dist/storage/taskStore.js +7 -1
  68. package/dist/web/webConversation.js +2 -2
  69. package/dist/web/webMaterials.js +19 -19
  70. package/dist/web/webTaskSurface.js +3 -3
  71. package/dist/workspace/workItemChangeSetManager.js +3 -3
  72. package/docs/managed-turn-and-session-runtime.md +96 -1
  73. package/docs/managed-turn-and-session-runtime.zh-CN.md +70 -1
  74. package/docs/project-refresh.md +3 -2
  75. package/docs/project-refresh.zh-CN.md +2 -1
  76. package/docs/release-workflow.md +86 -2
  77. package/docs/release-workflow.zh-CN.md +65 -1
  78. package/docs/roles-and-configuration.md +34 -0
  79. package/docs/roles-and-configuration.zh-CN.md +27 -0
  80. package/docs/storage-baseline.md +14 -1
  81. package/docs/storage-baseline.zh-CN.md +7 -1
  82. package/docs/testing/verification-levels.md +7 -7
  83. package/docs/testing/verification-levels.zh-CN.md +6 -6
  84. package/i18n/README.zh-CN.md +8 -4
  85. package/package.json +1 -1
  86. package/skills/yui-runtime/SKILL.md +7 -2
  87. package/skills/yui-runtime/VERSION +1 -1
  88. package/dist/runtime/native/darwin-x64/claude-process-owner +0 -0
  89. package/dist/runtime/native/darwin-x64/process-identity +0 -0
@@ -1,16 +1,12 @@
1
- import { execFile } from "node:child_process";
2
1
  import { lstat, readFile, readdir, realpath } from "node:fs/promises";
3
2
  import { basename, dirname, join, resolve } from "node:path";
4
- import { promisify } from "node:util";
5
3
  import { gitOutputLine, supportedGit } from "./gitCompatibility.js";
6
- const execute = promisify(execFile);
7
- async function run(args) {
8
- return (await execute(supportedGit().path, args, {
9
- encoding: "utf8", timeout: 10_000, maxBuffer: 1024 * 1024
10
- })).stdout;
4
+ import { executeGitCommand } from "./gitCommand.js";
5
+ async function run(args, budget) {
6
+ return (await executeGitCommand(supportedGit(budget?.totalMs).path, args, { budget })).stdout.toString("utf8");
11
7
  }
12
- export async function gitPath(cwd, args) {
13
- return resolve(cwd, gitOutputLine(await run(["-C", cwd, "rev-parse", ...args])));
8
+ export async function gitPath(cwd, args, budget) {
9
+ return resolve(cwd, gitOutputLine(await run(["-C", cwd, "rev-parse", ...args], budget)));
14
10
  }
15
11
  async function exists(path) {
16
12
  try {
@@ -29,13 +25,13 @@ async function exists(path) {
29
25
  * never write/prune them, and never infer ownership merely from a directory.
30
26
  * Mutating consumers still check the recorded owner and ask Git to remove it.
31
27
  */
32
- export async function readGitWorktrees(cwd) {
33
- const common = await realpath(await gitPath(cwd, ["--git-common-dir"]));
28
+ export async function readGitWorktrees(cwd, budget) {
29
+ const common = await realpath(await gitPath(cwd, ["--git-common-dir"], budget));
34
30
  const result = [];
35
31
  // This is also Git's own main-worktree listing convention (including bare
36
32
  // and separate-git-dir repositories), not a claim of managed ownership.
37
33
  const main = basename(common) === ".git" ? dirname(common) : common;
38
- result.push(await inspect(common, main, false));
34
+ result.push(await inspect(common, main, false, budget));
39
35
  const directory = join(common, "worktrees");
40
36
  let entries;
41
37
  try {
@@ -59,27 +55,27 @@ export async function readGitWorktrees(cwd) {
59
55
  const path = dirname(resolve(admin, pointer));
60
56
  const adminCommon = await realpath(resolve(cwd, gitOutputLine(await run([
61
57
  "-C", cwd, `--git-dir=${admin}`, "rev-parse", "--git-common-dir"
62
- ]))));
58
+ ], budget))));
63
59
  if (adminCommon !== common)
64
60
  throw new Error(`Git worktree common directory mismatch: ${admin}; retained.`);
65
61
  if (await exists(path)) {
66
- const actual = await realpath(await gitPath(path, ["--git-dir"]));
62
+ const actual = await realpath(await gitPath(path, ["--git-dir"], budget));
67
63
  if (actual !== admin)
68
64
  throw new Error(`Git worktree back-pointer mismatch: ${path}; retained.`);
69
65
  }
70
- result.push(await inspect(admin, path, true));
66
+ result.push(await inspect(admin, path, true, budget));
71
67
  }
72
68
  if (new Set(result.map(entry => entry.path)).size !== result.length) {
73
69
  throw new Error("Duplicate Git worktree registrations; retained.");
74
70
  }
75
71
  return result;
76
72
  }
77
- async function inspect(admin, path, linked) {
73
+ async function inspect(admin, path, linked, budget) {
78
74
  // Ask Git rather than parsing HEAD: Git owns ref storage (including newer
79
75
  // backends), symbolic resolution and per-worktree pseudorefs.
80
76
  let branch;
81
77
  try {
82
- branch = gitOutputLine(await run([`--git-dir=${admin}`, "symbolic-ref", "--quiet", "HEAD"]));
78
+ branch = gitOutputLine(await run([`--git-dir=${admin}`, "symbolic-ref", "--quiet", "HEAD"], budget));
83
79
  }
84
80
  catch (error) {
85
81
  if (error.code !== 1)
@@ -90,7 +86,7 @@ async function inspect(admin, path, linked) {
90
86
  }
91
87
  let head;
92
88
  try {
93
- head = gitOutputLine(await run([`--git-dir=${admin}`, "rev-parse", "--verify", "HEAD"]));
89
+ head = gitOutputLine(await run([`--git-dir=${admin}`, "rev-parse", "--verify", "HEAD"], budget));
94
90
  if (!/^[a-f0-9]{40}(?:[a-f0-9]{24})?$/iu.test(head))
95
91
  throw new Error("Invalid Git HEAD");
96
92
  }
@@ -99,7 +95,7 @@ async function inspect(admin, path, linked) {
99
95
  if (branch === undefined)
100
96
  throw error;
101
97
  try {
102
- await run([`--git-dir=${admin}`, "show-ref", "--verify", "--quiet", branch]);
98
+ await run([`--git-dir=${admin}`, "show-ref", "--verify", "--quiet", branch], budget);
103
99
  }
104
100
  catch (missing) {
105
101
  if (missing.code === 1) {
@@ -41,7 +41,7 @@ export async function refreshRegisteredProject(store, id, options = {}) {
41
41
  try {
42
42
  const current = check();
43
43
  options.beforeRefresh?.();
44
- const refreshed = await (options.git ?? new NodeGitWorkspace()).refresh({
44
+ const refreshed = await (options.git ?? new NodeGitWorkspace(() => store.getConfig())).refresh({
45
45
  repositoryPath: current.path, remoteUrl: current.remoteUrl, stableRef: current.stableBranch
46
46
  });
47
47
  return { project: current, ...refreshed };
@@ -59,7 +59,7 @@ export function recordTaskBaseProvenanceEvents(tx, taskId, provenance, now) {
59
59
  }
60
60
  export async function inspectTaskBaseFreshness(taskId, store, options = {}) {
61
61
  const task = requireTask(store, taskId);
62
- const git = options.git ?? newGitWorkspace();
62
+ const git = options.git ?? new NodeGitWorkspace(() => store.getConfig());
63
63
  const workspace = store.getTaskWorkspace(taskId);
64
64
  // Collect active AgentRun workspace snapshots once so every Project entry can
65
65
  // report whether a live AgentRun is pinned to a different commit.
@@ -169,9 +169,6 @@ export function renderTaskBaseFreshnessReport(report) {
169
169
  }
170
170
  return lines.join("\n").concat("\n");
171
171
  }
172
- function newGitWorkspace() {
173
- return new NodeGitWorkspace();
174
- }
175
172
  function requireTask(store, taskId) {
176
173
  const task = store.getTask(taskId);
177
174
  if (task === null)
@@ -67,7 +67,7 @@ export class FileTaskWorkspacePreparer {
67
67
  git;
68
68
  now;
69
69
  maintenanceLockOptions;
70
- constructor(home, store, git = new NodeGitWorkspace(), now = () => new Date(), maintenanceLockOptions = {}) {
70
+ constructor(home, store, git = new NodeGitWorkspace(() => store.getConfig()), now = () => new Date(), maintenanceLockOptions = {}) {
71
71
  this.home = home;
72
72
  this.store = store;
73
73
  this.git = git;
@@ -1,3 +1,4 @@
1
+ import { isDeepStrictEqual } from "node:util";
1
2
  import { builtinAgentEndpointImplementation, requireBuiltinAgentEndpointImplementation } from "./agentEndpointIdentity.js";
2
3
  import { builtinAgentDriverRegistry } from "./builtinAgentDrivers.js";
3
4
  import { CodexPreSubmissionError } from "./codexAppServerRuntime.js";
@@ -80,6 +81,12 @@ function freezeConfiguration(value) {
80
81
  class BuiltinAgentEndpoint {
81
82
  driver;
82
83
  configuration;
84
+ get contextEpoch() { return this.driver.contextEpoch; }
85
+ async checkQuiescent() {
86
+ if (!this.driver.checkQuiescent)
87
+ throw new Error("This native Endpoint cannot prove background quiescence.");
88
+ return this.driver.checkQuiescent();
89
+ }
83
90
  get nativeAccess() { return this.driver.nativeAccess; }
84
91
  get appliedGeneratedTitle() { return this.driver.appliedGeneratedTitle; }
85
92
  get ownedProcessId() { return this.driver.ownedProcessId; }
@@ -147,6 +154,7 @@ class BuiltinAgentEndpoint {
147
154
  const previous = this.#attempts.get(input.attemptId);
148
155
  if (previous !== undefined) {
149
156
  if (previous.input.inputRef !== input.inputRef || previous.input.boundedText !== input.boundedText
157
+ || !isDeepStrictEqual(previous.input.additionalContext, input.additionalContext)
150
158
  || previous.operation !== operation) {
151
159
  throw new Error("Endpoint attempt identity cannot be reused for different input or operation.");
152
160
  }
@@ -160,7 +168,9 @@ class BuiltinAgentEndpoint {
160
168
  return { status: "not-submitted", error: new ProviderTurnRejectedError("Endpoint is detached.", input.attemptId) };
161
169
  }
162
170
  const attempt = {
163
- input: Object.freeze({ ...input }),
171
+ input: Object.freeze({ ...input, ...(input.additionalContext === undefined ? {} : {
172
+ additionalContext: structuredClone(input.additionalContext)
173
+ }) }),
164
174
  operation,
165
175
  disposition: { status: "pending", reason: "submitting" }
166
176
  };
@@ -35,6 +35,8 @@ const ENDPOINT_CHECKOUT_MODULES = Object.freeze([
35
35
  "acpProtocol.js",
36
36
  "acpSessionConfiguration.js",
37
37
  "agentRunConfiguration.js",
38
+ "contextRecovery.js",
39
+ "codexNativeAccess.js",
38
40
  "jsonLineChannel.js"
39
41
  ]);
40
42
  function resolveEndpointGeneration() {