superbee 0.1.5-pre.1 → 0.1.5-pre.2

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/README.md CHANGED
@@ -67,6 +67,10 @@ the Windows shim explicitly). Setup walks the agent through Agent Skill, Session
67
67
  registration. It is read-only: it inspects your configuration and returns one safe next command at
68
68
  a time, so the agent performs any actual changes with your approval.
69
69
 
70
+ The managed Agent Skill works in Claude Code, Codex, and OpenCode. OpenCode discovers Superbee from
71
+ its documented Claude-compatible Skill path. It shares Claude Code's Skill bytes by default; if
72
+ Claude Code is explicitly relocated, the installer manages the two documented host paths separately.
73
+
70
74
  Upgrading from the legacy `@holaxis/aslite` package or the retired marketplace plugin? Install
71
75
  `superbee` alongside it, have your agent run `superbee setup` to migrate the exact legacy
72
76
  integrations, then remove the old package with `npm uninstall -g @holaxis/aslite`. Existing
@@ -1153,7 +1153,7 @@ var require_omap = __commonJS({
1153
1153
  var _toString = Object.prototype.toString;
1154
1154
  function resolveYamlOmap(data) {
1155
1155
  if (data === null) return true;
1156
- var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
1156
+ var objectKeys = {}, index, length, pair, pairKey, pairHasKey, object = data;
1157
1157
  for (index = 0, length = object.length; index < length; index += 1) {
1158
1158
  pair = object[index];
1159
1159
  pairHasKey = false;
@@ -1165,8 +1165,8 @@ var require_omap = __commonJS({
1165
1165
  }
1166
1166
  }
1167
1167
  if (!pairHasKey) return false;
1168
- if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
1169
- else return false;
1168
+ if (_hasOwnProperty.call(objectKeys, pairKey)) return false;
1169
+ Object.defineProperty(objectKeys, pairKey, { value: true });
1170
1170
  }
1171
1171
  return true;
1172
1172
  }
@@ -1603,17 +1603,22 @@ var require_loader = __commonJS({
1603
1603
  state.result += _result;
1604
1604
  }
1605
1605
  }
1606
+ function chargeMergeWork(state) {
1607
+ state.totalMergeKeys += 1;
1608
+ if (state.maxTotalMergeKeys !== -1 && state.totalMergeKeys > state.maxTotalMergeKeys) {
1609
+ throwError(state, "merge keys exceeded maxTotalMergeKeys (" + state.maxTotalMergeKeys + ")");
1610
+ }
1611
+ }
1606
1612
  function mergeMappings(state, destination, source, overridableKeys) {
1607
1613
  var sourceKeys, key, index, quantity;
1608
1614
  if (!common.isObject(source)) {
1609
1615
  throwError(state, "cannot merge mappings; the provided source object is unacceptable");
1610
1616
  }
1617
+ chargeMergeWork(state);
1611
1618
  sourceKeys = Object.keys(source);
1612
1619
  for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
1613
1620
  key = sourceKeys[index];
1614
- if (state.maxTotalMergeKeys !== -1 && ++state.totalMergeKeys > state.maxTotalMergeKeys) {
1615
- throwError(state, "merge keys exceeded maxTotalMergeKeys (" + state.maxTotalMergeKeys + ")");
1616
- }
1621
+ chargeMergeWork(state);
1617
1622
  if (!_hasOwnProperty.call(destination, key)) {
1618
1623
  setProperty(destination, key, source[key]);
1619
1624
  overridableKeys[key] = true;
@@ -1642,6 +1647,9 @@ var require_loader = __commonJS({
1642
1647
  }
1643
1648
  if (keyTag === "tag:yaml.org,2002:merge") {
1644
1649
  if (Array.isArray(valueNode)) {
1650
+ if (valueNode.length > 100) {
1651
+ throwError(state, "abnormal merge sequence size");
1652
+ }
1645
1653
  for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
1646
1654
  mergeMappings(state, _result, valueNode[index], overridableKeys);
1647
1655
  }
@@ -3582,6 +3590,13 @@ var MalformedDocumentError = class extends Error {
3582
3590
  }
3583
3591
  };
3584
3592
  function parseMarkdown(raw, context) {
3593
+ if (/^---(?:\r?\n|$)/.test(raw)) {
3594
+ const firstLineEnd = raw.indexOf("\n");
3595
+ const afterOpening = firstLineEnd === -1 ? "" : raw.slice(firstLineEnd + 1);
3596
+ if (!/^---\r?$/m.test(afterOpening)) {
3597
+ throw new MalformedDocumentError(context, new Error("unterminated YAML frontmatter delimiter"));
3598
+ }
3599
+ }
3585
3600
  let parsed;
3586
3601
  try {
3587
3602
  parsed = (0, import_gray_matter.default)(raw, { engines: { yaml: yamlEngine } });
@@ -3591,16 +3606,20 @@ function parseMarkdown(raw, context) {
3591
3606
  const frontmatter2 = normalizeFrontmatter(parsed.data ?? {});
3592
3607
  return { frontmatter: frontmatter2, body: parsed.content };
3593
3608
  }
3609
+ function normalizeDocumentBodyForStorage(body) {
3610
+ return body.endsWith("\n") ? body : `${body}
3611
+ `;
3612
+ }
3594
3613
  function stringifyWithData(data, body) {
3595
3614
  const engines2 = import_gray_matter.default.engines;
3596
3615
  const yaml3 = engines2.yaml.stringify(data).trim();
3597
3616
  const content = body ?? "";
3598
3617
  const newline = (value) => value.endsWith("\n") ? value : `${value}
3599
3618
  `;
3600
- if (yaml3 === "{}") return newline(content);
3619
+ if (yaml3 === "{}") return normalizeDocumentBodyForStorage(content);
3601
3620
  return `---
3602
3621
  ${newline(yaml3)}---
3603
- ${newline(content)}`;
3622
+ ${normalizeDocumentBodyForStorage(content)}`;
3604
3623
  }
3605
3624
  function stringifyDoc(frontmatter2, body) {
3606
3625
  return stringifyWithData(frontmatter2, body);
@@ -3885,6 +3904,33 @@ function processExists(pid) {
3885
3904
  return err.code !== "ESRCH";
3886
3905
  }
3887
3906
  }
3907
+ function staleLockQuarantinePath(lockPath, owner) {
3908
+ const tokenHash = createHash("sha256").update(owner.token).digest("hex");
3909
+ return `${lockPath}.stale-${tokenHash}`;
3910
+ }
3911
+ async function pathExists(candidate) {
3912
+ try {
3913
+ await fs.lstat(candidate);
3914
+ return true;
3915
+ } catch (err) {
3916
+ if (err.code === "ENOENT") return false;
3917
+ throw err;
3918
+ }
3919
+ }
3920
+ async function quarantineStaleLock(lockPath, owner) {
3921
+ if (owner.hostname !== hostname() || processExists(owner.pid)) return false;
3922
+ const quarantinePath = staleLockQuarantinePath(lockPath, owner);
3923
+ try {
3924
+ await fs.rename(lockPath, quarantinePath);
3925
+ return true;
3926
+ } catch (err) {
3927
+ const code = err.code;
3928
+ if (code === "ENOENT") return false;
3929
+ if (await pathExists(quarantinePath)) return false;
3930
+ if (process.platform === "win32" && WINDOWS_DIRECTORY_CONTENTION_CODES.has(code ?? "")) return false;
3931
+ throw err;
3932
+ }
3933
+ }
3888
3934
  function delay(ms) {
3889
3935
  return new Promise((resolve) => setTimeout(resolve, ms));
3890
3936
  }
@@ -3947,11 +3993,11 @@ async function selectLockRoot(options2) {
3947
3993
  await ensurePrivateLockRoot(lockRoot);
3948
3994
  return lockRoot;
3949
3995
  }
3950
- var WINDOWS_CLAIM_CONTENTION_CODES = /* @__PURE__ */ new Set(["EACCES", "EBUSY", "EPERM"]);
3996
+ var WINDOWS_DIRECTORY_CONTENTION_CODES = /* @__PURE__ */ new Set(["EACCES", "EBUSY", "EPERM"]);
3951
3997
  async function classifyLockClaimFailure(error, lockPath) {
3952
3998
  const code = error.code;
3953
3999
  if (code === "EEXIST") return "contention";
3954
- if (process.platform !== "win32" || !WINDOWS_CLAIM_CONTENTION_CODES.has(code ?? "")) return "terminal";
4000
+ if (process.platform !== "win32" || !WINDOWS_DIRECTORY_CONTENTION_CODES.has(code ?? "")) return "terminal";
3955
4001
  try {
3956
4002
  await fs.lstat(lockPath);
3957
4003
  return "contention";
@@ -3976,7 +4022,12 @@ async function claimLockPath(lockPath, owner, waitMs, pollMs) {
3976
4022
  } else {
3977
4023
  unwitnessedWindowsRetryUsed = false;
3978
4024
  }
3979
- if (Date.now() - started >= waitMs) throw timeoutError(lockPath, await readOwner(lockPath), owner.target);
4025
+ let existingOwner = await readOwner(lockPath);
4026
+ if (existingOwner !== null) {
4027
+ if (await quarantineStaleLock(lockPath, existingOwner)) continue;
4028
+ existingOwner = await readOwner(lockPath);
4029
+ }
4030
+ if (Date.now() - started >= waitMs) throw timeoutError(lockPath, existingOwner, owner.target);
3980
4031
  await delay(pollMs);
3981
4032
  continue;
3982
4033
  }
@@ -1157,7 +1157,7 @@ var require_omap = __commonJS({
1157
1157
  var _toString = Object.prototype.toString;
1158
1158
  function resolveYamlOmap(data) {
1159
1159
  if (data === null) return true;
1160
- var objectKeys = [], index2, length, pair, pairKey, pairHasKey, object = data;
1160
+ var objectKeys = {}, index2, length, pair, pairKey, pairHasKey, object = data;
1161
1161
  for (index2 = 0, length = object.length; index2 < length; index2 += 1) {
1162
1162
  pair = object[index2];
1163
1163
  pairHasKey = false;
@@ -1169,8 +1169,8 @@ var require_omap = __commonJS({
1169
1169
  }
1170
1170
  }
1171
1171
  if (!pairHasKey) return false;
1172
- if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
1173
- else return false;
1172
+ if (_hasOwnProperty.call(objectKeys, pairKey)) return false;
1173
+ Object.defineProperty(objectKeys, pairKey, { value: true });
1174
1174
  }
1175
1175
  return true;
1176
1176
  }
@@ -1607,17 +1607,22 @@ var require_loader = __commonJS({
1607
1607
  state.result += _result;
1608
1608
  }
1609
1609
  }
1610
+ function chargeMergeWork(state) {
1611
+ state.totalMergeKeys += 1;
1612
+ if (state.maxTotalMergeKeys !== -1 && state.totalMergeKeys > state.maxTotalMergeKeys) {
1613
+ throwError(state, "merge keys exceeded maxTotalMergeKeys (" + state.maxTotalMergeKeys + ")");
1614
+ }
1615
+ }
1610
1616
  function mergeMappings(state, destination, source, overridableKeys) {
1611
1617
  var sourceKeys, key, index2, quantity;
1612
1618
  if (!common.isObject(source)) {
1613
1619
  throwError(state, "cannot merge mappings; the provided source object is unacceptable");
1614
1620
  }
1621
+ chargeMergeWork(state);
1615
1622
  sourceKeys = Object.keys(source);
1616
1623
  for (index2 = 0, quantity = sourceKeys.length; index2 < quantity; index2 += 1) {
1617
1624
  key = sourceKeys[index2];
1618
- if (state.maxTotalMergeKeys !== -1 && ++state.totalMergeKeys > state.maxTotalMergeKeys) {
1619
- throwError(state, "merge keys exceeded maxTotalMergeKeys (" + state.maxTotalMergeKeys + ")");
1620
- }
1625
+ chargeMergeWork(state);
1621
1626
  if (!_hasOwnProperty.call(destination, key)) {
1622
1627
  setProperty(destination, key, source[key]);
1623
1628
  overridableKeys[key] = true;
@@ -1646,6 +1651,9 @@ var require_loader = __commonJS({
1646
1651
  }
1647
1652
  if (keyTag === "tag:yaml.org,2002:merge") {
1648
1653
  if (Array.isArray(valueNode)) {
1654
+ if (valueNode.length > 100) {
1655
+ throwError(state, "abnormal merge sequence size");
1656
+ }
1649
1657
  for (index2 = 0, quantity = valueNode.length; index2 < quantity; index2 += 1) {
1650
1658
  mergeMappings(state, _result, valueNode[index2], overridableKeys);
1651
1659
  }
@@ -31536,6 +31544,13 @@ var MalformedDocumentError = class extends Error {
31536
31544
  }
31537
31545
  };
31538
31546
  function parseMarkdown(raw, context) {
31547
+ if (/^---(?:\r?\n|$)/.test(raw)) {
31548
+ const firstLineEnd = raw.indexOf("\n");
31549
+ const afterOpening = firstLineEnd === -1 ? "" : raw.slice(firstLineEnd + 1);
31550
+ if (!/^---\r?$/m.test(afterOpening)) {
31551
+ throw new MalformedDocumentError(context, new Error("unterminated YAML frontmatter delimiter"));
31552
+ }
31553
+ }
31539
31554
  let parsed;
31540
31555
  try {
31541
31556
  parsed = (0, import_gray_matter.default)(raw, { engines: { yaml: yamlEngine } });
@@ -31545,16 +31560,20 @@ function parseMarkdown(raw, context) {
31545
31560
  const frontmatter2 = normalizeFrontmatter(parsed.data ?? {});
31546
31561
  return { frontmatter: frontmatter2, body: parsed.content };
31547
31562
  }
31563
+ function normalizeDocumentBodyForStorage(body) {
31564
+ return body.endsWith("\n") ? body : `${body}
31565
+ `;
31566
+ }
31548
31567
  function stringifyWithData(data, body) {
31549
31568
  const engines2 = import_gray_matter.default.engines;
31550
31569
  const yaml3 = engines2.yaml.stringify(data).trim();
31551
31570
  const content3 = body ?? "";
31552
31571
  const newline = (value) => value.endsWith("\n") ? value : `${value}
31553
31572
  `;
31554
- if (yaml3 === "{}") return newline(content3);
31573
+ if (yaml3 === "{}") return normalizeDocumentBodyForStorage(content3);
31555
31574
  return `---
31556
31575
  ${newline(yaml3)}---
31557
- ${newline(content3)}`;
31576
+ ${normalizeDocumentBodyForStorage(content3)}`;
31558
31577
  }
31559
31578
  function stringifyDoc(frontmatter2, body) {
31560
31579
  return stringifyWithData(frontmatter2, body);
@@ -31839,6 +31858,33 @@ function processExists(pid) {
31839
31858
  return err.code !== "ESRCH";
31840
31859
  }
31841
31860
  }
31861
+ function staleLockQuarantinePath(lockPath, owner) {
31862
+ const tokenHash = createHash("sha256").update(owner.token).digest("hex");
31863
+ return `${lockPath}.stale-${tokenHash}`;
31864
+ }
31865
+ async function pathExists(candidate) {
31866
+ try {
31867
+ await fs.lstat(candidate);
31868
+ return true;
31869
+ } catch (err) {
31870
+ if (err.code === "ENOENT") return false;
31871
+ throw err;
31872
+ }
31873
+ }
31874
+ async function quarantineStaleLock(lockPath, owner) {
31875
+ if (owner.hostname !== hostname() || processExists(owner.pid)) return false;
31876
+ const quarantinePath = staleLockQuarantinePath(lockPath, owner);
31877
+ try {
31878
+ await fs.rename(lockPath, quarantinePath);
31879
+ return true;
31880
+ } catch (err) {
31881
+ const code2 = err.code;
31882
+ if (code2 === "ENOENT") return false;
31883
+ if (await pathExists(quarantinePath)) return false;
31884
+ if (process.platform === "win32" && WINDOWS_DIRECTORY_CONTENTION_CODES.has(code2 ?? "")) return false;
31885
+ throw err;
31886
+ }
31887
+ }
31842
31888
  function delay(ms) {
31843
31889
  return new Promise((resolve) => setTimeout(resolve, ms));
31844
31890
  }
@@ -31901,11 +31947,11 @@ async function selectLockRoot(options2) {
31901
31947
  await ensurePrivateLockRoot(lockRoot);
31902
31948
  return lockRoot;
31903
31949
  }
31904
- var WINDOWS_CLAIM_CONTENTION_CODES = /* @__PURE__ */ new Set(["EACCES", "EBUSY", "EPERM"]);
31950
+ var WINDOWS_DIRECTORY_CONTENTION_CODES = /* @__PURE__ */ new Set(["EACCES", "EBUSY", "EPERM"]);
31905
31951
  async function classifyLockClaimFailure(error, lockPath) {
31906
31952
  const code2 = error.code;
31907
31953
  if (code2 === "EEXIST") return "contention";
31908
- if (process.platform !== "win32" || !WINDOWS_CLAIM_CONTENTION_CODES.has(code2 ?? "")) return "terminal";
31954
+ if (process.platform !== "win32" || !WINDOWS_DIRECTORY_CONTENTION_CODES.has(code2 ?? "")) return "terminal";
31909
31955
  try {
31910
31956
  await fs.lstat(lockPath);
31911
31957
  return "contention";
@@ -31930,7 +31976,12 @@ async function claimLockPath(lockPath, owner, waitMs, pollMs) {
31930
31976
  } else {
31931
31977
  unwitnessedWindowsRetryUsed = false;
31932
31978
  }
31933
- if (Date.now() - started >= waitMs) throw timeoutError(lockPath, await readOwner(lockPath), owner.target);
31979
+ let existingOwner = await readOwner(lockPath);
31980
+ if (existingOwner !== null) {
31981
+ if (await quarantineStaleLock(lockPath, existingOwner)) continue;
31982
+ existingOwner = await readOwner(lockPath);
31983
+ }
31984
+ if (Date.now() - started >= waitMs) throw timeoutError(lockPath, existingOwner, owner.target);
31934
31985
  await delay(pollMs);
31935
31986
  continue;
31936
31987
  }