@bendyline/gezel 1.0.7 → 1.1.1

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.
@@ -418,7 +418,7 @@ declare function windowsDetachedSpawnOptions(platform?: NodeJS.Platform): {
418
418
  * so a scheme change simply misses once and re-probes, which is the same
419
419
  * thing any bump does.
420
420
  */
421
- declare const LLAMA_ENGINE_VERSION = "v0.3.0";
421
+ declare const LLAMA_ENGINE_VERSION = "v0.4.0";
422
422
 
423
423
  /**
424
424
  * Map a (platform, arch) pair to the subdirectory name used under
@@ -353,7 +353,7 @@ function duckdbInstalledBinary(home, platform = process.platform, version = DUCK
353
353
  }
354
354
 
355
355
  // src/native/llama-engine-version.ts
356
- var LLAMA_ENGINE_VERSION = "v0.3.0";
356
+ var LLAMA_ENGINE_VERSION = "v0.4.0";
357
357
 
358
358
  // src/native/platform-key.ts
359
359
  function resolvePlatformKey(platform = process.platform, arch = process.arch) {
package/dist/paths.d.ts CHANGED
@@ -290,6 +290,18 @@ declare const PROJECT_DIFFPACKS_DIR_NAME = "diffpacks";
290
290
  declare function projectDiffpacksDir(root: string, projectId: string, external?: ExternalFolders): string;
291
291
  /** One pack's folder: `artifacts/diffpacks/<packId>/`. */
292
292
  declare function projectDiffpackDir(root: string, projectId: string, packId: string, external?: ExternalFolders): string;
293
+ /**
294
+ * Reserved artifacts subtree holding the user's chat prompt drafts. Each draft
295
+ * owns `message.md` (the prompt markdown), `message_files/` (its uploads,
296
+ * referenced document-relatively while editing) and `draft.json` (thread
297
+ * association, status, sent stamps). Lives under artifacts so a draft is an
298
+ * ordinary inspectable file the user can open, back up, and grep.
299
+ */
300
+ declare const PROJECT_PROMPTS_DIR_NAME = "prompts";
301
+ /** Per-project `artifacts/prompts/` root. */
302
+ declare function projectPromptsDir(root: string, projectId: string, external?: ExternalFolders): string;
303
+ /** One draft's folder: `artifacts/prompts/<draftId>/`. */
304
+ declare function projectPromptDraftDir(root: string, projectId: string, draftId: string, external?: ExternalFolders): string;
293
305
  /** Per-project memories folder (daily markdown + summary + vectra index). */
294
306
  declare function projectMemoriesDir(root: string, projectId: string, external?: ExternalFolders): string;
295
307
  /**
@@ -726,4 +738,4 @@ declare function binRuntimeRoot(root: string): string;
726
738
  */
727
739
  declare function readConfigRaw(root: string): Promise<Record<string, unknown>>;
728
740
 
729
- export { CONNECTOR_ROLLUPS_DIR_NAME, CONNECTOR_TABLES_DIR_NAME, type ExternalFolders, type GezelPaths, MACHINE_SHARED_MARKER, type MachineStorageScope, OBSERVATION_TABLE_MANIFEST_FILE, OBSERVATION_TABLE_STATE_FILE, PROJECT_DIFFPACKS_DIR_NAME, PROJECT_SHADOW_DIR_NAME, PROJECT_TABULAR_DIR_NAME, TABULAR_COMPANION_SUFFIX, activeMachineSharedHome, aiAppItemsDir, aiAppReceiptFile, aiAppVersionDir, aiAppsRegistryFile, aiAppsRoot, ambientDashboardLatestFile, ambientDashboardStateFile, ambientDir, ambientDisplayStateFile, backupsDir, binRuntimeRoot, channelsDir, craftbookShardPrefix, craftbookTemplateDir, craftbookTemplateManifestFile, craftbookTemplateScriptFile, craftbookTemplateScriptsDir, craftbookTemplateVersionDir, craftbookTemplateVersionManifestFile, craftbookTemplatesRoot, daemonTransactionsRoot, deviceIdentityFile, enginesRoot, fallbackProjectIndexDir, fallbackProjectVillageFile, foldersStateDir, gezelDir, gezelGrowthPath, gezelHome, gezelLocalDir, gezelMemoriesDir, gezelPaths, gezelPoppetjePath, gezelSessionFile, gezelSessionsDir, gezelStorageScope, gezelToolsPath, gezelToolsetsFile, gezelToolsetsInstallDir, gildeLiveRoot, gildeLiveStateFile, gildeLiveVersionDir, gildeLiveVersionsDir, globalHistoryFile, globalIndexDbFile, globalIndexDir, keurmeesterCasesDir, keurmeesterDigestStatePath, keurmeesterDigestsDir, keurmeesterDir, knowledgeCatalogVersionDir, knowledgeCatalogsDir, knowledgeDir, knowledgeDownloadsDir, knowledgeRegistryFile, machineSharedGezelDir, machineSharedHome, machineSharedMarkerFile, machineSharedProjectDir, meesterStatusDir, meesterStatusFile, meesterStatusStateFile, pendingGrantsFile, pendingHandoffsFile, playwrightBrowsersDir, projectActivityFile, projectArtifactsDir, projectArtifactsIndexDbFile, projectBoekwachterIssuesFile, projectCodeReviewsFile, projectContentIndexDbFile, projectCreateTransactionsRoot, projectDiffpackDir, projectDiffpacksDir, projectDiffpacksFile, projectDir, projectDocsDir, projectFindingLifecycleFile, projectHistoryFile, projectIndexDir, projectInternalGithubDir, projectLocalConfigFile, projectLocalCraftbookDir, projectLocalCraftbooksRoot, projectLocalDir, projectLocalFilesDir, projectLocalGezelDir, projectLocalGezelsRoot, projectLocalImportsFile, projectLocalIndexDbFile, projectLocalIndexDir, projectLocalPendingImportsFile, projectLocalQuarantineDir, projectLocalRoot, projectLocalVillageFile, projectMemoriesDir, projectMemoryIndexDir, projectMetaFile, projectPrivateDir, projectQuestionsFile, projectReportActionsFile, projectScriptFile, projectScriptRunFile, projectScriptRunsDir, projectScriptsDir, projectShadowDir, projectStorageDir, projectStorageScope, projectTabularDir, projectTaskAboutFile, projectTaskDir, projectTaskFile, projectTaskNextIdFile, projectTaskNotesFile, projectTasksDir, projectTerminalFile, projectTerminalsDir, projectToolsetsFile, projectToolsetsInstallDir, projectTypeDir, projectTypeManifestFile, projectTypeOverlayFile, projectTypeShardPrefix, projectTypeVersionDir, projectTypeVersionManifestFile, projectTypesRoot, readConfigRaw, remotesFile, secretsFile, secretsKeyFile, sharedCloneDir, sharedClonesRoot, sharedToolsetsFile, sharedToolsetsInstallDir, systemInstalledToolsetsFile, systemToolsetsFile, systemToolsetsInstallDir, tokensFile, toolsetConfigFile, toolsetConfigsDir, userGezelDir, userProjectDir, userScriptFile, userScriptsDir };
741
+ export { CONNECTOR_ROLLUPS_DIR_NAME, CONNECTOR_TABLES_DIR_NAME, type ExternalFolders, type GezelPaths, MACHINE_SHARED_MARKER, type MachineStorageScope, OBSERVATION_TABLE_MANIFEST_FILE, OBSERVATION_TABLE_STATE_FILE, PROJECT_DIFFPACKS_DIR_NAME, PROJECT_PROMPTS_DIR_NAME, PROJECT_SHADOW_DIR_NAME, PROJECT_TABULAR_DIR_NAME, TABULAR_COMPANION_SUFFIX, activeMachineSharedHome, aiAppItemsDir, aiAppReceiptFile, aiAppVersionDir, aiAppsRegistryFile, aiAppsRoot, ambientDashboardLatestFile, ambientDashboardStateFile, ambientDir, ambientDisplayStateFile, backupsDir, binRuntimeRoot, channelsDir, craftbookShardPrefix, craftbookTemplateDir, craftbookTemplateManifestFile, craftbookTemplateScriptFile, craftbookTemplateScriptsDir, craftbookTemplateVersionDir, craftbookTemplateVersionManifestFile, craftbookTemplatesRoot, daemonTransactionsRoot, deviceIdentityFile, enginesRoot, fallbackProjectIndexDir, fallbackProjectVillageFile, foldersStateDir, gezelDir, gezelGrowthPath, gezelHome, gezelLocalDir, gezelMemoriesDir, gezelPaths, gezelPoppetjePath, gezelSessionFile, gezelSessionsDir, gezelStorageScope, gezelToolsPath, gezelToolsetsFile, gezelToolsetsInstallDir, gildeLiveRoot, gildeLiveStateFile, gildeLiveVersionDir, gildeLiveVersionsDir, globalHistoryFile, globalIndexDbFile, globalIndexDir, keurmeesterCasesDir, keurmeesterDigestStatePath, keurmeesterDigestsDir, keurmeesterDir, knowledgeCatalogVersionDir, knowledgeCatalogsDir, knowledgeDir, knowledgeDownloadsDir, knowledgeRegistryFile, machineSharedGezelDir, machineSharedHome, machineSharedMarkerFile, machineSharedProjectDir, meesterStatusDir, meesterStatusFile, meesterStatusStateFile, pendingGrantsFile, pendingHandoffsFile, playwrightBrowsersDir, projectActivityFile, projectArtifactsDir, projectArtifactsIndexDbFile, projectBoekwachterIssuesFile, projectCodeReviewsFile, projectContentIndexDbFile, projectCreateTransactionsRoot, projectDiffpackDir, projectDiffpacksDir, projectDiffpacksFile, projectDir, projectDocsDir, projectFindingLifecycleFile, projectHistoryFile, projectIndexDir, projectInternalGithubDir, projectLocalConfigFile, projectLocalCraftbookDir, projectLocalCraftbooksRoot, projectLocalDir, projectLocalFilesDir, projectLocalGezelDir, projectLocalGezelsRoot, projectLocalImportsFile, projectLocalIndexDbFile, projectLocalIndexDir, projectLocalPendingImportsFile, projectLocalQuarantineDir, projectLocalRoot, projectLocalVillageFile, projectMemoriesDir, projectMemoryIndexDir, projectMetaFile, projectPrivateDir, projectPromptDraftDir, projectPromptsDir, projectQuestionsFile, projectReportActionsFile, projectScriptFile, projectScriptRunFile, projectScriptRunsDir, projectScriptsDir, projectShadowDir, projectStorageDir, projectStorageScope, projectTabularDir, projectTaskAboutFile, projectTaskDir, projectTaskFile, projectTaskNextIdFile, projectTaskNotesFile, projectTasksDir, projectTerminalFile, projectTerminalsDir, projectToolsetsFile, projectToolsetsInstallDir, projectTypeDir, projectTypeManifestFile, projectTypeOverlayFile, projectTypeShardPrefix, projectTypeVersionDir, projectTypeVersionManifestFile, projectTypesRoot, readConfigRaw, remotesFile, secretsFile, secretsKeyFile, sharedCloneDir, sharedClonesRoot, sharedToolsetsFile, sharedToolsetsInstallDir, systemInstalledToolsetsFile, systemToolsetsFile, systemToolsetsInstallDir, tokensFile, toolsetConfigFile, toolsetConfigsDir, userGezelDir, userProjectDir, userScriptFile, userScriptsDir };
package/dist/paths.js CHANGED
@@ -43,158 +43,70 @@ function assertSafeEntityId(value, label = "entity id") {
43
43
  }
44
44
 
45
45
  // src/schemas/knowledge.ts
46
+ import {
47
+ KnowledgeIdSchema,
48
+ KnowledgeVersionSchema,
49
+ Sha256HexSchema
50
+ } from "@bendyline/gezk";
46
51
  import { z } from "zod";
47
- var KNOWLEDGE_ID_PATTERN = /^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$/;
48
- var KnowledgeIdSchema = z.string().regex(KNOWLEDGE_ID_PATTERN);
49
- var KNOWLEDGE_VERSION_PATTERN = /^[A-Za-z0-9](?:[A-Za-z0-9._+-]{0,126}[A-Za-z0-9])?$/;
50
- var KnowledgeVersionSchema = z.string().min(1).max(128).regex(KNOWLEDGE_VERSION_PATTERN, "catalog version must be one portable path segment").refine(
51
- (value) => !/^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(value),
52
- "catalog version must not use a reserved Windows device name"
53
- );
54
- var KnowledgeDocumentIdSchema = z.string().min(1).max(256).refine((s) => s === s.normalize("NFC"), "document id must be NFC-normalized").refine((s) => !/[\u0000-\u001f\u007f-\u009f]/u.test(s), "document id must not contain controls").refine((s) => s === s.trim(), "document id must not have leading/trailing whitespace");
55
- var KnowledgeChunkUidSchema = z.string().regex(/^[0-9a-f]{32}$/);
56
- var Sha256HexSchema = z.string().regex(/^[0-9a-f]{64}$/);
57
- var KnowledgeVectorEncodingSchema = z.enum(["bit384+int8"]);
58
- var KnowledgeEmbeddingProfileSchema = z.object({
59
- /** e.g. `gezel-multilingual-e5-small@1`. New encoding/model = new id. */
60
- id: z.string().min(1),
61
- model: z.object({
62
- repo: z.string().min(1),
63
- revision: z.string().min(1),
64
- onnxDigest: z.string().optional()
65
- }),
66
- tokenizer: z.object({
67
- kind: z.string().min(1),
68
- digest: z.string().optional()
69
- }),
70
- pooling: z.literal("mean"),
71
- normalized: z.literal(true),
72
- dimensions: z.number().int().positive(),
73
- maxTokens: z.number().int().positive(),
74
- queryInstruction: z.string(),
75
- passageInstruction: z.string(),
76
- vectorEncoding: KnowledgeVectorEncodingSchema,
77
- distance: z.object({
78
- stage1: z.literal("hamming"),
79
- stage2: z.literal("cosine")
80
- }),
81
- quantization: z.object({
82
- int8: z.object({
83
- method: z.literal("symmetric-linear"),
84
- scale: z.literal(127)
85
- }),
86
- binary: z.object({
87
- method: z.literal("sign"),
88
- threshold: z.literal(0),
89
- packing: z.literal("lsb-first")
90
- })
91
- })
92
- });
93
- var KnowledgeChunkingProfileSchema = z.object({
94
- /** `gezel-markdown-chunks@2` for knowledge; `@1` names the project chunker. */
95
- id: z.string().min(1),
96
- unit: z.literal("tokens"),
97
- tokenizer: z.literal("profile"),
98
- targetTokens: z.number().int().positive(),
99
- overlapTokens: z.number().int().nonnegative(),
100
- contextHeader: z.object({ maxTokens: z.number().int().nonnegative() })
101
- });
102
- var KnowledgeManifestFileSchema = z.object({
103
- path: z.string().min(1),
104
- sizeBytes: z.number().int().nonnegative(),
105
- sha256: Sha256HexSchema
106
- });
107
- var KnowledgeCatalogManifestSchema = z.object({
108
- kind: z.literal("gezel-knowledge-catalog"),
109
- formatVersion: z.literal(1),
110
- indexSchemaVersion: z.literal(1),
111
- id: KnowledgeIdSchema,
112
- version: KnowledgeVersionSchema,
113
- name: z.string().min(1),
114
- description: z.string().optional(),
115
- language: z.string().min(2),
116
- publisher: z.object({
117
- id: KnowledgeIdSchema,
118
- name: z.string().min(1),
119
- url: z.string().optional()
120
- }),
121
- createdAt: z.string(),
122
- sourceSnapshot: z.object({
123
- name: z.string(),
124
- date: z.string(),
125
- taxonomyVersion: z.string().optional()
126
- }).optional(),
127
- license: z.object({
128
- name: z.string().min(1),
129
- noticePath: z.string().optional(),
130
- attributionRequired: z.boolean()
131
- }),
132
- embedding: KnowledgeEmbeddingProfileSchema,
133
- chunking: KnowledgeChunkingProfileSchema,
134
- topics: z.array(z.object({ id: KnowledgeIdSchema, name: z.string().min(1) })).min(1, "a catalog must ship a table of contents (at least one topic)"),
135
- router: z.object({
136
- shardTargetChunks: z.number().int().positive(),
137
- shards: z.array(
138
- z.object({
139
- id: z.number().int().nonnegative(),
140
- path: z.string().min(1),
141
- chunks: z.number().int().nonnegative(),
142
- documents: z.number().int().nonnegative(),
143
- centroids: z.number().int().nonnegative(),
144
- sha256: Sha256HexSchema
145
- })
146
- ),
147
- totalCentroids: z.number().int().nonnegative()
148
- }),
149
- counts: z.object({
150
- documents: z.number().int().nonnegative(),
151
- chunks: z.number().int().nonnegative(),
152
- shards: z.number().int().positive()
153
- }),
154
- files: z.array(KnowledgeManifestFileSchema).min(1),
155
- compatibility: z.object({
156
- minimumGezelVersion: z.string().optional(),
157
- maximumIndexSchemaVersion: z.number().int().positive()
158
- }),
159
- smokeQueries: z.array(
160
- z.object({
161
- query: z.string().min(1),
162
- expectedDocumentIds: z.array(KnowledgeDocumentIdSchema).min(1)
163
- })
164
- ).optional(),
165
- toolchain: z.object({
166
- compiler: z.string(),
167
- node: z.string(),
168
- sqlite: z.string().optional(),
169
- sqliteVec: z.string().optional(),
170
- onnxruntime: z.string().optional(),
171
- platform: z.string(),
172
- modelDigest: z.string().optional(),
173
- tokenizerDigest: z.string().optional()
174
- }).optional(),
175
- signature: z.object({
176
- algorithm: z.literal("ed25519"),
177
- keyId: z.string().min(1),
178
- canonicalization: z.literal("rfc8785"),
179
- value: z.string().min(1)
180
- }).optional()
181
- });
182
- var CatalogDocumentSchema = z.object({
183
- id: KnowledgeDocumentIdSchema,
184
- title: z.string().min(1),
185
- slug: z.string().min(1),
186
- summary: z.string().optional(),
187
- language: z.string().min(2),
188
- /** Root→leaf topic id path; the first segment must exist in the manifest. */
189
- topicPath: z.array(KnowledgeIdSchema).min(1),
190
- markdown: z.string(),
191
- sourceUrl: z.string().optional(),
192
- sourceRevision: z.string().optional(),
193
- sourceUpdatedAt: z.string().optional(),
194
- attribution: z.record(z.string(), z.string()).optional(),
195
- aliases: z.array(z.string()).optional()
196
- });
52
+ import {
53
+ ASSETS_PREFIX,
54
+ ArtifactDigestSchema,
55
+ CatalogDocumentSchema,
56
+ DEFAULT_EMBEDDING_ONNX_FILE,
57
+ DEFAULT_EMBEDDING_TOKENIZER_FILE,
58
+ GEZK_APPLICATION_ID,
59
+ GEZK_FORMAT_GENERATIONS,
60
+ GEZK_FORMAT_VERSION,
61
+ GEZK_INDEX_SCHEMA_VERSION,
62
+ GEZK_MANIFEST_KIND,
63
+ GEZK_MIME_TYPE,
64
+ GEZK_REGISTRY_KIND,
65
+ GEZK_SUPPORTED_FORMAT_VERSIONS,
66
+ GEZK_SUPPORTED_INDEX_SCHEMA_VERSIONS,
67
+ KNOWLEDGE_ASSET_PATH_PATTERN,
68
+ KNOWLEDGE_ASSET_TYPES,
69
+ KNOWLEDGE_ID_PATTERN,
70
+ KNOWLEDGE_MANIFEST_INDEX_SCHEMA_VERSIONS,
71
+ KNOWLEDGE_VERSION_PATTERN,
72
+ KnowledgeAssetPathSchema,
73
+ KnowledgeCatalogManifestSchema,
74
+ KnowledgeChunkUidSchema,
75
+ KnowledgeChunkingProfileSchema,
76
+ KnowledgeDocumentIdSchema,
77
+ KnowledgeDocumentMetaSchema,
78
+ KnowledgeEmbeddingProfileSchema,
79
+ KnowledgeIdSchema as KnowledgeIdSchema2,
80
+ KnowledgeManifestFileSchema,
81
+ KnowledgeOrdinalSchema,
82
+ KnowledgeRegistryEntrySchema as KnowledgeRegistryEntrySchema2,
83
+ KnowledgeRegistryIndexSchema,
84
+ KnowledgeSignatureSchema,
85
+ KnowledgeVectorEncodingSchema,
86
+ KnowledgeVersionSchema as KnowledgeVersionSchema2,
87
+ LICENSE_NOTICE_PATH,
88
+ MANIFEST_PATH,
89
+ MIMETYPE_PATH,
90
+ README_PATH,
91
+ ROUTER_DB_PATH,
92
+ RepoRelativePathSchema,
93
+ SOURCE_NOTICES_PATH,
94
+ Sha256HexSchema as Sha256HexSchema2,
95
+ SourceNoticesSchema,
96
+ assetContentType,
97
+ assetExtension,
98
+ assetKindForExtension,
99
+ embeddingProfileArtifacts,
100
+ formatKnowledgeUri,
101
+ isKnowledgeAssetPath,
102
+ isSupportedFormatVersion,
103
+ isSupportedIndexSchemaVersion,
104
+ parseKnowledgeUri,
105
+ sameVectorSpace,
106
+ topicSortKeyForOrder
107
+ } from "@bendyline/gezk";
197
108
  var KnowledgeStorageScopeSchema = z.enum(["machine-shared", "user"]);
109
+ var KnowledgeInstallSourceKindSchema = z.enum(["gilde", "file", "url"]);
198
110
  var KnowledgeCatalogRefSchema = z.object({
199
111
  publisherId: KnowledgeIdSchema,
200
112
  catalogId: KnowledgeIdSchema,
@@ -210,6 +122,8 @@ var KnowledgeUserRegistrySchema = z.object({
210
122
  enabled: z.boolean(),
211
123
  addedAt: z.string(),
212
124
  autoUpdate: z.boolean().optional(),
125
+ /** Where the install came from; entries written before it was recorded carry none. */
126
+ source: KnowledgeInstallSourceKindSchema.optional(),
213
127
  /** Set when the manager quarantined this catalog (with the reason). */
214
128
  disabledReason: z.string().optional()
215
129
  })
@@ -242,38 +156,11 @@ var ProjectKnowledgeCatalogsSchema = z.object({
242
156
  */
243
157
  refs: z.array(z.object({ publisherId: KnowledgeIdSchema, catalogId: KnowledgeIdSchema })).optional()
244
158
  });
245
- var KnowledgeRegistryEntrySchema = z.object({
246
- catalogId: KnowledgeIdSchema,
247
- version: z.string().min(1),
248
- name: z.string().min(1),
249
- description: z.string().optional(),
250
- language: z.string().min(2),
251
- documents: z.number().int().nonnegative(),
252
- /** Size of the `.gezk` archive itself (download accounting/preflight). */
253
- archiveBytes: z.number().int().nonnegative(),
254
- /** sha256 of the `.gezk` archive — the ref's contentDigest after install. */
255
- contentDigest: z.string().regex(/^[0-9a-f]{64}$/),
256
- /** Absolute download URL. Uploaded before the registry that names it. */
257
- url: z.string().url(),
258
- license: z.object({ name: z.string().min(1), attributionRequired: z.boolean() }),
259
- sourceSnapshot: z.object({ name: z.string(), date: z.string(), taxonomyVersion: z.string().optional() }).optional()
260
- });
261
- var KnowledgeRegistryIndexSchema = z.object({
262
- kind: z.literal("gezel-knowledge-registry"),
263
- formatVersion: z.literal(1),
264
- publisher: z.object({
265
- id: KnowledgeIdSchema,
266
- name: z.string().min(1),
267
- url: z.string().optional()
268
- }),
269
- generatedAt: z.string(),
270
- catalogs: z.array(KnowledgeRegistryEntrySchema),
271
- signature: z.object({
272
- algorithm: z.literal("ed25519"),
273
- keyId: z.string().min(1),
274
- canonicalization: z.literal("rfc8785"),
275
- value: z.string().min(1)
276
- }).optional()
159
+ var KnowledgeHuggingfaceFileSchema = z.object({
160
+ repo: z.string(),
161
+ /** A 40-hex commit sha, so the pinned URL is immutable. */
162
+ revision: z.string(),
163
+ path: z.string()
277
164
  });
278
165
  var KnowledgeUpdateCandidateSchema = z.object({
279
166
  publisherId: KnowledgeIdSchema,
@@ -281,24 +168,147 @@ var KnowledgeUpdateCandidateSchema = z.object({
281
168
  name: z.string(),
282
169
  installedVersion: z.string(),
283
170
  availableVersion: z.string(),
171
+ releasedAt: z.string(),
172
+ archiveBytes: z.number().int().nonnegative(),
173
+ contentDigest: Sha256HexSchema,
174
+ huggingface: KnowledgeHuggingfaceFileSchema
175
+ });
176
+ var KnowledgeUpdatesResponseSchema = z.object({
177
+ source: z.literal("gilde"),
178
+ checkedAt: z.string(),
179
+ updates: z.array(KnowledgeUpdateCandidateSchema)
180
+ });
181
+ var KnowledgeSemanticSearchModeSchema = z.enum(["shared", "profile", "keyword-only"]);
182
+ var KnowledgeCatalogStatusSchema = z.object({
183
+ ref: KnowledgeCatalogRefSchema,
184
+ enabled: z.boolean(),
185
+ addedAt: z.string(),
186
+ disabledReason: z.string().optional(),
187
+ mounted: z.boolean(),
188
+ name: z.string().optional(),
189
+ description: z.string().optional(),
190
+ language: z.string().optional(),
191
+ license: z.string().optional(),
192
+ documents: z.number().int().nonnegative().optional(),
193
+ chunks: z.number().int().nonnegative().optional(),
194
+ sizeBytes: z.number().int().nonnegative().optional(),
195
+ /** False only for `keyword-only` catalogs (an unregistered embedding profile). */
196
+ vectorCompatible: z.boolean().optional(),
197
+ /**
198
+ * `shared` — queries reuse the daemon's own embedder; `profile` — the
199
+ * catalog's model is loaded to embed queries; `keyword-only` — no model
200
+ * gezel can run matches the profile, so only full-text search applies.
201
+ */
202
+ semanticSearch: KnowledgeSemanticSearchModeSchema.optional(),
203
+ source: KnowledgeInstallSourceKindSchema,
204
+ /** A strictly newer version exists in the shipped catalog content. */
205
+ updateAvailable: z.boolean(),
206
+ availableVersion: z.string().optional()
207
+ });
208
+ var KnowledgeAvailableCatalogSchema = z.object({
209
+ id: KnowledgeIdSchema,
210
+ publisherId: KnowledgeIdSchema,
211
+ name: z.string(),
212
+ description: z.string(),
213
+ tags: z.array(z.string()),
214
+ language: z.string(),
215
+ category: z.string().optional(),
216
+ license: z.string().optional(),
217
+ licenseUrl: z.string().optional(),
218
+ version: z.string(),
219
+ releasedAt: z.string(),
220
+ formatVersion: z.string(),
221
+ huggingface: KnowledgeHuggingfaceFileSchema,
222
+ upstream: z.string().optional(),
223
+ parquet: z.object({ repo: z.string(), revision: z.string(), dir: z.string() }).optional(),
224
+ sha256: Sha256HexSchema,
284
225
  archiveBytes: z.number().int().nonnegative(),
285
- contentDigest: z.string().regex(/^[0-9a-f]{64}$/),
286
- url: z.string().url()
226
+ uncompressedBytes: z.number().int().nonnegative(),
227
+ documents: z.number().int().nonnegative(),
228
+ chunks: z.number().int().nonnegative(),
229
+ embeddingProfile: z.object({ id: z.string(), modelRepo: z.string() }),
230
+ topics: z.array(
231
+ z.object({
232
+ id: z.string(),
233
+ name: z.string(),
234
+ parentId: z.string().optional(),
235
+ sortKey: z.string().optional()
236
+ })
237
+ ),
238
+ minGezelVersion: z.string().optional(),
239
+ /** Present when this user's registry holds a version of the catalog. */
240
+ installed: z.object({
241
+ version: z.string(),
242
+ contentDigest: Sha256HexSchema,
243
+ storageScope: KnowledgeStorageScopeSchema,
244
+ enabled: z.boolean(),
245
+ updateAvailable: z.boolean()
246
+ }).optional(),
247
+ /** The pinned bytes already sit in the machine-shared asset store. */
248
+ sharedOnDevice: z.boolean(),
249
+ installing: z.boolean(),
250
+ /** A resumable partial download of the pinned archive exists. */
251
+ incompleteDownload: z.boolean()
287
252
  });
288
- var KnowledgeUpdatesResponseSchema = z.discriminatedUnion("available", [
253
+ var KnowledgeInstallPhaseSchema = z.enum(["download", "extract", "embedder"]);
254
+ var KnowledgeInstallEventSchema = z.discriminatedUnion("type", [
255
+ z.object({
256
+ type: z.literal("progress"),
257
+ phase: KnowledgeInstallPhaseSchema,
258
+ bytesDone: z.number().nonnegative(),
259
+ bytesTotal: z.number().nonnegative()
260
+ }),
261
+ z.object({ type: z.literal("verifying") }),
262
+ z.object({
263
+ type: z.literal("retrying"),
264
+ attempt: z.number().int(),
265
+ maxAttempts: z.number().int(),
266
+ delayMs: z.number().nonnegative(),
267
+ reason: z.string()
268
+ }),
289
269
  z.object({
290
- available: z.literal(false),
291
- reason: z.enum(["no-registry-url", "network-blocked", "no-trust-anchors", "fetch-failed"]),
292
- detail: z.string().optional()
270
+ type: z.literal("done"),
271
+ ref: KnowledgeCatalogRefSchema,
272
+ rootDir: z.string(),
273
+ storageScope: KnowledgeStorageScopeSchema,
274
+ /** Installed and mounted, but an optional step (the query embedder) did not complete. */
275
+ warning: z.string().optional()
293
276
  }),
294
277
  z.object({
295
- available: z.literal(true),
296
- registryUrl: z.string(),
297
- publisher: z.object({ id: KnowledgeIdSchema, name: z.string() }),
298
- checkedAt: z.string(),
299
- updates: z.array(KnowledgeUpdateCandidateSchema)
278
+ type: z.literal("error"),
279
+ error: z.string(),
280
+ /** Set when the downloaded bytes did not match the pinned digest. */
281
+ mismatch: z.object({ expected: Sha256HexSchema, actual: Sha256HexSchema }).optional()
300
282
  })
301
283
  ]);
284
+ var KnowledgeInstallJobSchema = z.object({
285
+ id: z.string(),
286
+ startedAt: z.string(),
287
+ finished: z.boolean(),
288
+ error: z.string().optional(),
289
+ /** The latest progress event and, once finished, the terminal event. */
290
+ events: z.array(KnowledgeInstallEventSchema)
291
+ });
292
+ var KnowledgeActiveInstallSchema = z.object({
293
+ jobId: z.string(),
294
+ /** Known up front for catalog installs; a file/URL install learns it at `done`. */
295
+ catalogId: KnowledgeIdSchema.optional(),
296
+ startedAt: z.string(),
297
+ phase: z.enum(["download", "verifying", "extract", "embedder", "retrying"]),
298
+ bytesDone: z.number().nonnegative(),
299
+ bytesTotal: z.number().nonnegative()
300
+ });
301
+ var IncompleteKnowledgeDownloadSchema = z.object({
302
+ /** The temp-file stem: the pinned sha256's first 16 hex chars, or a hash of the URL. */
303
+ key: z.string().regex(/^[0-9a-f]{16}$/),
304
+ bytes: z.number().int().nonnegative(),
305
+ updatedAt: z.string(),
306
+ /** True when the key still matches a catalog entry, so a re-install resumes it. */
307
+ resumable: z.boolean(),
308
+ catalogId: KnowledgeIdSchema.optional(),
309
+ name: z.string().optional(),
310
+ archiveBytes: z.number().int().nonnegative().optional()
311
+ });
302
312
  var KnowledgeInstallRequestSchema = z.object({
303
313
  source: z.discriminatedUnion("kind", [
304
314
  z.object({ kind: z.literal("file"), path: z.string().min(1) }),
@@ -308,6 +318,14 @@ var KnowledgeInstallRequestSchema = z.object({
308
318
  /** Optional out-of-band identity for remote imports. When present, the
309
319
  * daemon rejects bytes that do not match before extracting the archive. */
310
320
  expectedSha256: z.string().regex(/^[0-9a-fA-F]{64}$/).optional()
321
+ }),
322
+ z.object({
323
+ kind: z.literal("catalog"),
324
+ /** A gilde `knowledge-catalog` id; its pinned sha256 + commit are the trust root. */
325
+ id: KnowledgeIdSchema,
326
+ version: z.string().optional(),
327
+ /** `auto` (default) prefers the machine-shared store when a machine engine is adopted. */
328
+ placement: z.enum(["auto", "user"]).optional()
311
329
  })
312
330
  ])
313
331
  });
@@ -315,6 +333,44 @@ var UpdateKnowledgeCatalogRequestSchema = z.object({
315
333
  enabled: z.boolean().optional(),
316
334
  autoUpdate: z.boolean().optional()
317
335
  });
336
+ var KnowledgeTopicNodeSchema = z.object({
337
+ id: KnowledgeIdSchema,
338
+ parentId: KnowledgeIdSchema.nullable(),
339
+ name: z.string(),
340
+ description: z.string().nullable(),
341
+ sortKey: z.string(),
342
+ /** Documents filed directly at this topic. */
343
+ documentCount: z.number().int().nonnegative(),
344
+ /** Direct plus every descendant topic's documents. */
345
+ totalDocumentCount: z.number().int().nonnegative()
346
+ });
347
+ var KnowledgeDocumentSummarySchema = z.object({
348
+ id: z.string(),
349
+ title: z.string(),
350
+ slug: z.string(),
351
+ summary: z.string().nullable(),
352
+ language: z.string(),
353
+ topicId: z.string(),
354
+ ordinal: z.number().int().nullable(),
355
+ sourceUrl: z.string().nullable(),
356
+ sourceRevision: z.string().nullable(),
357
+ sourceUpdatedAt: z.string().nullable(),
358
+ attribution: z.record(z.string(), z.string()).nullable(),
359
+ meta: z.record(z.string(), z.unknown()).nullable()
360
+ });
361
+ var KnowledgeDocumentPageSchema = z.object({
362
+ documents: z.array(KnowledgeDocumentSummarySchema),
363
+ total: z.number().int().nonnegative()
364
+ });
365
+ var KnowledgeDocumentReadSchema = KnowledgeDocumentSummarySchema.extend({
366
+ markdown: z.string()
367
+ });
368
+ var KnowledgeAssetInfoSchema = z.object({
369
+ path: z.string(),
370
+ contentType: z.string(),
371
+ sizeBytes: z.number().int().nonnegative(),
372
+ sha256: Sha256HexSchema
373
+ });
318
374
  var KnowledgeSearchRequestSchema = z.object({
319
375
  query: z.string().min(1),
320
376
  maxResults: z.number().int().min(1).max(50).optional(),
@@ -537,6 +593,13 @@ function projectDiffpacksDir(root, projectId, external) {
537
593
  function projectDiffpackDir(root, projectId, packId, external) {
538
594
  return join(projectDiffpacksDir(root, projectId, external), packId);
539
595
  }
596
+ var PROJECT_PROMPTS_DIR_NAME = "prompts";
597
+ function projectPromptsDir(root, projectId, external) {
598
+ return join(projectArtifactsDir(root, projectId, external), PROJECT_PROMPTS_DIR_NAME);
599
+ }
600
+ function projectPromptDraftDir(root, projectId, draftId, external) {
601
+ return join(projectPromptsDir(root, projectId, external), draftId);
602
+ }
540
603
  function projectMemoriesDir(root, projectId, external) {
541
604
  return join(projectDir(root, projectId, external), "memories");
542
605
  }
@@ -586,9 +649,9 @@ function knowledgeCatalogsDir(root) {
586
649
  return join(knowledgeDir(root), "catalogs");
587
650
  }
588
651
  function knowledgeCatalogVersionDir(root, publisherId, catalogId, version, contentDigest) {
589
- const publisher = KnowledgeIdSchema.parse(publisherId);
590
- const catalog = KnowledgeIdSchema.parse(catalogId);
591
- const catalogVersion = KnowledgeVersionSchema.parse(version);
652
+ const publisher = KnowledgeIdSchema2.parse(publisherId);
653
+ const catalog = KnowledgeIdSchema2.parse(catalogId);
654
+ const catalogVersion = KnowledgeVersionSchema2.parse(version);
592
655
  if (!/^[0-9a-f]{64}$/i.test(contentDigest)) {
593
656
  throw new Error("knowledge catalog content digest must be a sha256");
594
657
  }
@@ -878,6 +941,7 @@ export {
878
941
  OBSERVATION_TABLE_MANIFEST_FILE,
879
942
  OBSERVATION_TABLE_STATE_FILE,
880
943
  PROJECT_DIFFPACKS_DIR_NAME,
944
+ PROJECT_PROMPTS_DIR_NAME,
881
945
  PROJECT_SHADOW_DIR_NAME,
882
946
  PROJECT_TABULAR_DIR_NAME,
883
947
  TABULAR_COMPANION_SUFFIX,
@@ -981,6 +1045,8 @@ export {
981
1045
  projectMemoryIndexDir,
982
1046
  projectMetaFile,
983
1047
  projectPrivateDir,
1048
+ projectPromptDraftDir,
1049
+ projectPromptsDir,
984
1050
  projectQuestionsFile,
985
1051
  projectReportActionsFile,
986
1052
  projectScriptFile,