@agentconnect.md/daemon 2.4.0-rc.15 → 2.4.0-rc.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.
package/dist/release.json CHANGED
@@ -1 +1 @@
1
- {"runtimeSandboxImage":"ghcr.io/agentconnect-md/runtime-sandbox-full:v2.4.0-rc.15"}
1
+ {"runtimeSandboxImage":"ghcr.io/agentconnect-md/runtime-sandbox-full:v2.4.0-rc.17"}
@@ -46944,6 +46944,25 @@ async function bundleIdentity(root, bundle) {
46944
46944
  async function skillBundleReceiptIntact(cwd, bundle) {
46945
46945
  return await bundleIdentity(join(cwd, ...bundle.relativeRoot.split("/")), bundle) !== null;
46946
46946
  }
46947
+ /** Whether the workspace's ready ledger published exactly `roots` under this plan fingerprint, all still intact on disk. */
46948
+ async function publishedSkillSetUnchanged(options) {
46949
+ const receipt = (bundle) => JSON.stringify([
46950
+ bundle.relativeRoot,
46951
+ bundle.sourceKey,
46952
+ bundle.treeDigest,
46953
+ bundle.files
46954
+ ]);
46955
+ const set = (bundles) => JSON.stringify(bundles.map(receipt).sort());
46956
+ try {
46957
+ return await withSkillWorkspaceLock(options.cwd, async () => {
46958
+ const location = await skillLedgerLocation(options.cwd, options.stateDir);
46959
+ const ledger = await readSkillLedger(location);
46960
+ return ledger?.phase === "ready" && !ledger.cleanup && ledger.agentId === options.agentId && ledger.runtime === options.runtime && ledger.cliVersion === options.cliVersion && ledger.fingerprint === options.fingerprint && set(ledger.owned) === set(options.roots) && await installedBundlesIntact(options.cwd, ledger.owned, location.workspaceIdentity);
46961
+ }, options.stateDir);
46962
+ } catch {
46963
+ return false;
46964
+ }
46965
+ }
46947
46966
  function treeDigest(files) {
46948
46967
  return createHash("sha256").update(JSON.stringify(files)).digest("hex");
46949
46968
  }
@@ -55560,6 +55579,7 @@ var ClusterSkillHandler = class {
55560
55579
  deps;
55561
55580
  operations = /* @__PURE__ */ new Map();
55562
55581
  highestTerms = /* @__PURE__ */ new Map();
55582
+ published;
55563
55583
  inactiveMs;
55564
55584
  now;
55565
55585
  constructor(deps) {
@@ -55741,8 +55761,21 @@ var ClusterSkillHandler = class {
55741
55761
  const gitStaging = (sourceId) => join(this.deps.stagingRoot, input.handle, sourceDirectory(sourceId));
55742
55762
  let writeBackCandidates = [];
55743
55763
  let replied = false;
55764
+ const fingerprint = createHash("sha256").update(JSON.stringify(fingerprintSources(input.sources))).digest("hex");
55765
+ const uploads = uploadsDigest(operation);
55744
55766
  try {
55745
55767
  const replayingPublication = await hasSkillPublicationOperation(this.deps.workspaceRoot, this.deps.stateRoot, input.operationId, input.replayKey);
55768
+ if (gitPlan && !replayingPublication && await this.unchanged(input, operation, fingerprint, uploads)) {
55769
+ assertMutationAuthority();
55770
+ const gitSources = input.sources.filter((source) => source.sourceKind === "git").map((plan) => gitResult(plan, input.priorRoots.filter((root) => root.sourceId === plan.sourceId).map((root) => root.path.split("/").at(-1))));
55771
+ const reply = ClusterSkillReconcileResultSchema.parse(skillReplyFor(input, {
55772
+ roots: input.priorRoots,
55773
+ conflicts: [],
55774
+ gitSources
55775
+ }));
55776
+ return await this.answer(input, operation, reply, context);
55777
+ }
55778
+ this.published = void 0;
55746
55779
  const git = gitPlan ? await this.acquireGitPlan(input, operation, mutationSignal) : /* @__PURE__ */ new Map();
55747
55780
  const dropped = gitPlan ? this.chargeBudget(input, operation, git) : /* @__PURE__ */ new Set();
55748
55781
  const kept = [];
@@ -55858,7 +55891,7 @@ var ClusterSkillHandler = class {
55858
55891
  agentId: "cluster-shim",
55859
55892
  runtime: operation.skillsAgentId,
55860
55893
  cliVersion: PINNED_SKILLS_CLI_VERSION,
55861
- fingerprint: skipped.length > 0 ? `failed:${randomBytes(16).toString("hex")}` : createHash("sha256").update(JSON.stringify(fingerprintSources(input.sources))).digest("hex"),
55894
+ fingerprint: skipped.length > 0 ? `failed:${randomBytes(16).toString("hex")}` : fingerprint,
55862
55895
  ...preserveOwned.length > 0 ? { preserveOwned } : {},
55863
55896
  ...replayingPublication ? {} : { trustedPrior: input.priorRoots.map((root) => ({
55864
55897
  relativeRoot: root.path,
@@ -55887,18 +55920,15 @@ var ClusterSkillHandler = class {
55887
55920
  ...gitPlan ? { gitSources: inSourceOrder(input, gitSources) } : {},
55888
55921
  ...writeBackCandidates.length > 0 ? { writeBackCandidates: inSourceOrder(input, writeBackCandidates) } : {}
55889
55922
  }));
55890
- if (input.priorRootCount !== void 0) {
55891
- operation.result = reply;
55892
- replied = true;
55893
- return await this.receipt({
55894
- op: "receipt",
55895
- handle: input.handle,
55896
- operationId: input.operationId,
55897
- offset: 0
55898
- }, context);
55899
- }
55900
- await this.discard(operation.handle);
55901
- const sent = ClusterSkillReconcileReplySchema.parse(reply);
55923
+ if (skipped.length + budgetDropped.length + result.conflicts.length === 0) this.published = {
55924
+ agentId: operation.authority.agentId,
55925
+ skillsAgentId: operation.skillsAgentId,
55926
+ fingerprint,
55927
+ uploads,
55928
+ roots: reply.roots
55929
+ };
55930
+ if (input.priorRootCount !== void 0) replied = true;
55931
+ const sent = await this.answer(input, operation, reply, context);
55902
55932
  replied = true;
55903
55933
  return sent;
55904
55934
  } finally {
@@ -55910,6 +55940,37 @@ var ClusterSkillHandler = class {
55910
55940
  })));
55911
55941
  }
55912
55942
  }
55943
+ async answer(input, operation, reply, context) {
55944
+ if (input.priorRootCount !== void 0) {
55945
+ operation.result = reply;
55946
+ return await this.receipt({
55947
+ op: "receipt",
55948
+ handle: input.handle,
55949
+ operationId: input.operationId,
55950
+ offset: 0
55951
+ }, context);
55952
+ }
55953
+ await this.discard(operation.handle);
55954
+ return ClusterSkillReconcileReplySchema.parse(reply);
55955
+ }
55956
+ async unchanged(input, operation, fingerprint, uploads) {
55957
+ const published = this.published;
55958
+ if (!published || published.agentId !== operation.authority.agentId || published.skillsAgentId !== operation.skillsAgentId || published.fingerprint !== fingerprint || published.uploads !== uploads || canonicalRoots(published.roots) !== canonicalRoots(input.priorRoots)) return false;
55959
+ return await publishedSkillSetUnchanged({
55960
+ cwd: this.deps.workspaceRoot,
55961
+ stateDir: this.deps.stateRoot,
55962
+ agentId: "cluster-shim",
55963
+ runtime: operation.skillsAgentId,
55964
+ cliVersion: PINNED_SKILLS_CLI_VERSION,
55965
+ fingerprint,
55966
+ roots: input.priorRoots.map((root) => ({
55967
+ relativeRoot: root.path,
55968
+ sourceKey: root.sourceId,
55969
+ treeDigest: root.digest,
55970
+ files: root.files
55971
+ }))
55972
+ });
55973
+ }
55913
55974
  async acquireGitPlan(input, operation, abort) {
55914
55975
  const outcomes = await acquireGitPlanSources({
55915
55976
  plans: input.sources.filter((source) => source.sourceKind === "git"),
@@ -56048,6 +56109,20 @@ const fingerprintSources = (sources) => sources.map((source) => {
56048
56109
  const { getUrl: _getUrl, writeBack: _writeBack, ...rest } = source;
56049
56110
  return rest;
56050
56111
  });
56112
+ const uploadsDigest = (operation) => createHash("sha256").update(JSON.stringify([...operation.files.values()].map(({ sourceId, path, size, sha256, executable }) => JSON.stringify([
56113
+ sourceId,
56114
+ path,
56115
+ size,
56116
+ sha256,
56117
+ executable ?? null
56118
+ ])).sort())).digest("hex");
56119
+ const canonicalRoots = (roots) => JSON.stringify([...roots].sort((a, b) => a.path.localeCompare(b.path)).map(({ path, sourceId, sourceKind, digest, files }) => [
56120
+ path,
56121
+ sourceId,
56122
+ sourceKind,
56123
+ digest,
56124
+ files
56125
+ ]));
56051
56126
  function compareDecimalTerms(left, right) {
56052
56127
  if (left.length !== right.length) return left.length < right.length ? -1 : 1;
56053
56128
  return left === right ? 0 : left < right ? -1 : 1;