@nowcrew/daemon 0.6.3 → 0.6.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.
@@ -208,6 +208,16 @@ const verifyCache = async (agentsRoot, ability) => {
208
208
  };
209
209
  const layerRelativePath = (path, layer) => path.startsWith(`${layer}/`) ? path.slice(layer.length + 1) : path;
210
210
  const readManagedCatalog = async (trainingRoot) => JSON.parse(await readFile(join(trainingRoot, "ACTIVE_RELEASE.json"), "utf8"));
211
+ const activeTrainingRoot = async (agentsRoot, handle, ability) => {
212
+ const trainingRoot = join(agentsRoot, handle, "training");
213
+ const catalog = await readManagedCatalog(trainingRoot).catch(() => null);
214
+ return catalog?.managedBy === "nowcrew-agent-training"
215
+ && catalog.releaseId === ability.releaseId
216
+ && catalog.rootCommit === ability.rootCommit
217
+ && catalog.artifactDigest === ability.artifactDigest
218
+ ? trainingRoot
219
+ : null;
220
+ };
211
221
  const materializeWorkspaceTraining = async (agentsRoot, handle, ability) => {
212
222
  let verified;
213
223
  try {
@@ -378,7 +388,16 @@ export function createAgentAbilityMaterializer(expectedAgentsRoot, coordinator =
378
388
  return coordinator.runExclusiveUntil(expectedAgentsRoot, handle, async () => {
379
389
  const started = Date.now();
380
390
  try {
381
- const trainingRoot = await apply(agentsRoot, handle, ability).then(() => join(agentsRoot, handle, "training"));
391
+ const existingTrainingRoot = await activeTrainingRoot(agentsRoot, handle, ability);
392
+ let trainingRoot;
393
+ if (existingTrainingRoot !== null) {
394
+ trainingRoot = existingTrainingRoot;
395
+ await projectWorkspaceTraining(agentsRoot, handle, ability, existingTrainingRoot);
396
+ }
397
+ else {
398
+ await apply(agentsRoot, handle, ability);
399
+ trainingRoot = join(agentsRoot, handle, "training");
400
+ }
382
401
  const context = await loadAgentAbilityRuntimeContext(join(agentsRoot, handle), trainingRoot, ability);
383
402
  dslog("ability.execution.materialized", "Agent ability release materialized", {
384
403
  level: "INFO", agent_handle: handle, release_id: ability.releaseId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nowcrew/daemon",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "type": "module",
5
5
  "description": "crew daemon — 运行在用户机器:拉起/管理 agent 进程,注入 crew CLI,归一化 runtime 事件",
6
6
  "license": "Apache-2.0",