@okfit/mcp 0.1.0 → 0.3.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/index.d.ts CHANGED
@@ -1,21 +1,735 @@
1
- //#region src/index.d.ts
1
+ import { FileSystem, Layer, Path, Schema, Stdio } from "effect";
2
+ import { AppDirs, Xdg } from "@effected/xdg";
3
+ import { LoadedConcept } from "@okfit/core";
4
+ import { ChildProcessSpawner } from "effect/unstable/process";
5
+ import { Toolkit } from "effect/unstable/ai";
6
+ //#region src/errors.d.ts
7
+ /** What a caller should do next about a failed tool call. @public */
8
+ export declare const Remediation: Schema.Struct<{
9
+ readonly hint: Schema.String;
10
+ readonly suggestedTool: Schema.optionalKey<Schema.String>;
11
+ }>;
12
+ /** @public */
13
+ export type Remediation = typeof Remediation.Type;
2
14
  /**
3
- * Model Context Protocol server for okfit.
15
+ * Compose a self-contained wire message from a raw cause message and its
16
+ * remediation: the human message, then the hint, then `Try <suggestedTool>.`
17
+ * when one is present. Every `McpToolError` member's `message` field is
18
+ * built through this at construction — under `failureMode: "error"` (the
19
+ * only mode this contract's tools use), `McpServer`'s own `registerToolkit`
20
+ * collapses a caught typed failure to
21
+ * `{ isError: true, content: [{ type: "text", text: error.message }] }`
22
+ * and never surfaces `structuredContent` for it
23
+ * (`.repos/effect/packages/effect/src/unstable/ai/McpServer.ts:1502-1506,1576-1584`,
24
+ * confirmed empirically in Task B1's own build). `remediation` itself is
25
+ * left on the schema unchanged, both for anything that inspects the typed
26
+ * error directly (a defect handler, a future in-process caller) and
27
+ * because it is what this function reads to build `message`.
4
28
  *
5
- * @packageDocumentation
29
+ * @public
30
+ */
31
+ export declare const composeRemediatedMessage: (message: string, remediation: Remediation) => string;
32
+ /**
33
+ * Truncate a caller-supplied value before it is echoed back inside an
34
+ * error's `message` — the only field a `failureMode: "error"` failure
35
+ * actually delivers to the wire (see {@link composeRemediatedMessage}'s
36
+ * doc comment). Without this, a pathological argument (a multi-megabyte
37
+ * `id`, say) is echoed once in the response's `content[0].text` and once
38
+ * more in the corresponding log line, wasting an agent's context on what
39
+ * is usually a pure typo (final whole-branch review, Minor finding 5).
40
+ *
41
+ * @public
42
+ */
43
+ export declare const truncateEchoed: (value: string, limit?: number) => string;
44
+ declare const ConfigError_base: Schema.Class<ConfigError, Schema.TaggedStruct<"ConfigError", {
45
+ readonly message: Schema.String;
46
+ readonly remediation: Schema.Struct<{
47
+ readonly hint: Schema.String;
48
+ readonly suggestedTool: Schema.optionalKey<Schema.String>;
49
+ }>;
50
+ }>, import("effect/Cause").YieldableError>;
51
+ /**
52
+ * Config discovery, parsing, or validation failed. `message` is composed
53
+ * through {@link composeRemediatedMessage} at construction, so it is what
54
+ * reaches the wire as `tools/call`'s `content[0].text` (see that
55
+ * function's doc comment for why). @public
56
+ */
57
+ export declare class ConfigError extends ConfigError_base {}
58
+ declare const BundleNotFound_base: Schema.Class<BundleNotFound, Schema.TaggedStruct<"BundleNotFound", {
59
+ readonly root: Schema.String;
60
+ readonly message: Schema.String;
61
+ readonly remediation: Schema.Struct<{
62
+ readonly hint: Schema.String;
63
+ readonly suggestedTool: Schema.optionalKey<Schema.String>;
64
+ }>;
65
+ }>, import("effect/Cause").YieldableError>;
66
+ /**
67
+ * The configured bundle root does not exist or could not be read.
68
+ * `message` is composed through {@link composeRemediatedMessage} at
69
+ * construction, so it is what reaches the wire as `tools/call`'s
70
+ * `content[0].text`. @public
71
+ */
72
+ export declare class BundleNotFound extends BundleNotFound_base {}
73
+ declare const ConceptNotFound_base: Schema.Class<ConceptNotFound, Schema.TaggedStruct<"ConceptNotFound", {
74
+ readonly id: Schema.String;
75
+ readonly message: Schema.String;
76
+ readonly remediation: Schema.Struct<{
77
+ readonly hint: Schema.String;
78
+ readonly suggestedTool: Schema.optionalKey<Schema.String>;
79
+ }>;
80
+ }>, import("effect/Cause").YieldableError>;
81
+ /**
82
+ * No concept in the bundle has the requested id. `message` is composed
83
+ * through {@link composeRemediatedMessage} at construction, so it is what
84
+ * reaches the wire as `tools/call`'s `content[0].text`. @public
85
+ */
86
+ export declare class ConceptNotFound extends ConceptNotFound_base {}
87
+ declare const UnknownVocabulary_base: Schema.Class<UnknownVocabulary, Schema.TaggedStruct<"UnknownVocabulary", {
88
+ readonly kind: Schema.Literals<readonly ["type", "tag"]>;
89
+ readonly requested: Schema.String;
90
+ readonly valid: Schema.$Array<Schema.String>;
91
+ readonly message: Schema.String;
92
+ readonly remediation: Schema.Struct<{
93
+ readonly hint: Schema.String;
94
+ readonly suggestedTool: Schema.optionalKey<Schema.String>;
95
+ }>;
96
+ }>, import("effect/Cause").YieldableError>;
97
+ /**
98
+ * A requested type or tag name is not declared in the resolved config.
99
+ * `message` is composed through {@link composeRemediatedMessage} at
100
+ * construction, so it is what reaches the wire as `tools/call`'s
101
+ * `content[0].text`. @public
102
+ */
103
+ export declare class UnknownVocabulary extends UnknownVocabulary_base {}
104
+ declare const InvalidArgument_base: Schema.Class<InvalidArgument, Schema.TaggedStruct<"InvalidArgument", {
105
+ readonly argument: Schema.String;
106
+ readonly message: Schema.String;
107
+ readonly remediation: Schema.Struct<{
108
+ readonly hint: Schema.String;
109
+ readonly suggestedTool: Schema.optionalKey<Schema.String>;
110
+ }>;
111
+ }>, import("effect/Cause").YieldableError>;
112
+ /**
113
+ * A tool argument was structurally acceptable but semantically invalid.
114
+ * `message` is composed through {@link composeRemediatedMessage} at
115
+ * construction, so it is what reaches the wire as `tools/call`'s
116
+ * `content[0].text`. @public
117
+ */
118
+ export declare class InvalidArgument extends InvalidArgument_base {}
119
+ /** The one failure schema every tool declares (N-14). @public */
120
+ export declare const McpToolError: Schema.Union<readonly [typeof ConfigError, typeof BundleNotFound, typeof ConceptNotFound, typeof UnknownVocabulary, typeof InvalidArgument]>;
121
+ /** @public */
122
+ export type McpToolError = typeof McpToolError.Type;
123
+ //#endregion
124
+ //#region src/resources/conceptResource.d.ts
125
+ /**
126
+ * `okf://concept/<id>` — one static resource per concept in the bundle,
127
+ * built once at server start.
128
+ *
129
+ * Amends N-19 and contract §6.1 (Ruling, task C4): a `McpServer.resource`
130
+ * URI **template** routes a `McpSchema.param` through a single path
131
+ * segment only — `FindMyWay`'s parametric matcher stops a param at the
132
+ * next `/` (`.repos/effect/packages/effect/src/unstable/http/FindMyWay/internal/router.ts:355-360`),
133
+ * and every non-root OKF concept id nests under a type directory (D-12),
134
+ * e.g. `metrics/revenue`. A templated `okf://concept/{id}` therefore never
135
+ * routes a real bundle id. Static per-concept resources sidestep the
136
+ * router entirely: each concept gets its own literal `uri`, so there is
137
+ * no segment-spanning to fail.
138
+ *
139
+ * The list is fixed at server start (`loadToolContext` runs once, inside
140
+ * `Layer.unwrap`, not per read): a concept added after boot is not listed
141
+ * until the server restarts, though editing an already-listed concept's
142
+ * file is picked up live, since `content` re-reads the file from disk on
143
+ * every read (same complete text `get_concept`'s `raw` field returns).
144
+ *
145
+ * If the bundle fails to load at boot (bad config, missing bundle root),
146
+ * one line is logged and this layer contributes no resources — the
147
+ * six tools stay usable; only `okf://index` remains, since it is
148
+ * registered independently and re-resolves the bundle on every read.
149
+ *
150
+ * `content` builds the full `ReadResourceResult` itself, `mimeType`
151
+ * included, rather than returning a bare string: verified against source
152
+ * (`resolveResourceContent`, `unstable/ai/McpServer.ts:2324-2343`), a bare
153
+ * string is wrapped as `{ contents: [{ uri, text }] }` with no `mimeType`
154
+ * at all — the declared `mimeType` option only documents the resource in
155
+ * `resources/list`, it is never merged into a `resources/read` response.
156
+ *
157
+ * @public
158
+ */
159
+ export declare const ConceptResources: (projectRoot: string) => Layer.Layer<never, never, FileSystem.FileSystem | Path.Path | AppDirs | Xdg>;
160
+ //#endregion
161
+ //#region src/resources/indexResource.d.ts
162
+ /**
163
+ * `okf://index` — the bundle's root `index.md`, read from disk.
164
+ *
165
+ * This reads the file from disk, deliberately (J-7): `IndexDocument`
166
+ * carries only `{ path, dir, okfVersion?, sections }` — no raw-source
167
+ * field at all — so `bundle.indexes.get("")` cannot supply the raw
168
+ * markdown N-19 asks for. Reading the file also means a root `index.md`
169
+ * that failed to parse is still served, which is the more useful
170
+ * behaviour for an agent trying to fix it.
171
+ *
172
+ * A missing `index.md` fails the read rather than returning placeholder
173
+ * text (J-8): a resource that silently returns prose instead of the file
174
+ * it names is indistinguishable, to a model, from a bundle whose index
175
+ * really says that; §6.1 already fails an unknown id through the same
176
+ * channel.
177
+ *
178
+ * `content` builds the full `ReadResourceResult` itself, `mimeType`
179
+ * included, rather than returning a bare string: verified against source
180
+ * (`resolveResourceContent`, `unstable/ai/McpServer.ts:2324-2343`), a bare
181
+ * string is wrapped as `{ contents: [{ uri, text }] }` with no `mimeType`
182
+ * at all — the declared `mimeType` option only documents the resource in
183
+ * `resources/list`, it is never merged into a `resources/read` response.
184
+ *
185
+ * @public
186
+ */
187
+ export declare const IndexResource: (projectRoot: string) => import("effect/Layer").Layer<never, never, import("@effected/xdg").AppDirs | FileSystem.FileSystem | Path.Path | import("@effected/xdg").Xdg>;
188
+ //#endregion
189
+ //#region src/schema/ConceptSummary.d.ts
190
+ /** The seven-field shape every list-like tool result carries (N-16). @public */
191
+ export declare const ConceptSummary: Schema.Struct<{
192
+ readonly id: Schema.String;
193
+ readonly type: Schema.String;
194
+ readonly title: Schema.String;
195
+ readonly description: Schema.NullOr<Schema.String>;
196
+ readonly status: Schema.Literals<readonly ["draft", "stable", "deprecated"]>;
197
+ readonly tags: Schema.$Array<Schema.String>;
198
+ readonly path: Schema.String;
199
+ }>;
200
+ /** @public */
201
+ export type ConceptSummary = typeof ConceptSummary.Type;
202
+ /** Project one loaded concept into its summary. @public */
203
+ export declare const toConceptSummary: (concept: LoadedConcept) => ConceptSummary;
204
+ //#endregion
205
+ //#region src/schema/tools.d.ts
206
+ /** `describe_vocabulary`'s result (§5.2). @public */
207
+ export declare const DescribeVocabularySuccess: Schema.Struct<{
208
+ readonly project_root: Schema.String;
209
+ readonly bundle_root: Schema.String;
210
+ readonly config_path: Schema.NullOr<Schema.String>;
211
+ readonly profile: Schema.NullOr<Schema.String>;
212
+ readonly profile_requested: Schema.NullOr<Schema.String>;
213
+ readonly agent: Schema.NullOr<Schema.String>;
214
+ readonly types: Schema.$Array<Schema.Struct<{
215
+ readonly name: Schema.String;
216
+ readonly description: Schema.NullOr<Schema.String>;
217
+ readonly guidance: Schema.NullOr<Schema.String>;
218
+ }>>;
219
+ readonly tags: Schema.$Array<Schema.Struct<{
220
+ readonly name: Schema.String;
221
+ readonly description: Schema.NullOr<Schema.String>;
222
+ }>>;
223
+ }>;
224
+ /** @public */
225
+ export type DescribeVocabularySuccess = typeof DescribeVocabularySuccess.Type;
226
+ /** `list_concepts`' arguments (§5.3). @public */
227
+ export declare const ListConceptsParams: Schema.Struct<{
228
+ readonly type: Schema.optionalKey<Schema.String>;
229
+ readonly tags: Schema.optionalKey<Schema.$Array<Schema.String>>;
230
+ readonly status: Schema.optionalKey<Schema.Literals<readonly ["draft", "stable", "deprecated"]>>;
231
+ readonly limit: Schema.optionalKey<Schema.Int>;
232
+ readonly offset: Schema.optionalKey<Schema.Int>;
233
+ }>;
234
+ /** @public */
235
+ export type ListConceptsParams = typeof ListConceptsParams.Type;
236
+ /** `list_concepts`' result: the page, plus the match count before paging. @public */
237
+ export declare const ListConceptsSuccess: Schema.Struct<{
238
+ readonly items: Schema.$Array<Schema.Struct<{
239
+ readonly id: Schema.String;
240
+ readonly type: Schema.String;
241
+ readonly title: Schema.String;
242
+ readonly description: Schema.NullOr<Schema.String>;
243
+ readonly status: Schema.Literals<readonly ["draft", "stable", "deprecated"]>;
244
+ readonly tags: Schema.$Array<Schema.String>;
245
+ readonly path: Schema.String;
246
+ }>>;
247
+ readonly total: Schema.Int;
248
+ }>;
249
+ /** @public */
250
+ export type ListConceptsSuccess = typeof ListConceptsSuccess.Type;
251
+ /** `get_concept`'s result (§5.4). @public */
252
+ export declare const GetConceptSuccess: Schema.Struct<{
253
+ readonly id: Schema.String;
254
+ readonly type: Schema.String;
255
+ readonly title: Schema.String;
256
+ readonly description: Schema.NullOr<Schema.String>;
257
+ readonly status: Schema.Literals<readonly ["draft", "stable", "deprecated"]>;
258
+ readonly tags: Schema.$Array<Schema.String>;
259
+ readonly path: Schema.String;
260
+ readonly frontmatter: Schema.$Record<Schema.String, Schema.Unknown>;
261
+ readonly raw: Schema.String;
262
+ readonly links: Schema.$Array<Schema.Struct<{
263
+ readonly to: Schema.String;
264
+ readonly kind: Schema.Literals<readonly ["concept", "file", "missing"]>;
265
+ readonly source: Schema.Literals<readonly ["body", "frontmatter"]>;
266
+ readonly field: Schema.optionalKey<Schema.String>;
267
+ }>>;
268
+ }>;
269
+ /** @public */
270
+ export type GetConceptSuccess = typeof GetConceptSuccess.Type;
271
+ /** One graph neighbour: flat, with a nullable summary (J-4). @public */
272
+ export declare const Neighbor: Schema.Struct<{
273
+ readonly id: Schema.String;
274
+ readonly kind: Schema.Literals<readonly ["concept", "file", "missing"]>;
275
+ readonly summary: Schema.NullOr<Schema.Struct<{
276
+ readonly id: Schema.String;
277
+ readonly type: Schema.String;
278
+ readonly title: Schema.String;
279
+ readonly description: Schema.NullOr<Schema.String>;
280
+ readonly status: Schema.Literals<readonly ["draft", "stable", "deprecated"]>;
281
+ readonly tags: Schema.$Array<Schema.String>;
282
+ readonly path: Schema.String;
283
+ }>>;
284
+ }>;
285
+ /** @public */
286
+ export type Neighbor = typeof Neighbor.Type;
287
+ /** `concept_neighbors`' result (§5.5). @public */
288
+ export declare const ConceptNeighborsSuccess: Schema.Struct<{
289
+ readonly outgoing: Schema.$Array<Schema.Struct<{
290
+ readonly id: Schema.String;
291
+ readonly kind: Schema.Literals<readonly ["concept", "file", "missing"]>;
292
+ readonly summary: Schema.NullOr<Schema.Struct<{
293
+ readonly id: Schema.String;
294
+ readonly type: Schema.String;
295
+ readonly title: Schema.String;
296
+ readonly description: Schema.NullOr<Schema.String>;
297
+ readonly status: Schema.Literals<readonly ["draft", "stable", "deprecated"]>;
298
+ readonly tags: Schema.$Array<Schema.String>;
299
+ readonly path: Schema.String;
300
+ }>>;
301
+ }>>;
302
+ readonly incoming: Schema.$Array<Schema.Struct<{
303
+ readonly id: Schema.String;
304
+ readonly kind: Schema.Literals<readonly ["concept", "file", "missing"]>;
305
+ readonly summary: Schema.NullOr<Schema.Struct<{
306
+ readonly id: Schema.String;
307
+ readonly type: Schema.String;
308
+ readonly title: Schema.String;
309
+ readonly description: Schema.NullOr<Schema.String>;
310
+ readonly status: Schema.Literals<readonly ["draft", "stable", "deprecated"]>;
311
+ readonly tags: Schema.$Array<Schema.String>;
312
+ readonly path: Schema.String;
313
+ }>>;
314
+ }>>;
315
+ }>;
316
+ /** @public */
317
+ export type ConceptNeighborsSuccess = typeof ConceptNeighborsSuccess.Type;
318
+ /** `stale_report`'s arguments: an optional ISO instant, decoded in the handler (J-5). @public */
319
+ export declare const StaleReportParams: Schema.Struct<{
320
+ readonly now: Schema.optionalKey<Schema.String>;
321
+ }>;
322
+ /** @public */
323
+ export type StaleReportParams = typeof StaleReportParams.Type;
324
+ /** `stale_report`'s result (§5.6). @public */
325
+ export declare const StaleReportSuccess: Schema.Struct<{
326
+ readonly as_of: Schema.String;
327
+ readonly items: Schema.$Array<Schema.Struct<{
328
+ readonly summary: Schema.Struct<{
329
+ readonly id: Schema.String;
330
+ readonly type: Schema.String;
331
+ readonly title: Schema.String;
332
+ readonly description: Schema.NullOr<Schema.String>;
333
+ readonly status: Schema.Literals<readonly ["draft", "stable", "deprecated"]>;
334
+ readonly tags: Schema.$Array<Schema.String>;
335
+ readonly path: Schema.String;
336
+ }>;
337
+ readonly stale_after: Schema.String;
338
+ readonly days_past: Schema.Int;
339
+ }>>;
340
+ }>;
341
+ /** @public */
342
+ export type StaleReportSuccess = typeof StaleReportSuccess.Type;
343
+ /** `validate_bundle`'s arguments: the same shape and decode path as stale_report. @public */
344
+ export declare const ValidateBundleParams: Schema.Struct<{
345
+ readonly now: Schema.optionalKey<Schema.String>;
346
+ }>;
347
+ /** @public */
348
+ export type ValidateBundleParams = typeof ValidateBundleParams.Type;
349
+ //#endregion
350
+ //#region src/server.d.ts
351
+ /**
352
+ * Everything `ServerLayer` still needs from the platform: the four services
353
+ * `describe_vocabulary`'s declared `Tool.make` dependencies pull through
354
+ * `McpServer.toolkit`'s own `Tool.HandlerServices<Tools>` requirement, plus
355
+ * `Stdio`, which `McpServer.layerStdio` itself requires
356
+ * (`unstable/ai/McpServer.ts:1207-1216`) and which the brief's own
357
+ * `PlatformServices` literal omitted.
358
+ *
359
+ * `ChildProcessSpawner` is new (contract §10.3, S-16): `validate_bundle`'s
360
+ * `Git`/`GitHistory` dependencies (`tools/validateBundle.ts`) are
361
+ * discharged right here, below, by `Layer.mergeAll(Git.layer, GitHistory.layer)`
362
+ * — both need only `ChildProcessSpawner` (`GitHistory.layer` itself provides
363
+ * `Git.layer` internally, `packages/profiles/src/GitHistory.ts:136`), which
364
+ * `@okfit/engine`'s `OkfitPlatform` already supplies via
365
+ * `NodeServices.layer`. This type widening is the only thing that changes
366
+ * at that boundary.
367
+ *
368
+ * @public
6
369
  */
370
+ type PlatformServices = FileSystem.FileSystem | Path.Path | AppDirs | Xdg | Stdio.Stdio | ChildProcessSpawner.ChildProcessSpawner;
7
371
  /**
8
- * Message the stub bin writes to stderr until the server exists.
372
+ * The whole server as one layer: the toolkit, one static resource per
373
+ * concept (`okf://concept/<id>`, built once at boot — see
374
+ * {@link ConceptResources}), and `okf://index` (re-read from disk on every
375
+ * call), over `McpServer.layerStdio`.
376
+ *
377
+ * `protocols` ships BOTH adapters, newest first (N-2). Array order is
378
+ * load-bearing: the protocol registry falls back to `protocols[0]` for an
379
+ * unrecognised client version, so a 2026-07-28 client is answered with
380
+ * 2025-11-25. Never reduce this to one entry.
381
+ *
382
+ * `Cause.IllegalArgumentError` in `layerStdio`'s signature is left
383
+ * unhandled: `protocols` is a static two-element literal, so it is an
384
+ * implementer-time defect, not a runtime condition.
9
385
  *
10
386
  * @public
11
387
  */
12
- declare const NOT_IMPLEMENTED_MESSAGE = "okfit-mcp: the MCP server is not implemented yet. Track progress at https://github.com/spencerbeggs/okfit.";
388
+ export declare const ServerLayer: (projectRoot: string) => Layer.Layer<never, never, PlatformServices>;
389
+ //#endregion
390
+ //#region src/toolkit.d.ts
391
+ /**
392
+ * The six read-only tools (N-10). Tasks C1, C2 and C3 each add two; the
393
+ * order here is the tool set's own order and is what
394
+ * `agents/okf-docs.md`'s `tools:` allowlist mirrors.
395
+ *
396
+ * @public
397
+ */
398
+ export declare const OkfitToolkit: Toolkit.Toolkit<{
399
+ readonly concept_neighbors: import("effect/unstable/ai/Tool").Tool<"concept_neighbors", {
400
+ readonly parameters: import("effect/Schema").Struct<{
401
+ readonly id: import("effect/Schema").String;
402
+ }>;
403
+ readonly success: import("effect/Schema").Struct<{
404
+ readonly outgoing: import("effect/Schema").$Array<import("effect/Schema").Struct<{
405
+ readonly id: import("effect/Schema").String;
406
+ readonly kind: import("effect/Schema").Literals<readonly ["concept", "file", "missing"]>;
407
+ readonly summary: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
408
+ readonly id: import("effect/Schema").String;
409
+ readonly type: import("effect/Schema").String;
410
+ readonly title: import("effect/Schema").String;
411
+ readonly description: import("effect/Schema").NullOr<import("effect/Schema").String>;
412
+ readonly status: import("effect/Schema").Literals<readonly ["draft", "stable", "deprecated"]>;
413
+ readonly tags: import("effect/Schema").$Array<import("effect/Schema").String>;
414
+ readonly path: import("effect/Schema").String;
415
+ }>>;
416
+ }>>;
417
+ readonly incoming: import("effect/Schema").$Array<import("effect/Schema").Struct<{
418
+ readonly id: import("effect/Schema").String;
419
+ readonly kind: import("effect/Schema").Literals<readonly ["concept", "file", "missing"]>;
420
+ readonly summary: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
421
+ readonly id: import("effect/Schema").String;
422
+ readonly type: import("effect/Schema").String;
423
+ readonly title: import("effect/Schema").String;
424
+ readonly description: import("effect/Schema").NullOr<import("effect/Schema").String>;
425
+ readonly status: import("effect/Schema").Literals<readonly ["draft", "stable", "deprecated"]>;
426
+ readonly tags: import("effect/Schema").$Array<import("effect/Schema").String>;
427
+ readonly path: import("effect/Schema").String;
428
+ }>>;
429
+ }>>;
430
+ }>;
431
+ readonly failure: import("effect/Schema").Union<readonly [typeof ConfigError, typeof BundleNotFound, typeof ConceptNotFound, typeof UnknownVocabulary, typeof InvalidArgument]>;
432
+ readonly failureMode: "error";
433
+ }, import("@effected/xdg").AppDirs | import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("@effected/xdg").Xdg>;
434
+ readonly describe_vocabulary: import("effect/unstable/ai/Tool").Tool<"describe_vocabulary", {
435
+ readonly parameters: import("effect/unstable/ai/Tool").EmptyParams;
436
+ readonly success: import("effect/Schema").Struct<{
437
+ readonly project_root: import("effect/Schema").String;
438
+ readonly bundle_root: import("effect/Schema").String;
439
+ readonly config_path: import("effect/Schema").NullOr<import("effect/Schema").String>;
440
+ readonly profile: import("effect/Schema").NullOr<import("effect/Schema").String>;
441
+ readonly profile_requested: import("effect/Schema").NullOr<import("effect/Schema").String>;
442
+ readonly agent: import("effect/Schema").NullOr<import("effect/Schema").String>;
443
+ readonly types: import("effect/Schema").$Array<import("effect/Schema").Struct<{
444
+ readonly name: import("effect/Schema").String;
445
+ readonly description: import("effect/Schema").NullOr<import("effect/Schema").String>;
446
+ readonly guidance: import("effect/Schema").NullOr<import("effect/Schema").String>;
447
+ }>>;
448
+ readonly tags: import("effect/Schema").$Array<import("effect/Schema").Struct<{
449
+ readonly name: import("effect/Schema").String;
450
+ readonly description: import("effect/Schema").NullOr<import("effect/Schema").String>;
451
+ }>>;
452
+ }>;
453
+ readonly failure: import("effect/Schema").Union<readonly [typeof ConfigError, typeof BundleNotFound, typeof ConceptNotFound, typeof UnknownVocabulary, typeof InvalidArgument]>;
454
+ readonly failureMode: "error";
455
+ }, import("@effected/xdg").AppDirs | import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("@effected/xdg").Xdg>;
456
+ readonly get_concept: import("effect/unstable/ai/Tool").Tool<"get_concept", {
457
+ readonly parameters: import("effect/Schema").Struct<{
458
+ readonly id: import("effect/Schema").String;
459
+ }>;
460
+ readonly success: import("effect/Schema").Struct<{
461
+ readonly id: import("effect/Schema").String;
462
+ readonly type: import("effect/Schema").String;
463
+ readonly title: import("effect/Schema").String;
464
+ readonly description: import("effect/Schema").NullOr<import("effect/Schema").String>;
465
+ readonly status: import("effect/Schema").Literals<readonly ["draft", "stable", "deprecated"]>;
466
+ readonly tags: import("effect/Schema").$Array<import("effect/Schema").String>;
467
+ readonly path: import("effect/Schema").String;
468
+ readonly frontmatter: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>;
469
+ readonly raw: import("effect/Schema").String;
470
+ readonly links: import("effect/Schema").$Array<import("effect/Schema").Struct<{
471
+ readonly to: import("effect/Schema").String;
472
+ readonly kind: import("effect/Schema").Literals<readonly ["concept", "file", "missing"]>;
473
+ readonly source: import("effect/Schema").Literals<readonly ["body", "frontmatter"]>;
474
+ readonly field: import("effect/Schema").optionalKey<import("effect/Schema").String>;
475
+ }>>;
476
+ }>;
477
+ readonly failure: import("effect/Schema").Union<readonly [typeof ConfigError, typeof BundleNotFound, typeof ConceptNotFound, typeof UnknownVocabulary, typeof InvalidArgument]>;
478
+ readonly failureMode: "error";
479
+ }, import("@effected/xdg").AppDirs | import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("@effected/xdg").Xdg>;
480
+ readonly list_concepts: import("effect/unstable/ai/Tool").Tool<"list_concepts", {
481
+ readonly parameters: import("effect/Schema").Struct<{
482
+ readonly type: import("effect/Schema").optionalKey<import("effect/Schema").String>;
483
+ readonly tags: import("effect/Schema").optionalKey<import("effect/Schema").$Array<import("effect/Schema").String>>;
484
+ readonly status: import("effect/Schema").optionalKey<import("effect/Schema").Literals<readonly ["draft", "stable", "deprecated"]>>;
485
+ readonly limit: import("effect/Schema").optionalKey<import("effect/Schema").Int>;
486
+ readonly offset: import("effect/Schema").optionalKey<import("effect/Schema").Int>;
487
+ }>;
488
+ readonly success: import("effect/Schema").Struct<{
489
+ readonly items: import("effect/Schema").$Array<import("effect/Schema").Struct<{
490
+ readonly id: import("effect/Schema").String;
491
+ readonly type: import("effect/Schema").String;
492
+ readonly title: import("effect/Schema").String;
493
+ readonly description: import("effect/Schema").NullOr<import("effect/Schema").String>;
494
+ readonly status: import("effect/Schema").Literals<readonly ["draft", "stable", "deprecated"]>;
495
+ readonly tags: import("effect/Schema").$Array<import("effect/Schema").String>;
496
+ readonly path: import("effect/Schema").String;
497
+ }>>;
498
+ readonly total: import("effect/Schema").Int;
499
+ }>;
500
+ readonly failure: import("effect/Schema").Union<readonly [typeof ConfigError, typeof BundleNotFound, typeof ConceptNotFound, typeof UnknownVocabulary, typeof InvalidArgument]>;
501
+ readonly failureMode: "error";
502
+ }, import("@effected/xdg").AppDirs | import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("@effected/xdg").Xdg>;
503
+ readonly stale_report: import("effect/unstable/ai/Tool").Tool<"stale_report", {
504
+ readonly parameters: import("effect/Schema").Struct<{
505
+ readonly now: import("effect/Schema").optionalKey<import("effect/Schema").String>;
506
+ }>;
507
+ readonly success: import("effect/Schema").Struct<{
508
+ readonly as_of: import("effect/Schema").String;
509
+ readonly items: import("effect/Schema").$Array<import("effect/Schema").Struct<{
510
+ readonly summary: import("effect/Schema").Struct<{
511
+ readonly id: import("effect/Schema").String;
512
+ readonly type: import("effect/Schema").String;
513
+ readonly title: import("effect/Schema").String;
514
+ readonly description: import("effect/Schema").NullOr<import("effect/Schema").String>;
515
+ readonly status: import("effect/Schema").Literals<readonly ["draft", "stable", "deprecated"]>;
516
+ readonly tags: import("effect/Schema").$Array<import("effect/Schema").String>;
517
+ readonly path: import("effect/Schema").String;
518
+ }>;
519
+ readonly stale_after: import("effect/Schema").String;
520
+ readonly days_past: import("effect/Schema").Int;
521
+ }>>;
522
+ }>;
523
+ readonly failure: import("effect/Schema").Union<readonly [typeof ConfigError, typeof BundleNotFound, typeof ConceptNotFound, typeof UnknownVocabulary, typeof InvalidArgument]>;
524
+ readonly failureMode: "error";
525
+ }, import("@effected/xdg").AppDirs | import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("@effected/xdg").Xdg>;
526
+ readonly validate_bundle: import("effect/unstable/ai/Tool").Tool<"validate_bundle", {
527
+ readonly parameters: import("effect/Schema").Struct<{
528
+ readonly now: import("effect/Schema").optionalKey<import("effect/Schema").String>;
529
+ }>;
530
+ readonly success: import("effect/Schema").Struct<{
531
+ readonly schema: import("effect/Schema").Literal<1>;
532
+ readonly okfit_version: import("effect/Schema").String;
533
+ readonly okf_version: import("effect/Schema").String;
534
+ readonly root: import("effect/Schema").String;
535
+ readonly profile: import("effect/Schema").NullOr<import("effect/Schema").String>;
536
+ readonly exit_code: import("effect/Schema").Literals<readonly [0, 1, 2]>;
537
+ readonly summary: import("effect/Schema").Struct<{
538
+ readonly conformance_errors: import("effect/Schema").Number;
539
+ readonly lint_errors: import("effect/Schema").Number;
540
+ readonly lint_warnings: import("effect/Schema").Number;
541
+ readonly lint_info: import("effect/Schema").Number;
542
+ readonly profile_errors: import("effect/Schema").Number;
543
+ readonly concepts: import("effect/Schema").Number;
544
+ }>;
545
+ readonly diagnostics: import("effect/Schema").$Array<import("effect/Schema").Struct<{
546
+ readonly source: import("effect/Schema").Literals<readonly ["core.conformance", "core.lint", "profile"]>;
547
+ readonly file: import("effect/Schema").String;
548
+ readonly code: import("effect/Schema").String;
549
+ readonly severity: import("effect/Schema").Literals<readonly ["error", "warning", "info"]>;
550
+ readonly message: import("effect/Schema").String;
551
+ readonly range: import("effect/Schema").optionalKey<typeof import("@okfit/core").DiagnosticRange>;
552
+ }>>;
553
+ }>;
554
+ readonly failure: import("effect/Schema").Union<readonly [typeof ConfigError, typeof BundleNotFound, typeof ConceptNotFound, typeof UnknownVocabulary, typeof InvalidArgument]>;
555
+ readonly failureMode: "error";
556
+ }, import("@effected/xdg").AppDirs | import("effect/FileSystem").FileSystem | import("@effected/git").Git | import("@okfit/profiles").GitHistory | import("effect/Path").Path | import("@effected/xdg").Xdg>;
557
+ }>;
558
+ /**
559
+ * The handler layer. `projectRoot` is closed over from the bin (N-21);
560
+ * the bundle itself reloads on every call inside each handler (N-9).
561
+ *
562
+ * @public
563
+ */
564
+ export declare const ToolsLayer: (projectRoot: string) => import("effect/Layer").Layer<import("effect/unstable/ai/Tool").HandlersFor<{
565
+ readonly concept_neighbors: import("effect/unstable/ai/Tool").Tool<"concept_neighbors", {
566
+ readonly parameters: import("effect/Schema").Struct<{
567
+ readonly id: import("effect/Schema").String;
568
+ }>;
569
+ readonly success: import("effect/Schema").Struct<{
570
+ readonly outgoing: import("effect/Schema").$Array<import("effect/Schema").Struct<{
571
+ readonly id: import("effect/Schema").String;
572
+ readonly kind: import("effect/Schema").Literals<readonly ["concept", "file", "missing"]>;
573
+ readonly summary: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
574
+ readonly id: import("effect/Schema").String;
575
+ readonly type: import("effect/Schema").String;
576
+ readonly title: import("effect/Schema").String;
577
+ readonly description: import("effect/Schema").NullOr<import("effect/Schema").String>;
578
+ readonly status: import("effect/Schema").Literals<readonly ["draft", "stable", "deprecated"]>;
579
+ readonly tags: import("effect/Schema").$Array<import("effect/Schema").String>;
580
+ readonly path: import("effect/Schema").String;
581
+ }>>;
582
+ }>>;
583
+ readonly incoming: import("effect/Schema").$Array<import("effect/Schema").Struct<{
584
+ readonly id: import("effect/Schema").String;
585
+ readonly kind: import("effect/Schema").Literals<readonly ["concept", "file", "missing"]>;
586
+ readonly summary: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
587
+ readonly id: import("effect/Schema").String;
588
+ readonly type: import("effect/Schema").String;
589
+ readonly title: import("effect/Schema").String;
590
+ readonly description: import("effect/Schema").NullOr<import("effect/Schema").String>;
591
+ readonly status: import("effect/Schema").Literals<readonly ["draft", "stable", "deprecated"]>;
592
+ readonly tags: import("effect/Schema").$Array<import("effect/Schema").String>;
593
+ readonly path: import("effect/Schema").String;
594
+ }>>;
595
+ }>>;
596
+ }>;
597
+ readonly failure: import("effect/Schema").Union<readonly [typeof ConfigError, typeof BundleNotFound, typeof ConceptNotFound, typeof UnknownVocabulary, typeof InvalidArgument]>;
598
+ readonly failureMode: "error";
599
+ }, import("@effected/xdg").AppDirs | import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("@effected/xdg").Xdg>;
600
+ readonly describe_vocabulary: import("effect/unstable/ai/Tool").Tool<"describe_vocabulary", {
601
+ readonly parameters: import("effect/unstable/ai/Tool").EmptyParams;
602
+ readonly success: import("effect/Schema").Struct<{
603
+ readonly project_root: import("effect/Schema").String;
604
+ readonly bundle_root: import("effect/Schema").String;
605
+ readonly config_path: import("effect/Schema").NullOr<import("effect/Schema").String>;
606
+ readonly profile: import("effect/Schema").NullOr<import("effect/Schema").String>;
607
+ readonly profile_requested: import("effect/Schema").NullOr<import("effect/Schema").String>;
608
+ readonly agent: import("effect/Schema").NullOr<import("effect/Schema").String>;
609
+ readonly types: import("effect/Schema").$Array<import("effect/Schema").Struct<{
610
+ readonly name: import("effect/Schema").String;
611
+ readonly description: import("effect/Schema").NullOr<import("effect/Schema").String>;
612
+ readonly guidance: import("effect/Schema").NullOr<import("effect/Schema").String>;
613
+ }>>;
614
+ readonly tags: import("effect/Schema").$Array<import("effect/Schema").Struct<{
615
+ readonly name: import("effect/Schema").String;
616
+ readonly description: import("effect/Schema").NullOr<import("effect/Schema").String>;
617
+ }>>;
618
+ }>;
619
+ readonly failure: import("effect/Schema").Union<readonly [typeof ConfigError, typeof BundleNotFound, typeof ConceptNotFound, typeof UnknownVocabulary, typeof InvalidArgument]>;
620
+ readonly failureMode: "error";
621
+ }, import("@effected/xdg").AppDirs | import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("@effected/xdg").Xdg>;
622
+ readonly get_concept: import("effect/unstable/ai/Tool").Tool<"get_concept", {
623
+ readonly parameters: import("effect/Schema").Struct<{
624
+ readonly id: import("effect/Schema").String;
625
+ }>;
626
+ readonly success: import("effect/Schema").Struct<{
627
+ readonly id: import("effect/Schema").String;
628
+ readonly type: import("effect/Schema").String;
629
+ readonly title: import("effect/Schema").String;
630
+ readonly description: import("effect/Schema").NullOr<import("effect/Schema").String>;
631
+ readonly status: import("effect/Schema").Literals<readonly ["draft", "stable", "deprecated"]>;
632
+ readonly tags: import("effect/Schema").$Array<import("effect/Schema").String>;
633
+ readonly path: import("effect/Schema").String;
634
+ readonly frontmatter: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>;
635
+ readonly raw: import("effect/Schema").String;
636
+ readonly links: import("effect/Schema").$Array<import("effect/Schema").Struct<{
637
+ readonly to: import("effect/Schema").String;
638
+ readonly kind: import("effect/Schema").Literals<readonly ["concept", "file", "missing"]>;
639
+ readonly source: import("effect/Schema").Literals<readonly ["body", "frontmatter"]>;
640
+ readonly field: import("effect/Schema").optionalKey<import("effect/Schema").String>;
641
+ }>>;
642
+ }>;
643
+ readonly failure: import("effect/Schema").Union<readonly [typeof ConfigError, typeof BundleNotFound, typeof ConceptNotFound, typeof UnknownVocabulary, typeof InvalidArgument]>;
644
+ readonly failureMode: "error";
645
+ }, import("@effected/xdg").AppDirs | import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("@effected/xdg").Xdg>;
646
+ readonly list_concepts: import("effect/unstable/ai/Tool").Tool<"list_concepts", {
647
+ readonly parameters: import("effect/Schema").Struct<{
648
+ readonly type: import("effect/Schema").optionalKey<import("effect/Schema").String>;
649
+ readonly tags: import("effect/Schema").optionalKey<import("effect/Schema").$Array<import("effect/Schema").String>>;
650
+ readonly status: import("effect/Schema").optionalKey<import("effect/Schema").Literals<readonly ["draft", "stable", "deprecated"]>>;
651
+ readonly limit: import("effect/Schema").optionalKey<import("effect/Schema").Int>;
652
+ readonly offset: import("effect/Schema").optionalKey<import("effect/Schema").Int>;
653
+ }>;
654
+ readonly success: import("effect/Schema").Struct<{
655
+ readonly items: import("effect/Schema").$Array<import("effect/Schema").Struct<{
656
+ readonly id: import("effect/Schema").String;
657
+ readonly type: import("effect/Schema").String;
658
+ readonly title: import("effect/Schema").String;
659
+ readonly description: import("effect/Schema").NullOr<import("effect/Schema").String>;
660
+ readonly status: import("effect/Schema").Literals<readonly ["draft", "stable", "deprecated"]>;
661
+ readonly tags: import("effect/Schema").$Array<import("effect/Schema").String>;
662
+ readonly path: import("effect/Schema").String;
663
+ }>>;
664
+ readonly total: import("effect/Schema").Int;
665
+ }>;
666
+ readonly failure: import("effect/Schema").Union<readonly [typeof ConfigError, typeof BundleNotFound, typeof ConceptNotFound, typeof UnknownVocabulary, typeof InvalidArgument]>;
667
+ readonly failureMode: "error";
668
+ }, import("@effected/xdg").AppDirs | import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("@effected/xdg").Xdg>;
669
+ readonly stale_report: import("effect/unstable/ai/Tool").Tool<"stale_report", {
670
+ readonly parameters: import("effect/Schema").Struct<{
671
+ readonly now: import("effect/Schema").optionalKey<import("effect/Schema").String>;
672
+ }>;
673
+ readonly success: import("effect/Schema").Struct<{
674
+ readonly as_of: import("effect/Schema").String;
675
+ readonly items: import("effect/Schema").$Array<import("effect/Schema").Struct<{
676
+ readonly summary: import("effect/Schema").Struct<{
677
+ readonly id: import("effect/Schema").String;
678
+ readonly type: import("effect/Schema").String;
679
+ readonly title: import("effect/Schema").String;
680
+ readonly description: import("effect/Schema").NullOr<import("effect/Schema").String>;
681
+ readonly status: import("effect/Schema").Literals<readonly ["draft", "stable", "deprecated"]>;
682
+ readonly tags: import("effect/Schema").$Array<import("effect/Schema").String>;
683
+ readonly path: import("effect/Schema").String;
684
+ }>;
685
+ readonly stale_after: import("effect/Schema").String;
686
+ readonly days_past: import("effect/Schema").Int;
687
+ }>>;
688
+ }>;
689
+ readonly failure: import("effect/Schema").Union<readonly [typeof ConfigError, typeof BundleNotFound, typeof ConceptNotFound, typeof UnknownVocabulary, typeof InvalidArgument]>;
690
+ readonly failureMode: "error";
691
+ }, import("@effected/xdg").AppDirs | import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("@effected/xdg").Xdg>;
692
+ readonly validate_bundle: import("effect/unstable/ai/Tool").Tool<"validate_bundle", {
693
+ readonly parameters: import("effect/Schema").Struct<{
694
+ readonly now: import("effect/Schema").optionalKey<import("effect/Schema").String>;
695
+ }>;
696
+ readonly success: import("effect/Schema").Struct<{
697
+ readonly schema: import("effect/Schema").Literal<1>;
698
+ readonly okfit_version: import("effect/Schema").String;
699
+ readonly okf_version: import("effect/Schema").String;
700
+ readonly root: import("effect/Schema").String;
701
+ readonly profile: import("effect/Schema").NullOr<import("effect/Schema").String>;
702
+ readonly exit_code: import("effect/Schema").Literals<readonly [0, 1, 2]>;
703
+ readonly summary: import("effect/Schema").Struct<{
704
+ readonly conformance_errors: import("effect/Schema").Number;
705
+ readonly lint_errors: import("effect/Schema").Number;
706
+ readonly lint_warnings: import("effect/Schema").Number;
707
+ readonly lint_info: import("effect/Schema").Number;
708
+ readonly profile_errors: import("effect/Schema").Number;
709
+ readonly concepts: import("effect/Schema").Number;
710
+ }>;
711
+ readonly diagnostics: import("effect/Schema").$Array<import("effect/Schema").Struct<{
712
+ readonly source: import("effect/Schema").Literals<readonly ["core.conformance", "core.lint", "profile"]>;
713
+ readonly file: import("effect/Schema").String;
714
+ readonly code: import("effect/Schema").String;
715
+ readonly severity: import("effect/Schema").Literals<readonly ["error", "warning", "info"]>;
716
+ readonly message: import("effect/Schema").String;
717
+ readonly range: import("effect/Schema").optionalKey<typeof import("@okfit/core").DiagnosticRange>;
718
+ }>>;
719
+ }>;
720
+ readonly failure: import("effect/Schema").Union<readonly [typeof ConfigError, typeof BundleNotFound, typeof ConceptNotFound, typeof UnknownVocabulary, typeof InvalidArgument]>;
721
+ readonly failureMode: "error";
722
+ }, import("@effected/xdg").AppDirs | import("effect/FileSystem").FileSystem | import("@effected/git").Git | import("@okfit/profiles").GitHistory | import("effect/Path").Path | import("@effected/xdg").Xdg>;
723
+ }>, never, never>;
724
+ //#endregion
725
+ //#region src/version.d.ts
13
726
  /**
14
- * Exit code the stub bin uses.
727
+ * The version this server reports in `initialize`. Injected by
728
+ * `@savvy-web/bundler` at build time (K-32); `"0.0.0"` in unbuilt source.
15
729
  *
16
730
  * @public
17
731
  */
18
- declare const NOT_IMPLEMENTED_EXIT_CODE = 1;
732
+ export declare const MCP_VERSION: string;
19
733
  //#endregion
20
- export { NOT_IMPLEMENTED_EXIT_CODE, NOT_IMPLEMENTED_MESSAGE };
734
+ export type { PlatformServices };
21
735
  //# sourceMappingURL=index.d.ts.map