superbee 0.4.3-pre.16 → 0.4.3-pre.18

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 (2) hide show
  1. package/dist/superbee.mjs +53 -9
  2. package/package.json +1 -1
package/dist/superbee.mjs CHANGED
@@ -44,7 +44,7 @@ var __toESM = (mod, isNodeMode, target3) => (target3 = mod != null ? __create(__
44
44
  var define_SUPERBEE_BUILD_IDENTITY_default;
45
45
  var init_define_SUPERBEE_BUILD_IDENTITY = __esm({
46
46
  "<define:__SUPERBEE_BUILD_IDENTITY__>"() {
47
- define_SUPERBEE_BUILD_IDENTITY_default = { schema: "superbee.build-identity.v1", package: { name: "superbee", version: "0.4.3-pre.16" }, source: { commit: "67f0444c4d35441a06059328700c2b7ad71c6841", dirty: false }, artifact: { channel: "npm-package" }, compatibility_contracts: { skill: 1, hook: 1, mcp: 1 } };
47
+ define_SUPERBEE_BUILD_IDENTITY_default = { schema: "superbee.build-identity.v1", package: { name: "superbee", version: "0.4.3-pre.18" }, source: { commit: "331fdf6fcc4695f3968960497e070af50865347f", dirty: false }, artifact: { channel: "npm-package" }, compatibility_contracts: { skill: 1, hook: 1, mcp: 1 } };
48
48
  }
49
49
  });
50
50
 
@@ -19299,6 +19299,24 @@ function declarationFree(doc2) {
19299
19299
  function isConnectorDoc(doc2) {
19300
19300
  return doc2.frontmatter.type === CONNECTOR_TYPE && doc2.id.startsWith(CONNECTORS_PREFIX);
19301
19301
  }
19302
+ function recipeOrphanedDefinitions(docs, recipe2) {
19303
+ const declared = /* @__PURE__ */ new Map([
19304
+ ["Convention", new Set(recipe2.docs.map((doc2) => doc2.id))],
19305
+ ["Connector", new Set((recipe2.connectors ?? []).map((connector) => connector.doc.id))],
19306
+ ["Reference", new Set(recipe2.references.map((reference) => reference.doc.id))]
19307
+ ]);
19308
+ const orphans = [];
19309
+ for (const doc2 of docs) {
19310
+ let definitionType;
19311
+ if (doc2.frontmatter.type === CONVENTION_TYPE && doc2.id.startsWith(CONVENTIONS_PREFIX)) definitionType = "Convention";
19312
+ else if (isConnectorDoc(doc2)) definitionType = "Connector";
19313
+ else if (doc2.frontmatter.type === "Reference" && doc2.id.startsWith("references/")) definitionType = "Reference";
19314
+ else continue;
19315
+ if (readRecipeStamp(doc2)?.id !== recipe2.id) continue;
19316
+ if (!declared.get(definitionType).has(doc2.id)) orphans.push({ id: doc2.id, type: definitionType });
19317
+ }
19318
+ return orphans.sort((a, b) => byCodeUnit(a.id, b.id) || byCodeUnit(a.type, b.type));
19319
+ }
19302
19320
  function installedRecipes(docs, known = []) {
19303
19321
  const present = /* @__PURE__ */ new Map();
19304
19322
  const stampedByRecipe = /* @__PURE__ */ new Map();
@@ -19377,6 +19395,10 @@ function installedRecipes(docs, known = []) {
19377
19395
  if (missing2 > 0) row5.missing = missing2;
19378
19396
  if (recipe2 && missingIds.length > 0) row5.missing_ids = missingIds;
19379
19397
  }
19398
+ if (recipe2) {
19399
+ const orphaned = recipeOrphanedDefinitions(all2.map(({ doc: doc2 }) => doc2), recipe2).map(({ id: id2 }) => id2);
19400
+ if (orphaned.length > 0) row5.orphaned_ids = orphaned;
19401
+ }
19380
19402
  if (diverged.length > 0) row5.diverged = diverged;
19381
19403
  if (unknownRules.length > 0) row5.unknown_rules = unknownRules;
19382
19404
  return row5;
@@ -21242,6 +21264,7 @@ async function installRecipe(bundle, recipe2, options = {}) {
21242
21264
  const prepared = prepareRecipeInstall(recipe2, { okfVersion, now });
21243
21265
  recipe2 = { ...recipe2, docs: prepared.docs, connectors: prepared.connectors, pages: prepared.pages, references: prepared.references };
21244
21266
  assertConnectorsWritable(recipe2, okfVersion);
21267
+ assertReferencesWritable(recipe2, okfVersion);
21245
21268
  await assertConnectorTargets(bundle, recipe2, okfVersion);
21246
21269
  await assertPortableTargetsCompatible(bundle, recipe2, okfVersion);
21247
21270
  const legacyConventionId = recipe2.docs.some((d2) => governsKind(d2, VIEW_KIND_NAME)) ? await findLegacyViewConvention(bundle) : null;
@@ -21449,6 +21472,17 @@ function assertConnectorsWritable(recipe2, okfVersion) {
21449
21472
  }
21450
21473
  }
21451
21474
  }
21475
+ function assertReferencesWritable(recipe2, okfVersion) {
21476
+ if (okfVersion !== "0.2") return;
21477
+ for (const { doc: doc2 } of recipe2.references) {
21478
+ try {
21479
+ assertAuthoredOkfStandardFields(doc2.frontmatter, void 0, { phase: "input" });
21480
+ } catch (error51) {
21481
+ if (!(error51 instanceof InvalidInputError)) throw error51;
21482
+ throw new RecipeInputError(`recipe '${recipe2.id}' cannot install Reference '${doc2.id}': ${error51.message}; nothing was written`);
21483
+ }
21484
+ }
21485
+ }
21452
21486
  async function assertConnectorTargets(bundle, recipe2, okfVersion) {
21453
21487
  const connectors = recipe2.connectors ?? [];
21454
21488
  if (connectors.length === 0) return;
@@ -21977,6 +22011,11 @@ async function prepareRecipeEvolution(bundle, sourceRecipe) {
21977
22011
  `cannot prove the prospective registry while convention '${skipped.id}' is unreadable: ${skipped.reason}`
21978
22012
  );
21979
22013
  }
22014
+ const orphaned = recipeOrphanedDefinitions([
22015
+ ...installedConventions,
22016
+ ...await query2(bundle, { prefix: CONNECTORS_PREFIX, type: CONNECTOR_TYPE }),
22017
+ ...await query2(bundle, { prefix: "references/", type: "Reference" })
22018
+ ], recipe2);
21980
22019
  const prospectiveById = new Map(installedConventions.map((doc2) => [doc2.id, doc2]));
21981
22020
  const currentRegistry = buildKindRegistry(installedConventions, [], { okfVersion });
21982
22021
  for (const authored2 of recipe2.docs) {
@@ -22393,6 +22432,7 @@ async function prepareRecipeEvolution(bundle, sourceRecipe) {
22393
22432
  writes: writes.size,
22394
22433
  plan_token: token,
22395
22434
  definitions,
22435
+ ...orphaned.length > 0 ? { orphaned_definitions: orphaned } : {},
22396
22436
  ...references.length > 0 ? { reference_assets: {
22397
22437
  rows: references,
22398
22438
  counts: {
@@ -22537,6 +22577,7 @@ async function applyRecipeEvolution(bundle, recipe2, expectedPlanToken, options
22537
22577
  changed: written > 0,
22538
22578
  plan_token: plan.plan_token,
22539
22579
  definitions: completed.filter((row5) => row5.asset_kind !== "reference"),
22580
+ ...postcondition.plan.orphaned_definitions ? { orphaned_definitions: postcondition.plan.orphaned_definitions } : {},
22540
22581
  ...plan.reference_assets ? { reference_assets: {
22541
22582
  rows: completed.filter((row5) => row5.asset_kind === "reference"),
22542
22583
  counts: {
@@ -29005,7 +29046,7 @@ var init_source_profiles = __esm({
29005
29046
  };
29006
29047
  }
29007
29048
  });
29008
- SOURCE_PLUGIN_CORE_VERSION = "0.2.0-pre.26";
29049
+ SOURCE_PLUGIN_CORE_VERSION = "0.2.0-pre.28";
29009
29050
  SOURCE_PROFILES = Object.freeze([restJsonProfile].map((profile) => Object.freeze({ id: profile.id, version: profile.version, kind: profile.kind })));
29010
29051
  }
29011
29052
  });
@@ -32117,7 +32158,7 @@ function decodeBlobWriteResult(raw, expected) {
32117
32158
  if (error51.scope !== "principal" && error51.scope !== "bundle" || error51.resetAt !== void 0 && (typeof error51.resetAt !== "string" || !Number.isFinite(Date.parse(error51.resetAt)))) throw refuse();
32118
32159
  } else if (error51.scope !== void 0 || error51.resetAt !== void 0) throw refuse();
32119
32160
  if (error51.code === "deletions_held") {
32120
- if (operationId !== "blobs.delete.v1" || !count2(error51.deletions) || !count2(error51.baseline)) throw refuse();
32161
+ if (operationId !== "blobs.delete.v1" || !count2(error51.deletions) || !Number.isSafeInteger(error51.baseline) || error51.baseline < 0) throw refuse();
32121
32162
  } else if (error51.deletions !== void 0 || error51.baseline !== void 0) throw refuse();
32122
32163
  return { ok: false, operationId, error: { ...error51 } };
32123
32164
  }
@@ -34284,7 +34325,7 @@ var init_write2 = __esm({
34284
34325
  // ../core/src/blob-journal.ts
34285
34326
  function captureBlobDeletionHold(value) {
34286
34327
  const hold = captureJournalValue(value);
34287
- if (!object4(hold) || !only3(hold, ["deletions", "baseline"]) || ![hold.deletions, hold.baseline].every((n) => Number.isSafeInteger(n) && n >= 1)) throw new TypeError("invalid blob deletion hold");
34328
+ if (!object4(hold) || !only3(hold, ["deletions", "baseline"]) || !Number.isSafeInteger(hold.deletions) || hold.deletions < 1 || !Number.isSafeInteger(hold.baseline) || hold.baseline < 0) throw new TypeError("invalid blob deletion hold");
34288
34329
  return hold;
34289
34330
  }
34290
34331
  function captureBlobNotDispatched(value) {
@@ -103573,7 +103614,7 @@ Options:
103573
103614
  -h, --help Show this help
103574
103615
  `;
103575
103616
  UNSTAMPED_CAP = 20;
103576
- STAMP_HELP = "partial: the recipe's conventions record different versions or fewer than it declares; a fresh 'recipe evolve <source>' plan (or 'recipe add' for an interrupted install) converges them, except a Kind declined with 'kind dismiss', which is deliberate, and a declared convention another recipe's stamp owns, which stays with that recipe; diverged: a convention changed since its recipe wrote it; an added declaration blocks the next evolve until the recipe adopts it or it is removed by hand, a removed optional one is put back, and a removed required field, section, terminal value or inbound expectation blocks until restored by hand; unknown: no stamp, or stamp rules this version does not read";
103617
+ STAMP_HELP = "partial: the recipe's conventions record different versions or fewer than it declares; a fresh 'recipe evolve <source>' plan (or 'recipe add' for an interrupted install) can reconcile declared targets, except a Kind declined with 'kind dismiss', which is deliberate, and a declared convention another recipe's stamp owns, which stays with that recipe; retained definitions the selected recipe no longer declares are reported as orphaned_ids when its source is known and are never changed or removed by evolve; diverged: a convention changed since its recipe wrote it; an added declaration blocks the next evolve until the recipe adopts it or it is removed by hand, a removed optional one is put back, and a removed required field, section, terminal value or inbound expectation blocks until restored by hand; unknown: no stamp, or stamp rules this version does not read";
103577
103618
  CONNECTOR_STAMP_HELP = "a Connector a person changed reads diverged and blocks that recipe's evolve until the change is undone or the Connector is removed and added again; connectors counts the Connectors carrying the stamp, connectors_of how many the recipe declares";
103578
103619
  }
103579
103620
  });
@@ -103931,7 +103972,7 @@ async function recipeEvolve(argv2, stdout) {
103931
103972
  } catch (error51) {
103932
103973
  throw classifyBundleError(error51);
103933
103974
  }
103934
- stdout(render({ ...result3, help: [planCommand, `${cliInvocation()} kinds`] }, resolveMode(values)));
103975
+ stdout(render({ ...result3, ...result3.orphaned_definitions ? { orphaned_help: ORPHANED_HELP } : {}, help: [planCommand, `${cliInvocation()} kinds`] }, resolveMode(values)));
103935
103976
  return;
103936
103977
  }
103937
103978
  let plan;
@@ -103952,6 +103993,7 @@ async function recipeEvolve(argv2, stdout) {
103952
103993
  } else if (plan.blockers.some((blocker) => blocker.code === "RECIPE_EVOLUTION_DEFINITION_MISSING" || blocker.code === "RECIPE_EVOLUTION_ASSET_MISSING")) {
103953
103994
  receipt4.commands = { install_missing: `${cliInvocation()} recipe add ${commandQuoted(ref)}${target3}` };
103954
103995
  }
103996
+ if (plan.orphaned_definitions) receipt4.orphaned_help = ORPHANED_HELP;
103955
103997
  receipt4.help = [planCommand, `${cliInvocation()} kinds`];
103956
103998
  stdout(render(receipt4, resolveMode(values)));
103957
103999
  }
@@ -104031,7 +104073,7 @@ async function recipeAdd(argv2, stdout) {
104031
104073
  receipt4.help = [`${cliInvocation()} recipes`, `${cliInvocation()} kinds`];
104032
104074
  stdout(render(receipt4, resolveMode(values)));
104033
104075
  }
104034
- var RECIPE_USAGE;
104076
+ var RECIPE_USAGE, ORPHANED_HELP;
104035
104077
  var init_recipe = __esm({
104036
104078
  "../cli/src/commands/recipe.ts"() {
104037
104079
  "use strict";
@@ -104084,8 +104126,9 @@ it compares definitions, permits additive declarations only, revalidates existin
104084
104126
  returns one exact apply command. Applying requires that plan's token, recomputes the preflight, and
104085
104127
  writes each changed convention with exact-version CAS. Concurrent non-target changes are detected
104086
104128
  by a postcondition check and reported with completed work. It never replaces existing values,
104087
- active View assets, or artifacts omitted from the source. It may add a field type (fields.types) or
104088
- an enum (fields.values) to a declared field only when every existing instance conforms; otherwise
104129
+ active View assets, or artifacts omitted from the source. Retained stamped definitions omitted from
104130
+ the selected source are reported as orphaned_definitions; a zero-write plan does not remove them.
104131
+ It may add a field type (fields.types) or an enum (fields.values) to a declared field only when every existing instance conforms; otherwise
104089
104132
  the plan names the violating documents. It never changes or removes a type or an enum. New outbound
104090
104133
  link types revalidate existing edges; new expects_inbound labels add status graph lint only and do
104091
104134
  not require existing records to have those edges. Inbound additions require an unchanged recipe
@@ -104112,6 +104155,7 @@ Options:
104112
104155
  --json Emit compact JSON instead of TOON
104113
104156
  -h, --help Show this help
104114
104157
  `;
104158
+ ORPHANED_HELP = "orphaned_definitions are retained documents stamped by this recipe that the selected source no longer declares; evolve never changes or removes them, and a zero-write plan does not resolve them; inspect them before deciding whether to keep or remove them";
104115
104159
  }
104116
104160
  });
104117
104161
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superbee",
3
- "version": "0.4.3-pre.16",
3
+ "version": "0.4.3-pre.18",
4
4
  "type": "module",
5
5
  "description": "Agent-facing Superbee CLI for reading and writing local OKF knowledge bundles: context notes, docs, cross-links, and live bundle Views.",
6
6
  "keywords": [