@bendyline/gezel-catalog 1.0.7 → 1.1.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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CatalogKind, CatalogItemSummary, CatalogItemDetail, CatalogItemVersionInfo, CraftbookTestSpec, ToolsetCategory, ToolsetManifest } from '@bendyline/gezel';
1
+ import { CatalogKind, CatalogItemSummary, CatalogItemDetail, CatalogItemVersionInfo, CraftbookTestSpec, ToolsetCategory, CraftbookDoc, NewCraftbookStep, CraftbookStepWritableOutputMedium, CraftbookStepOutputMedium, ToolsetManifest } from '@bendyline/gezel';
2
2
  import { z } from 'zod';
3
3
 
4
4
  /**
@@ -330,6 +330,22 @@ declare function categorizeToolset(input: {
330
330
  maintainerName?: string;
331
331
  }): ToolsetCategory;
332
332
 
333
+ /** Resolve the authored blueprint's primary result drawer without prompt inference. */
334
+ declare function outputMediumForCraftbookBlueprint(step: NewCraftbookStep): CraftbookStepOutputMedium;
335
+ /**
336
+ * Every output surface the authored step procedure requires after applying
337
+ * the same inference used to persist generated policies. Runtime consumers
338
+ * use this as a compatibility floor for tasks embedded from an older catalog
339
+ * whose generated `additionalOutputMedia` predates the current detector.
340
+ */
341
+ declare function outputMediaForCraftbookBlueprint(step: NewCraftbookStep): ReadonlySet<CraftbookStepWritableOutputMedium>;
342
+ /**
343
+ * Add deterministic subtractive policies to every top-level and fanout step.
344
+ * Existing authored denials are preserved; generated defaults only add
345
+ * groups for which the procedure carries no positive signal.
346
+ */
347
+ declare function applyDefaultCraftbookStepPolicies(doc: CraftbookDoc): CraftbookDoc;
348
+
333
349
  /**
334
350
  * The gilde `schemas/` payload, defined once and consumed twice: the
335
351
  * `export-gilde-schemas` script writes it into a gilde checkout, and
@@ -547,10 +563,10 @@ declare function validateGildeContentUpgrade(opts: {
547
563
  /**
548
564
  * Tiny Hugging Face Hub API client used by catalog tooling.
549
565
  *
550
- * Scope: enough to list the files in a model repo and extract their
551
- * sha256 + size for manifest generation. Not a general-purpose HF SDK —
552
- * we don't need authentication, dataset endpoints, model cards, or
553
- * downloads (the install path has its own streaming downloader).
566
+ * Scope: enough to list the files in a model or dataset repo and extract
567
+ * their sha256 + size for manifest generation. Not a general-purpose HF SDK —
568
+ * we don't need authentication, model cards, or downloads (the install path
569
+ * has its own streaming downloader).
554
570
  *
555
571
  * The Hub publishes file metadata at `/api/models/<repo>/tree/<rev>`.
556
572
  * Each entry looks like:
@@ -583,9 +599,13 @@ interface HfFileEntry {
583
599
  /** True when the sha came from `lfs.oid` (a real sha256). */
584
600
  lfsBacked: boolean;
585
601
  }
602
+ /** Hub repository kind; the API path differs (`/api/models/` vs `/api/datasets/`). */
603
+ type HfRepoType = 'model' | 'dataset';
586
604
  interface FetchTreeOptions {
587
605
  /** Branch / tag / commit. Defaults to `main`. */
588
606
  rev?: string;
607
+ /** Defaults to `model`. Knowledge catalogs live in dataset repos. */
608
+ repoType?: HfRepoType;
589
609
  /** Test seam — defaults to global fetch. */
590
610
  fetchImpl?: typeof fetch;
591
611
  }
@@ -607,6 +627,7 @@ declare function fetchHuggingfaceTree(repo: string, opts?: FetchTreeOptions): Pr
607
627
  */
608
628
  declare function fetchHuggingfaceCommit(repo: string, opts?: {
609
629
  rev?: string;
630
+ repoType?: HfRepoType;
610
631
  fetchImpl?: typeof fetch;
611
632
  }): Promise<string>;
612
633
  /**
@@ -622,4 +643,4 @@ declare function totalSize(files: ReadonlyArray<HfFileEntry>): number;
622
643
  */
623
644
  declare function selectMlxInstallFiles(files: ReadonlyArray<HfFileEntry>): HfFileEntry[];
624
645
 
625
- export { BUILTIN_TOOLSETS, BUILTIN_TOOL_TO_GROUP, type BuiltinToolsetGroup, BuiltinToolsetsSource, BundledSource, type BundledSourceOptions, CatalogService, type CatalogSource, CommunitySource, type FetchTreeOptions, GILDE_PACKAGE_NAME, type GildeContentRegression, type GildeContentValidation, type GildeReleaseInfo, type HfFileEntry, InstalledAiAppsSource, LocalCatalogSource, builtinCatalogId, categorizeToolset, compareRelease, extractNpmPackageTarball, fetchGildeReleases, fetchHuggingfaceCommit, fetchHuggingfaceTree, getBuiltinToolset, gildeDataDir, gildePackageRoot, installNpmPackageToolset, isGildeReleaseVersion, pickGildePatchUpdate, publishStagedNpmInstall, recoverInterruptedNpmInstall, renderGildeSchemaFiles, renderSchema, selectMlxInstallFiles, stageGildeVersion, totalSize, validateGildeContentUpgrade, validateNpmArchiveEntry, verifyTarballSha256 };
646
+ export { BUILTIN_TOOLSETS, BUILTIN_TOOL_TO_GROUP, type BuiltinToolsetGroup, BuiltinToolsetsSource, BundledSource, type BundledSourceOptions, CatalogService, type CatalogSource, CommunitySource, type FetchTreeOptions, GILDE_PACKAGE_NAME, type GildeContentRegression, type GildeContentValidation, type GildeReleaseInfo, type HfFileEntry, InstalledAiAppsSource, LocalCatalogSource, applyDefaultCraftbookStepPolicies, builtinCatalogId, categorizeToolset, compareRelease, extractNpmPackageTarball, fetchGildeReleases, fetchHuggingfaceCommit, fetchHuggingfaceTree, getBuiltinToolset, gildeDataDir, gildePackageRoot, installNpmPackageToolset, isGildeReleaseVersion, outputMediaForCraftbookBlueprint, outputMediumForCraftbookBlueprint, pickGildePatchUpdate, publishStagedNpmInstall, recoverInterruptedNpmInstall, renderGildeSchemaFiles, renderSchema, selectMlxInstallFiles, stageGildeVersion, totalSize, validateGildeContentUpgrade, validateNpmArchiveEntry, verifyTarballSha256 };
package/dist/index.js CHANGED
@@ -498,6 +498,7 @@ import {
498
498
  GEZEL_CONTENT_COMPAT,
499
499
  GezelTemplateVersionManifestSchema,
500
500
  ImageModelVersionManifestSchema,
501
+ KnowledgeCatalogVersionManifestSchema,
501
502
  ProjectTypeVersionManifestSchema,
502
503
  ToolsetVersionManifestSchema,
503
504
  VideoModelVersionManifestSchema,
@@ -519,7 +520,8 @@ var KINDS = [
519
520
  "connector-type",
520
521
  "chat-model",
521
522
  "image-model",
522
- "video-model"
523
+ "video-model",
524
+ "knowledge-catalog"
523
525
  ];
524
526
  var KIND_DIR = {
525
527
  toolset: "toolsets",
@@ -529,7 +531,8 @@ var KIND_DIR = {
529
531
  "connector-type": "connector-types",
530
532
  "chat-model": "chat-models",
531
533
  "image-model": "image-models",
532
- "video-model": "video-models"
534
+ "video-model": "video-models",
535
+ "knowledge-catalog": "knowledge-catalogs"
533
536
  };
534
537
  function shardPrefix(id) {
535
538
  return id.slice(0, 2).toLowerCase();
@@ -1088,6 +1091,10 @@ function parseVersionPayload(kind, raw) {
1088
1091
  const p2 = VideoModelVersionManifestSchema.parse(raw);
1089
1092
  return { ...p2, __kind: "video-model" };
1090
1093
  }
1094
+ if (kind === "knowledge-catalog") {
1095
+ const p2 = KnowledgeCatalogVersionManifestSchema.parse(raw);
1096
+ return { ...p2, __kind: "knowledge-catalog" };
1097
+ }
1091
1098
  const p = ImageModelVersionManifestSchema.parse(raw);
1092
1099
  return { ...p, __kind: "image-model" };
1093
1100
  } catch {
@@ -1329,6 +1336,43 @@ function mergeIdentityAndVersion(kind, identity, version, availableVersions) {
1329
1336
  availableVersions
1330
1337
  };
1331
1338
  }
1339
+ if (kind === "knowledge-catalog" && identity.kind === "knowledge-catalog" && version.__kind === "knowledge-catalog") {
1340
+ return {
1341
+ schemaVersion: 1,
1342
+ kind: "knowledge-catalog",
1343
+ id: identity.id,
1344
+ name: identity.name,
1345
+ description: identity.description,
1346
+ tags: identity.tags,
1347
+ maintainer: identity.maintainer,
1348
+ ...identity.logo !== void 0 ? { logo: identity.logo } : {},
1349
+ ...identity.license !== void 0 ? { license: identity.license } : {},
1350
+ ...identity.licenseClass !== void 0 ? { licenseClass: identity.licenseClass } : {},
1351
+ ...identity.licenseShortName !== void 0 ? { licenseShortName: identity.licenseShortName } : {},
1352
+ ...identity.licenseUrl !== void 0 ? { licenseUrl: identity.licenseUrl } : {},
1353
+ ...identity.recoScore !== void 0 ? { recoScore: identity.recoScore } : {},
1354
+ ...minGezelVersion !== void 0 ? { minGezelVersion } : {},
1355
+ publisherId: identity.publisherId,
1356
+ language: identity.language,
1357
+ ...identity.category ? { category: identity.category } : {},
1358
+ ...identity.upstream !== void 0 ? { upstream: identity.upstream } : {},
1359
+ version: version.version,
1360
+ releasedAt: version.releasedAt,
1361
+ formatVersion: version.formatVersion,
1362
+ huggingface: version.huggingface,
1363
+ sha256: version.sha256,
1364
+ archiveBytes: version.archiveBytes,
1365
+ uncompressedBytes: version.uncompressedBytes,
1366
+ documents: version.documents,
1367
+ chunks: version.chunks,
1368
+ embeddingProfile: version.embeddingProfile,
1369
+ topics: version.topics,
1370
+ ...version.sourceSnapshot ? { sourceSnapshot: version.sourceSnapshot } : {},
1371
+ ...version.parquet ? { parquet: version.parquet } : {},
1372
+ ...version.notes !== void 0 ? { notes: version.notes } : {},
1373
+ availableVersions
1374
+ };
1375
+ }
1332
1376
  if (kind === "video-model" && identity.kind === "video-model" && version.__kind === "video-model") {
1333
1377
  return {
1334
1378
  schemaVersion: 1,
@@ -1962,6 +2006,164 @@ function categorizeToolset(input) {
1962
2006
  return "other";
1963
2007
  }
1964
2008
 
2009
+ // src/craftbook-step-policy.ts
2010
+ import { deliverableKindForStep, requiredOutputMediaForGate } from "@bendyline/gezel";
2011
+ var BUILTIN_BY_ID2 = new Map(BUILTIN_TOOLSETS.map((group) => [group.id, group]));
2012
+ var SPECIALIZED_GROUP_SIGNALS = {
2013
+ "security-intel": /\b(?:security|vulnerabilit|threat|attack surface|taint|secret scan)\b/i,
2014
+ "image-intel": /\b(?:image library|photo library|similar images|search_images|describe_folder)\b/i,
2015
+ "entity-intel": /\b(?:find_entity|entity mentions|cross-file entit)\b/i,
2016
+ archives: /\b(?:archive|zip|tar|extract_archive|list_archive)\b/i,
2017
+ "data-tables": /\b(?:sql|query_table|describe_table|list_tables|data table)\b/i,
2018
+ craftbooks: /\b(?:craftbook_(?:read|write|add|remove|reorder|update)|edit (?:the )?craftbook)\b/i,
2019
+ "ai-apps": /\b(?:export_ai_app|import_ai_app|\.gezapp\b|ai app bundle)\b/i,
2020
+ audio: /\b(?:transcribe_audio|synthesize_speech|speech[- ]to[- ]text|text[- ]to[- ]speech)\b/i,
2021
+ videos: /\b(?:generate_video|video generation|generate (?:a )?video)\b/i,
2022
+ images: /\b(?:generate_image|render_image|describe_image|read_image|image generation|generate (?:an? )?image|render (?:a )?(?:chart|diagram))\b/i,
2023
+ "browser-automation": /\b(?:run_playwright_script|playwright|browser automation|headless browser)\b/i,
2024
+ git: /\b(?:run_git|github_|git\b|pull request|\bPR\s*#?\d*)\b/i,
2025
+ web: /\b(?:web_search|wikipedia_|fetch_url|live web|search the web|external source|https?:\/\/)\b/i,
2026
+ "team-management": /\b(?:ensure_gezel|message_gezel|create_gezel|update_gezel|start_project|delegate|hand (?:the )?work)\b/i,
2027
+ "role-delegation": /\b(?:ask_specialist|ask_gezel|delegate_[a-z]|consult_[a-z])\b/i,
2028
+ "role-delegation-escalation": /\b(?:escalat|second opinion|ask_specialist|consult_[a-z])\b/i
2029
+ };
2030
+ var DECLARED_TOOLSET_SIGNALS = {
2031
+ docblocks: /\b(?:docblocks|list_roots|convert_document|preview_document|save_artifact|document artifact uri)\b/i,
2032
+ github: SPECIALIZED_GROUP_SIGNALS.git,
2033
+ "@playwright/mcp": /\b(?:playwright|browser_|browser automation|headless browser)\b/i,
2034
+ "microsoft-playwright-mcp": /\b(?:playwright|browser_|browser automation|headless browser)\b/i
2035
+ };
2036
+ var TASK_NOTE_OUTPUT_SIGNAL = /\bwrite_task_note\b|\b(?:write|record|append|summarize)[^.!?\n]{0,100}\b(?:task\s+)?notes?\b|\bwrite\s+PASS\s*\/\s*FAIL\b/i;
2037
+ function procedureText(step) {
2038
+ return [step.name, step.description, step.prompt, step.suggestedRole].filter(Boolean).join("\n");
2039
+ }
2040
+ function gateChecks(step) {
2041
+ const gate = step.gate;
2042
+ return gate && "checks" in gate && Array.isArray(gate.checks) ? gate.checks : [];
2043
+ }
2044
+ function outputMediumForCraftbookBlueprint(step) {
2045
+ const gateRequiredMedia = [...requiredOutputMediaForGate(step.gate)];
2046
+ if (step.toolPolicy?.outputMedium) {
2047
+ if (step.toolPolicy.outputMedium === "none" && gateRequiredMedia[0]) {
2048
+ return gateRequiredMedia[0];
2049
+ }
2050
+ return step.toolPolicy.outputMedium;
2051
+ }
2052
+ if (step.deliverable?.path) return step.deliverable.artifact ? "artifact" : "workspace";
2053
+ if (step.advanceWhen?.file) return step.advanceWhen.artifact ? "artifact" : "workspace";
2054
+ const fileCheck = gateChecks(step).find(
2055
+ (check) => typeof check.file === "string" && check.file.length > 0
2056
+ );
2057
+ if (fileCheck) return fileCheck.artifact === true ? "artifact" : "workspace";
2058
+ if (gateRequiredMedia[0]) return gateRequiredMedia[0];
2059
+ const text = procedureText(step);
2060
+ if (/\b(?:write_file|append_to_file|replace_in_file|replace_lines|apply_patch|insert_at_marker)\b/i.test(
2061
+ text
2062
+ )) {
2063
+ return "workspace";
2064
+ }
2065
+ if (/\bwrite_artifact\b/i.test(text)) return "artifact";
2066
+ return TASK_NOTE_OUTPUT_SIGNAL.test(text) ? "task-note" : "none";
2067
+ }
2068
+ function outputMediaForCraftbookBlueprint(step) {
2069
+ const primary = outputMediumForCraftbookBlueprint(step);
2070
+ return /* @__PURE__ */ new Set([
2071
+ ...primary === "none" ? [] : [primary],
2072
+ ...additionalOutputMediaForStep(step, primary)
2073
+ ]);
2074
+ }
2075
+ function additionalOutputMediaForStep(step, primary) {
2076
+ if (primary === "none") return [];
2077
+ const text = procedureText(step);
2078
+ const out = new Set(step.toolPolicy?.additionalOutputMedia ?? []);
2079
+ for (const medium of requiredOutputMediaForGate(step.gate)) out.add(medium);
2080
+ if (/\b(?:write_file|append_to_file|replace_in_file|replace_lines|apply_patch|insert_at_marker)\b|\b(?:edit|change|patch|fix)\b[^.!?\n]{0,80}\b(?:actual|workspace|source|project)\s+files?\b/i.test(
2081
+ text
2082
+ )) {
2083
+ out.add("workspace");
2084
+ }
2085
+ if (/\bwrite_artifact\b/i.test(text)) out.add("artifact");
2086
+ if (TASK_NOTE_OUTPUT_SIGNAL.test(text)) out.add("task-note");
2087
+ out.delete(primary);
2088
+ return [...out].sort();
2089
+ }
2090
+ function groupToolMentioned(groupId, text) {
2091
+ const group = BUILTIN_BY_ID2.get(groupId);
2092
+ return group?.tools.some((tool) => new RegExp(`\\b${tool}\\b`, "i").test(text)) ?? false;
2093
+ }
2094
+ function needsCodeExecution(step, text) {
2095
+ const kind = step.deliverable?.kind ?? deliverableKindForStep(step);
2096
+ if (kind === "code-module" || kind === "code-with-tests" || kind === "data-file" || kind === "json" || kind === "audio-file") {
2097
+ return true;
2098
+ }
2099
+ if (gateChecks(step).some((check) => check.kind === "nodeRuns" || check.kind === "commandEvidence")) {
2100
+ return true;
2101
+ }
2102
+ if (step.onExit !== void 0) return true;
2103
+ if (groupToolMentioned("code-execution", text)) return true;
2104
+ return /\b(?:execute|npm|npx|sandbox|compile|transform)\b|\b(?:re-?run|run)[^.!?\n]{0,50}\b(?:test|script|build|command|suite)\b/i.test(
2105
+ text
2106
+ );
2107
+ }
2108
+ function builtinDisallows(step, medium, additionalMedia) {
2109
+ const text = procedureText(step);
2110
+ const out = new Set(step.toolPolicy?.disallowBuiltinToolsets ?? []);
2111
+ const media = /* @__PURE__ */ new Set([medium, ...additionalMedia]);
2112
+ if (!media.has("workspace")) out.add("workspace-fs-write");
2113
+ const consumesArtifact = step.consumes?.some((input) => input.artifact) === true;
2114
+ const mentionsArtifact = /\b(?:read_artifact|list_artifacts|grep_artifact|artifacts drawer)\b/i.test(text);
2115
+ if (!media.has("artifact") && !consumesArtifact && !mentionsArtifact) out.add("artifacts");
2116
+ for (const [groupId, signal] of Object.entries(SPECIALIZED_GROUP_SIGNALS)) {
2117
+ if (groupId === "web" && /research/i.test(step.suggestedRole ?? "")) continue;
2118
+ if (!signal.test(text) && !groupToolMentioned(groupId, text)) out.add(groupId);
2119
+ }
2120
+ if (!needsCodeExecution(step, text)) out.add("code-execution");
2121
+ return [...out].sort();
2122
+ }
2123
+ function explicitlyDeniedExternalToolsets(step, declaredIds) {
2124
+ const text = procedureText(step);
2125
+ const out = new Set(step.toolPolicy?.disallowToolsets ?? []);
2126
+ for (const id of declaredIds) {
2127
+ if (id.startsWith("builtin.")) continue;
2128
+ const escaped = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2129
+ const denial = new RegExp(
2130
+ `(?:\\bdo\\s+not\\b|\\bdon't\\b|\\bnever\\b)[^.!?\\n]{0,160}\\b(?:call|use|invoke|run|access|load)\\s+(?:the\\s+)?${escaped}(?=$|[^A-Za-z0-9_-])`,
2131
+ "iu"
2132
+ );
2133
+ const positiveSignal = DECLARED_TOOLSET_SIGNALS[id] ?? new RegExp(escaped, "iu");
2134
+ if (denial.test(text) || !positiveSignal.test(text)) out.add(id);
2135
+ }
2136
+ return [...out].sort();
2137
+ }
2138
+ function withDefaultPolicy(step, declaredIds) {
2139
+ const outputMedium = outputMediumForCraftbookBlueprint(step);
2140
+ const additionalOutputMedia = additionalOutputMediaForStep(step, outputMedium);
2141
+ const disallowBuiltinToolsets = builtinDisallows(step, outputMedium, additionalOutputMedia);
2142
+ const disallowToolsets = explicitlyDeniedExternalToolsets(step, declaredIds);
2143
+ return {
2144
+ ...step,
2145
+ toolPolicy: {
2146
+ ...disallowToolsets.length > 0 ? { disallowToolsets } : {},
2147
+ ...disallowBuiltinToolsets.length > 0 ? { disallowBuiltinToolsets } : {},
2148
+ outputMedium,
2149
+ ...additionalOutputMedia.length > 0 ? { additionalOutputMedia } : {}
2150
+ }
2151
+ };
2152
+ }
2153
+ function applyDefaultCraftbookStepPolicies(doc) {
2154
+ const declaredIds = (doc.toolsets ?? []).map((need) => need.toolsetId);
2155
+ return {
2156
+ ...doc,
2157
+ steps: doc.steps.map((step) => withDefaultPolicy(step, declaredIds)),
2158
+ ...doc.spawn ? {
2159
+ spawn: {
2160
+ ...doc.spawn,
2161
+ steps: doc.spawn.steps.map((step) => withDefaultPolicy(step, declaredIds))
2162
+ }
2163
+ } : {}
2164
+ };
2165
+ }
2166
+
1965
2167
  // src/gilde-schema-export.ts
1966
2168
  import {
1967
2169
  ChatModelIdentitySchema,
@@ -1976,6 +2178,8 @@ import {
1976
2178
  GezelTemplateVersionManifestSchema as GezelTemplateVersionManifestSchema2,
1977
2179
  ImageModelIdentitySchema,
1978
2180
  ImageModelVersionManifestSchema as ImageModelVersionManifestSchema2,
2181
+ KnowledgeCatalogIdentitySchema,
2182
+ KnowledgeCatalogVersionManifestSchema as KnowledgeCatalogVersionManifestSchema2,
1979
2183
  ProjectTypeIdentitySchema,
1980
2184
  ProjectTypeVersionManifestSchema as ProjectTypeVersionManifestSchema2,
1981
2185
  ToolsetIdentitySchema,
@@ -2001,6 +2205,8 @@ var GILDE_SCHEMA_EXPORTS = [
2001
2205
  ["image-model-version.schema.json", ImageModelVersionManifestSchema2],
2002
2206
  ["video-model-identity.schema.json", VideoModelIdentitySchema],
2003
2207
  ["video-model-version.schema.json", VideoModelVersionManifestSchema2],
2208
+ ["knowledge-catalog-identity.schema.json", KnowledgeCatalogIdentitySchema],
2209
+ ["knowledge-catalog-version.schema.json", KnowledgeCatalogVersionManifestSchema2],
2004
2210
  ["craftbook-doc.schema.json", CraftbookDocSchema],
2005
2211
  ["craftbook-test.schema.json", CraftbookTestSpecSchema]
2006
2212
  ];
@@ -2650,17 +2856,20 @@ async function validateGildeContentUpgrade(opts) {
2650
2856
 
2651
2857
  // src/hf-api.ts
2652
2858
  var HF_HUB_BASE = "https://huggingface.co";
2859
+ function apiPrefix(repoType) {
2860
+ return `${HF_HUB_BASE}/api/${repoType === "dataset" ? "datasets" : "models"}`;
2861
+ }
2653
2862
  async function fetchHuggingfaceTree(repo, opts = {}) {
2654
2863
  const rev = opts.rev ?? "main";
2655
2864
  const fetchImpl = opts.fetchImpl ?? fetch;
2656
2865
  const out = [];
2657
- await walk(repo, rev, "", out, fetchImpl);
2866
+ await walk(repo, rev, "", out, fetchImpl, opts.repoType);
2658
2867
  return out;
2659
2868
  }
2660
2869
  async function fetchHuggingfaceCommit(repo, opts = {}) {
2661
2870
  const rev = opts.rev ?? "main";
2662
2871
  const fetchImpl = opts.fetchImpl ?? fetch;
2663
- const url = `${HF_HUB_BASE}/api/models/${repo}/revision/${encodeURIComponent(rev)}`;
2872
+ const url = `${apiPrefix(opts.repoType)}/${repo}/revision/${encodeURIComponent(rev)}`;
2664
2873
  const res = await fetchImpl(url);
2665
2874
  if (!res.ok) {
2666
2875
  throw new Error(`[hf] commit resolve ${url} failed: ${res.status} ${res.statusText}`);
@@ -2671,8 +2880,8 @@ async function fetchHuggingfaceCommit(repo, opts = {}) {
2671
2880
  }
2672
2881
  return body.sha;
2673
2882
  }
2674
- async function walk(repo, rev, subpath, out, fetchImpl) {
2675
- const url = `${HF_HUB_BASE}/api/models/${repo}/tree/${rev}${subpath ? `/${subpath}` : ""}`;
2883
+ async function walk(repo, rev, subpath, out, fetchImpl, repoType) {
2884
+ const url = `${apiPrefix(repoType)}/${repo}/tree/${rev}${subpath ? `/${subpath}` : ""}`;
2676
2885
  const res = await fetchImpl(url);
2677
2886
  if (!res.ok) {
2678
2887
  throw new Error(`[hf] tree fetch ${url} failed: ${res.status} ${res.statusText}`);
@@ -2680,7 +2889,7 @@ async function walk(repo, rev, subpath, out, fetchImpl) {
2680
2889
  const entries = await res.json();
2681
2890
  for (const e of entries) {
2682
2891
  if (e.type === "directory") {
2683
- await walk(repo, rev, e.path, out, fetchImpl);
2892
+ await walk(repo, rev, e.path, out, fetchImpl, repoType);
2684
2893
  continue;
2685
2894
  }
2686
2895
  if (e.type !== "file") continue;
@@ -2724,6 +2933,7 @@ export {
2724
2933
  GILDE_PACKAGE_NAME,
2725
2934
  InstalledAiAppsSource,
2726
2935
  LocalCatalogSource,
2936
+ applyDefaultCraftbookStepPolicies,
2727
2937
  builtinCatalogId,
2728
2938
  categorizeToolset,
2729
2939
  compareRelease,
@@ -2736,6 +2946,8 @@ export {
2736
2946
  gildePackageRoot,
2737
2947
  installNpmPackageToolset,
2738
2948
  isGildeReleaseVersion,
2949
+ outputMediaForCraftbookBlueprint,
2950
+ outputMediumForCraftbookBlueprint,
2739
2951
  pickGildePatchUpdate,
2740
2952
  publishStagedNpmInstall,
2741
2953
  recoverInterruptedNpmInstall,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/gezel-catalog",
3
- "version": "1.0.7",
3
+ "version": "1.1.0",
4
4
  "description": "Gezel catalog loader: sources, install pipeline, and authoring scripts over the external @bendyline/gilde content package.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -47,12 +47,13 @@
47
47
  "!dist/**/*.map"
48
48
  ],
49
49
  "dependencies": {
50
- "@bendyline/gezel": "1.0.7",
51
- "@bendyline/gilde": "0.1.51",
50
+ "@bendyline/gezel": "1.1.0",
51
+ "@bendyline/gilde": "0.1.55",
52
52
  "tar": "7.5.21",
53
53
  "zod": "^4.4.3"
54
54
  },
55
55
  "devDependencies": {
56
+ "@bendyline/gezel-knowledge": "1.1.0",
56
57
  "esbuild": "^0.28.1",
57
58
  "tsup": "^8.5.1",
58
59
  "tsx": "^4.23.1",
@@ -69,7 +70,9 @@
69
70
  "build-index": "node scripts/run-gilde-build-index.mjs",
70
71
  "lint-manifests": "tsx src/chat-model-manifest-lint.ts",
71
72
  "generate-craftbooks": "tsx scripts/generate-craftbooks.ts",
73
+ "migrate-step-policies": "tsx scripts/migrate-craftbook-step-policies.ts",
72
74
  "pin-revisions": "tsx scripts/pin-revisions.ts",
73
- "export-gilde-schemas": "tsx scripts/export-gilde-schemas.ts"
75
+ "export-gilde-schemas": "tsx scripts/export-gilde-schemas.ts",
76
+ "add-knowledge-catalog": "tsx scripts/add-knowledge-catalog.ts"
74
77
  }
75
78
  }