@okfit/mcp 0.10.0 → 0.11.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 +57 -28
- package/internal/toolContext.js +3 -14
- package/internal/toolSignals.js +2 -2
- package/package.json +19 -18
- package/resources/indexResource.js +9 -3
- package/server.js +8 -3
- package/toolkit.js +19 -8
- package/tools/conceptNeighbors.js +6 -13
- package/tools/describeVocabulary.js +6 -15
- package/tools/getConcept.js +6 -15
- package/tools/listConcepts.js +6 -16
- package/tools/staleReport.js +6 -15
- package/tools/validateBundle.js +12 -28
- package/tsdoc-metadata.json +1 -1
- package/version.js +1 -1
package/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Remediation } from "@effected/engine";
|
|
2
2
|
import { ToolRefusal } from "@effected/mcp";
|
|
3
3
|
import { AppDirs, Xdg } from "@effected/xdg";
|
|
4
|
-
import { FileSystem, Layer, Path, Schema, Stdio } from "effect";
|
|
4
|
+
import { FileSystem, Layer, Path, Schema, Scope, Stdio } from "effect";
|
|
5
|
+
import { McpServer, Toolkit } from "effect/ai";
|
|
5
6
|
import { ConceptSummary, Distribution, toConceptSummary } from "@okfit/engine";
|
|
7
|
+
import { Digest } from "effect/crypto";
|
|
6
8
|
import { ChildProcessSpawner } from "effect/process";
|
|
7
|
-
import {
|
|
9
|
+
import { Git } from "@effected/git";
|
|
10
|
+
import { GitHistory } from "@okfit/profiles";
|
|
8
11
|
/**
|
|
9
12
|
* The one failure schema every tool declares (N-14): `ToolRefusal` from
|
|
10
13
|
* `@effected/mcp`.
|
|
@@ -55,7 +58,7 @@ export type McpToolError = ToolRefusal;
|
|
|
55
58
|
*
|
|
56
59
|
* @public
|
|
57
60
|
*/
|
|
58
|
-
export declare const ConceptResources: (projectRoot: string) => Layer.Layer<never, never, FileSystem.FileSystem | Path.Path | AppDirs | Xdg>;
|
|
61
|
+
export declare const ConceptResources: (projectRoot: string) => Layer.Layer<never, never, FileSystem.FileSystem | Path.Path | AppDirs | Xdg | McpServer.McpServer>;
|
|
59
62
|
/**
|
|
60
63
|
* `okf://index` — the bundle's root `index.md`, read from disk.
|
|
61
64
|
*
|
|
@@ -79,9 +82,14 @@ export declare const ConceptResources: (projectRoot: string) => Layer.Layer<neve
|
|
|
79
82
|
* at all — the declared `mimeType` option only documents the resource in
|
|
80
83
|
* `resources/list`, it is never merged into a `resources/read` response.
|
|
81
84
|
*
|
|
85
|
+
* The platform services `content` reads are captured once when the layer
|
|
86
|
+
* builds and provided to every read: since Effect 4.1 a resource handler's
|
|
87
|
+
* services are request-level `McpRequest<"Requires", S>` requirements, and
|
|
88
|
+
* these are fixed for the server's lifetime.
|
|
89
|
+
*
|
|
82
90
|
* @public
|
|
83
91
|
*/
|
|
84
|
-
export declare const IndexResource: (projectRoot: string) =>
|
|
92
|
+
export declare const IndexResource: (projectRoot: string) => Layer.Layer<never, never, FileSystem.FileSystem | Path.Path | AppDirs | Xdg | McpServer.McpServer>;
|
|
85
93
|
/** One Surface template inside a docs preset, as `describe_vocabulary` reports it. @public */
|
|
86
94
|
export declare const DocsPresetSurface: Schema.Struct<{
|
|
87
95
|
readonly file: Schema.String;
|
|
@@ -250,7 +258,7 @@ export declare const GetConceptFound: Schema.Struct<{
|
|
|
250
258
|
readonly integrity: Schema.Literals<readonly ["current", "drifted", "none"]>;
|
|
251
259
|
readonly stale: Schema.Boolean;
|
|
252
260
|
readonly drift: Schema.NullOr<Schema.Struct<{
|
|
253
|
-
readonly reason: Schema.Literals<readonly ["content-changed", "unbound", "entry-superseded", "actor-not-allowed"]>;
|
|
261
|
+
readonly reason: Schema.Literals<readonly ["content-changed", "unbound", "entry-superseded", "actor-not-allowed", "content-unhashable"]>;
|
|
254
262
|
readonly edited_by: Schema.NullOr<Schema.String>;
|
|
255
263
|
readonly edited_at: Schema.NullOr<Schema.String>;
|
|
256
264
|
}>>;
|
|
@@ -279,7 +287,7 @@ export declare const GetConceptSuccess: Schema.Union<readonly [Schema.Struct<{
|
|
|
279
287
|
readonly integrity: Schema.Literals<readonly ["current", "drifted", "none"]>;
|
|
280
288
|
readonly stale: Schema.Boolean;
|
|
281
289
|
readonly drift: Schema.NullOr<Schema.Struct<{
|
|
282
|
-
readonly reason: Schema.Literals<readonly ["content-changed", "unbound", "entry-superseded", "actor-not-allowed"]>;
|
|
290
|
+
readonly reason: Schema.Literals<readonly ["content-changed", "unbound", "entry-superseded", "actor-not-allowed", "content-unhashable"]>;
|
|
283
291
|
readonly edited_by: Schema.NullOr<Schema.String>;
|
|
284
292
|
readonly edited_at: Schema.NullOr<Schema.String>;
|
|
285
293
|
}>>;
|
|
@@ -449,7 +457,7 @@ export declare const StaleReportSuccess: Schema.Struct<{
|
|
|
449
457
|
readonly integrity: Schema.Literals<readonly ["current", "drifted", "none"]>;
|
|
450
458
|
readonly stale: Schema.Boolean;
|
|
451
459
|
}>;
|
|
452
|
-
readonly reason: Schema.Literals<readonly ["content-changed", "unbound", "entry-superseded", "actor-not-allowed"]>;
|
|
460
|
+
readonly reason: Schema.Literals<readonly ["content-changed", "unbound", "entry-superseded", "actor-not-allowed", "content-unhashable"]>;
|
|
453
461
|
readonly edited_by: Schema.NullOr<Schema.String>;
|
|
454
462
|
readonly edited_at: Schema.NullOr<Schema.String>;
|
|
455
463
|
}>>;
|
|
@@ -480,11 +488,13 @@ export type ValidateBundleParams = typeof ValidateBundleParams.Type;
|
|
|
480
488
|
* `Git.layer` internally, `packages/profiles/src/GitHistory.ts:136`), which
|
|
481
489
|
* `@okfit/engine`'s `OkfitPlatform` already supplies via
|
|
482
490
|
* `NodeServices.layer`. This type widening is the only thing that changes
|
|
483
|
-
* at that boundary.
|
|
491
|
+
* at that boundary. `Digest` (Effect 4.1's `effect/crypto`) feeds every body
|
|
492
|
+
* and content digest; `OkfitPlatform` supplies it through
|
|
493
|
+
* `NodeCrypto.layerDigest`, since `NodeServices.layer` no longer carries crypto.
|
|
484
494
|
*
|
|
485
495
|
* @public
|
|
486
496
|
*/
|
|
487
|
-
type PlatformServices = FileSystem.FileSystem | Path.Path | AppDirs | Xdg | Stdio.Stdio | ChildProcessSpawner.ChildProcessSpawner;
|
|
497
|
+
type PlatformServices = FileSystem.FileSystem | Path.Path | AppDirs | Xdg | Stdio.Stdio | ChildProcessSpawner.ChildProcessSpawner | Digest.Digest;
|
|
488
498
|
/**
|
|
489
499
|
* Options `ServerLayer` accepts, beyond `projectRoot`. `distribution`
|
|
490
500
|
* (okfit #137) names the meta-package that launched this server (currently
|
|
@@ -525,6 +535,10 @@ export declare const SERVER_INSTRUCTIONS: string;
|
|
|
525
535
|
* call carries, at every depth, in one response, instead of only the
|
|
526
536
|
* first.
|
|
527
537
|
*
|
|
538
|
+
* The toolkit and resources go in as `McpStdio.layer`'s `registrations`
|
|
539
|
+
* (Effect 4.1's shape): they build before the server reads its first
|
|
540
|
+
* request, and their build-time logs go to stderr, never onto the wire.
|
|
541
|
+
*
|
|
528
542
|
* `protocols` ships three adapters, newest first -- the same list
|
|
529
543
|
* `McpStdio.protocols` defaults to, spelled out here since the decision
|
|
530
544
|
* behind the exact order is this package's own
|
|
@@ -543,7 +557,7 @@ export declare const SERVER_INSTRUCTIONS: string;
|
|
|
543
557
|
*
|
|
544
558
|
* @public
|
|
545
559
|
*/
|
|
546
|
-
export declare const ServerLayer: (projectRoot: string, options?: ServerOptions) => Layer.Layer<
|
|
560
|
+
export declare const ServerLayer: (projectRoot: string, options?: ServerOptions) => Layer.Layer<McpServer.McpServer | McpServer.McpRequest<"Requires", Scope.Scope>, never, PlatformServices>;
|
|
547
561
|
/**
|
|
548
562
|
* The six read-only tools (N-10). Tasks C1, C2 and C3 each add two; the
|
|
549
563
|
* order here is the tool set's own order and is what
|
|
@@ -608,7 +622,7 @@ export declare const OkfitToolkit: Toolkit.Toolkit<{
|
|
|
608
622
|
}>]>;
|
|
609
623
|
readonly failure: typeof import("@effected/mcp").ToolRefusal;
|
|
610
624
|
readonly failureMode: "error";
|
|
611
|
-
},
|
|
625
|
+
}, never>;
|
|
612
626
|
readonly describe_vocabulary: import("effect/ai/Tool").Tool<"describe_vocabulary", {
|
|
613
627
|
readonly parameters: import("effect/ai/Tool").EmptyParams;
|
|
614
628
|
readonly success: import("effect/Schema").Struct<{
|
|
@@ -661,7 +675,7 @@ export declare const OkfitToolkit: Toolkit.Toolkit<{
|
|
|
661
675
|
}>;
|
|
662
676
|
readonly failure: typeof import("@effected/mcp").ToolRefusal;
|
|
663
677
|
readonly failureMode: "error";
|
|
664
|
-
},
|
|
678
|
+
}, never>;
|
|
665
679
|
readonly get_concept: import("effect/ai/Tool").Tool<"get_concept", {
|
|
666
680
|
readonly parameters: import("effect/Schema").Struct<{
|
|
667
681
|
readonly id: import("effect/Schema").String;
|
|
@@ -687,7 +701,7 @@ export declare const OkfitToolkit: Toolkit.Toolkit<{
|
|
|
687
701
|
readonly integrity: import("effect/Schema").Literals<readonly ["current", "drifted", "none"]>;
|
|
688
702
|
readonly stale: import("effect/Schema").Boolean;
|
|
689
703
|
readonly drift: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
690
|
-
readonly reason: import("effect/Schema").Literals<readonly ["content-changed", "unbound", "entry-superseded", "actor-not-allowed"]>;
|
|
704
|
+
readonly reason: import("effect/Schema").Literals<readonly ["content-changed", "unbound", "entry-superseded", "actor-not-allowed", "content-unhashable"]>;
|
|
691
705
|
readonly edited_by: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
692
706
|
readonly edited_at: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
693
707
|
}>>;
|
|
@@ -709,7 +723,7 @@ export declare const OkfitToolkit: Toolkit.Toolkit<{
|
|
|
709
723
|
}>]>;
|
|
710
724
|
readonly failure: typeof import("@effected/mcp").ToolRefusal;
|
|
711
725
|
readonly failureMode: "error";
|
|
712
|
-
},
|
|
726
|
+
}, never>;
|
|
713
727
|
readonly list_concepts: import("effect/ai/Tool").Tool<"list_concepts", {
|
|
714
728
|
readonly parameters: import("effect/Schema").Struct<{
|
|
715
729
|
readonly type: import("effect/Schema").optionalKey<import("effect/Schema").String>;
|
|
@@ -739,7 +753,7 @@ export declare const OkfitToolkit: Toolkit.Toolkit<{
|
|
|
739
753
|
}>;
|
|
740
754
|
readonly failure: typeof import("@effected/mcp").ToolRefusal;
|
|
741
755
|
readonly failureMode: "error";
|
|
742
|
-
},
|
|
756
|
+
}, never>;
|
|
743
757
|
readonly stale_report: import("effect/ai/Tool").Tool<"stale_report", {
|
|
744
758
|
readonly parameters: import("effect/Schema").Struct<{
|
|
745
759
|
readonly now: import("effect/Schema").optionalKey<import("effect/Schema").String>;
|
|
@@ -775,14 +789,14 @@ export declare const OkfitToolkit: Toolkit.Toolkit<{
|
|
|
775
789
|
readonly integrity: import("effect/Schema").Literals<readonly ["current", "drifted", "none"]>;
|
|
776
790
|
readonly stale: import("effect/Schema").Boolean;
|
|
777
791
|
}>;
|
|
778
|
-
readonly reason: import("effect/Schema").Literals<readonly ["content-changed", "unbound", "entry-superseded", "actor-not-allowed"]>;
|
|
792
|
+
readonly reason: import("effect/Schema").Literals<readonly ["content-changed", "unbound", "entry-superseded", "actor-not-allowed", "content-unhashable"]>;
|
|
779
793
|
readonly edited_by: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
780
794
|
readonly edited_at: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
781
795
|
}>>;
|
|
782
796
|
}>;
|
|
783
797
|
readonly failure: typeof import("@effected/mcp").ToolRefusal;
|
|
784
798
|
readonly failureMode: "error";
|
|
785
|
-
},
|
|
799
|
+
}, never>;
|
|
786
800
|
readonly validate_bundle: import("effect/ai/Tool").Tool<"validate_bundle", {
|
|
787
801
|
readonly parameters: import("effect/Schema").Struct<{
|
|
788
802
|
readonly now: import("effect/Schema").optionalKey<import("effect/Schema").String>;
|
|
@@ -823,8 +837,17 @@ export declare const OkfitToolkit: Toolkit.Toolkit<{
|
|
|
823
837
|
}>;
|
|
824
838
|
readonly failure: typeof import("@effected/mcp").ToolRefusal;
|
|
825
839
|
readonly failureMode: "error";
|
|
826
|
-
},
|
|
840
|
+
}, never>;
|
|
827
841
|
}>;
|
|
842
|
+
/**
|
|
843
|
+
* The platform services the six handlers run on: config and bundle loading
|
|
844
|
+
* (`FileSystem`, `Path`, `AppDirs`, `Xdg`), the body and content digests
|
|
845
|
+
* (`Digest`), and `validate_bundle`'s `generated-at-drift` lint (`Git`,
|
|
846
|
+
* `GitHistory`).
|
|
847
|
+
*
|
|
848
|
+
* @public
|
|
849
|
+
*/
|
|
850
|
+
type ToolServices = FileSystem.FileSystem | Path.Path | AppDirs | Xdg | Digest.Digest | Git | GitHistory;
|
|
828
851
|
/**
|
|
829
852
|
* The handler layer. `projectRoot` is closed over from the bin (N-21);
|
|
830
853
|
* the bundle itself reloads on every call inside each handler (N-9).
|
|
@@ -832,6 +855,12 @@ export declare const OkfitToolkit: Toolkit.Toolkit<{
|
|
|
832
855
|
* `validate_bundle` renders a `JsonEnvelope`, so it is the only handler
|
|
833
856
|
* that needs it.
|
|
834
857
|
*
|
|
858
|
+
* The {@link ToolServices} are captured once, when this layer builds, and
|
|
859
|
+
* provided to every call. Since Effect 4.1 a tool's declared `dependencies`
|
|
860
|
+
* become per-request `McpRequest<"Requires", S>` requirements, which a
|
|
861
|
+
* plain `Layer.provide` no longer meets; these services are fixed for the
|
|
862
|
+
* server's lifetime, so the build-time capture is the shape that fits.
|
|
863
|
+
*
|
|
835
864
|
* @public
|
|
836
865
|
*/
|
|
837
866
|
export declare const ToolsLayer: (projectRoot: string, distribution?: Distribution) => import("effect/Layer").Layer<import("effect/ai/Tool").HandlersFor<{
|
|
@@ -891,7 +920,7 @@ export declare const ToolsLayer: (projectRoot: string, distribution?: Distributi
|
|
|
891
920
|
}>]>;
|
|
892
921
|
readonly failure: typeof import("@effected/mcp").ToolRefusal;
|
|
893
922
|
readonly failureMode: "error";
|
|
894
|
-
},
|
|
923
|
+
}, never>;
|
|
895
924
|
readonly describe_vocabulary: import("effect/ai/Tool").Tool<"describe_vocabulary", {
|
|
896
925
|
readonly parameters: import("effect/ai/Tool").EmptyParams;
|
|
897
926
|
readonly success: import("effect/Schema").Struct<{
|
|
@@ -944,7 +973,7 @@ export declare const ToolsLayer: (projectRoot: string, distribution?: Distributi
|
|
|
944
973
|
}>;
|
|
945
974
|
readonly failure: typeof import("@effected/mcp").ToolRefusal;
|
|
946
975
|
readonly failureMode: "error";
|
|
947
|
-
},
|
|
976
|
+
}, never>;
|
|
948
977
|
readonly get_concept: import("effect/ai/Tool").Tool<"get_concept", {
|
|
949
978
|
readonly parameters: import("effect/Schema").Struct<{
|
|
950
979
|
readonly id: import("effect/Schema").String;
|
|
@@ -970,7 +999,7 @@ export declare const ToolsLayer: (projectRoot: string, distribution?: Distributi
|
|
|
970
999
|
readonly integrity: import("effect/Schema").Literals<readonly ["current", "drifted", "none"]>;
|
|
971
1000
|
readonly stale: import("effect/Schema").Boolean;
|
|
972
1001
|
readonly drift: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
973
|
-
readonly reason: import("effect/Schema").Literals<readonly ["content-changed", "unbound", "entry-superseded", "actor-not-allowed"]>;
|
|
1002
|
+
readonly reason: import("effect/Schema").Literals<readonly ["content-changed", "unbound", "entry-superseded", "actor-not-allowed", "content-unhashable"]>;
|
|
974
1003
|
readonly edited_by: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
975
1004
|
readonly edited_at: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
976
1005
|
}>>;
|
|
@@ -992,7 +1021,7 @@ export declare const ToolsLayer: (projectRoot: string, distribution?: Distributi
|
|
|
992
1021
|
}>]>;
|
|
993
1022
|
readonly failure: typeof import("@effected/mcp").ToolRefusal;
|
|
994
1023
|
readonly failureMode: "error";
|
|
995
|
-
},
|
|
1024
|
+
}, never>;
|
|
996
1025
|
readonly list_concepts: import("effect/ai/Tool").Tool<"list_concepts", {
|
|
997
1026
|
readonly parameters: import("effect/Schema").Struct<{
|
|
998
1027
|
readonly type: import("effect/Schema").optionalKey<import("effect/Schema").String>;
|
|
@@ -1022,7 +1051,7 @@ export declare const ToolsLayer: (projectRoot: string, distribution?: Distributi
|
|
|
1022
1051
|
}>;
|
|
1023
1052
|
readonly failure: typeof import("@effected/mcp").ToolRefusal;
|
|
1024
1053
|
readonly failureMode: "error";
|
|
1025
|
-
},
|
|
1054
|
+
}, never>;
|
|
1026
1055
|
readonly stale_report: import("effect/ai/Tool").Tool<"stale_report", {
|
|
1027
1056
|
readonly parameters: import("effect/Schema").Struct<{
|
|
1028
1057
|
readonly now: import("effect/Schema").optionalKey<import("effect/Schema").String>;
|
|
@@ -1058,14 +1087,14 @@ export declare const ToolsLayer: (projectRoot: string, distribution?: Distributi
|
|
|
1058
1087
|
readonly integrity: import("effect/Schema").Literals<readonly ["current", "drifted", "none"]>;
|
|
1059
1088
|
readonly stale: import("effect/Schema").Boolean;
|
|
1060
1089
|
}>;
|
|
1061
|
-
readonly reason: import("effect/Schema").Literals<readonly ["content-changed", "unbound", "entry-superseded", "actor-not-allowed"]>;
|
|
1090
|
+
readonly reason: import("effect/Schema").Literals<readonly ["content-changed", "unbound", "entry-superseded", "actor-not-allowed", "content-unhashable"]>;
|
|
1062
1091
|
readonly edited_by: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
1063
1092
|
readonly edited_at: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
1064
1093
|
}>>;
|
|
1065
1094
|
}>;
|
|
1066
1095
|
readonly failure: typeof import("@effected/mcp").ToolRefusal;
|
|
1067
1096
|
readonly failureMode: "error";
|
|
1068
|
-
},
|
|
1097
|
+
}, never>;
|
|
1069
1098
|
readonly validate_bundle: import("effect/ai/Tool").Tool<"validate_bundle", {
|
|
1070
1099
|
readonly parameters: import("effect/Schema").Struct<{
|
|
1071
1100
|
readonly now: import("effect/Schema").optionalKey<import("effect/Schema").String>;
|
|
@@ -1106,8 +1135,8 @@ export declare const ToolsLayer: (projectRoot: string, distribution?: Distributi
|
|
|
1106
1135
|
}>;
|
|
1107
1136
|
readonly failure: typeof import("@effected/mcp").ToolRefusal;
|
|
1108
1137
|
readonly failureMode: "error";
|
|
1109
|
-
},
|
|
1110
|
-
}>, never,
|
|
1138
|
+
}, never>;
|
|
1139
|
+
}>, never, ToolServices>;
|
|
1111
1140
|
/**
|
|
1112
1141
|
* The version this server reports in `initialize`. Injected by
|
|
1113
1142
|
* `@savvy-web/bundler` at build time (K-32); `"0.0.0"` in unbuilt source.
|
|
@@ -1115,5 +1144,5 @@ export declare const ToolsLayer: (projectRoot: string, distribution?: Distributi
|
|
|
1115
1144
|
* @public
|
|
1116
1145
|
*/
|
|
1117
1146
|
export declare const MCP_VERSION: string;
|
|
1118
|
-
export { ConceptSummary, type PlatformServices, Remediation, type ServerOptions, toConceptSummary };
|
|
1147
|
+
export { ConceptSummary, type PlatformServices, Remediation, type ServerOptions, type ToolServices, toConceptSummary };
|
|
1119
1148
|
//# sourceMappingURL=index.d.ts.map
|
package/internal/toolContext.js
CHANGED
|
@@ -1,21 +1,10 @@
|
|
|
1
|
+
import { ErrorText } from "@effected/engine";
|
|
1
2
|
import { ToolRefusal } from "@effected/mcp";
|
|
2
3
|
import { Bundle } from "@okfit/core";
|
|
3
4
|
import { Effect, Option } from "effect";
|
|
4
5
|
import { provideConfig, resolveProjectConfig } from "@okfit/engine";
|
|
5
6
|
|
|
6
7
|
// src/internal/toolContext.ts
|
|
7
|
-
/**
|
|
8
|
-
* The error's `message` when it has one as a string, else `String(error)`.
|
|
9
|
-
* A four-line local copy of `CLI/render/json.ts`'s own helper, which is
|
|
10
|
-
* module-private there and cannot be imported.
|
|
11
|
-
*/
|
|
12
|
-
const messageOf = (error) => {
|
|
13
|
-
if (typeof error === "object" && error !== null && "message" in error) {
|
|
14
|
-
const message = error.message;
|
|
15
|
-
if (typeof message === "string") return message;
|
|
16
|
-
}
|
|
17
|
-
return String(error);
|
|
18
|
-
};
|
|
19
8
|
const CONFIG_HINT = "Check the project's .okfit.toml, okfit.toml, or .config/okfit.toml for a syntax or schema error; remove it to fall back to defaults.";
|
|
20
9
|
/**
|
|
21
10
|
* Config resolution alone, with every failure collapsed to a `ToolRefusal`.
|
|
@@ -42,7 +31,7 @@ const resolveConfigOnly = (projectRoot) => resolveProjectConfig({
|
|
|
42
31
|
hint: CONFIG_HINT,
|
|
43
32
|
suggestedTool: "describe_vocabulary"
|
|
44
33
|
};
|
|
45
|
-
return ToolRefusal.refuse(
|
|
34
|
+
return ToolRefusal.refuse(ErrorText.describe(cause), remediation);
|
|
46
35
|
}));
|
|
47
36
|
/**
|
|
48
37
|
* Resolve config and load the bundle, fresh, for one tool call (N-9). No
|
|
@@ -66,4 +55,4 @@ const loadToolContext = (projectRoot) => Effect.gen(function* () {
|
|
|
66
55
|
};
|
|
67
56
|
});
|
|
68
57
|
|
|
69
|
-
export { loadToolContext,
|
|
58
|
+
export { loadToolContext, resolveConfigOnly };
|
package/internal/toolSignals.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ErrorText } from "@effected/engine";
|
|
2
2
|
import { ToolRefusal } from "@effected/mcp";
|
|
3
3
|
import { Effect } from "effect";
|
|
4
4
|
import { Trust } from "@okfit/profiles";
|
|
@@ -10,6 +10,6 @@ import { Trust } from "@okfit/profiles";
|
|
|
10
10
|
*
|
|
11
11
|
* @internal
|
|
12
12
|
*/
|
|
13
|
-
const toolSignals = (bundle, config, now) => Trust.signals(bundle, config, now).pipe(Effect.mapError((cause) => ToolRefusal.refuse(
|
|
13
|
+
const toolSignals = (bundle, config, now) => Trust.signals(bundle, config, now).pipe(Effect.mapError((cause) => ToolRefusal.refuse(ErrorText.describe(cause), { hint: "A concept file could not be read to check its verification; retry once the bundle is readable." })));
|
|
14
14
|
|
|
15
15
|
export { toolSignals };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@okfit/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Model Context Protocol server for okfit: query and understand Open Knowledge Format (OKF) bundles from an agent.",
|
|
6
6
|
"keywords": [
|
|
@@ -44,23 +44,24 @@
|
|
|
44
44
|
"okfit-mcp": "bin/okfit-mcp.js"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@effect/platform-node": "
|
|
48
|
-
"@effected/config-file": "^0.
|
|
49
|
-
"@effected/engine": "^0.
|
|
50
|
-
"@effected/git": "^0.
|
|
51
|
-
"@effected/glob": "^0.
|
|
52
|
-
"@effected/jsonc": "^0.
|
|
53
|
-
"@effected/markdown": "^0.
|
|
54
|
-
"@effected/mcp": "^0.
|
|
55
|
-
"@effected/schemastore": "^0.
|
|
56
|
-
"@effected/
|
|
57
|
-
"@effected/
|
|
58
|
-
"@effected/
|
|
59
|
-
"@effected/
|
|
60
|
-
"@
|
|
61
|
-
"@okfit/
|
|
62
|
-
"@okfit/
|
|
63
|
-
"
|
|
47
|
+
"@effect/platform-node": "~4.1.1",
|
|
48
|
+
"@effected/config-file": "^0.23.0",
|
|
49
|
+
"@effected/engine": "^0.11.0",
|
|
50
|
+
"@effected/git": "^0.29.0",
|
|
51
|
+
"@effected/glob": "^0.17.0",
|
|
52
|
+
"@effected/jsonc": "^0.22.0",
|
|
53
|
+
"@effected/markdown": "^0.25.0",
|
|
54
|
+
"@effected/mcp": "^0.12.0",
|
|
55
|
+
"@effected/schemastore": "^0.28.0",
|
|
56
|
+
"@effected/source": "^0.2.0",
|
|
57
|
+
"@effected/toml": "^0.18.0",
|
|
58
|
+
"@effected/walker": "^0.24.0",
|
|
59
|
+
"@effected/xdg": "^0.18.0",
|
|
60
|
+
"@effected/yaml": "^0.27.0",
|
|
61
|
+
"@okfit/core": "0.12.0",
|
|
62
|
+
"@okfit/engine": "0.19.0",
|
|
63
|
+
"@okfit/profiles": "0.14.0",
|
|
64
|
+
"effect": "~4.1.1"
|
|
64
65
|
},
|
|
65
66
|
"engines": {
|
|
66
67
|
"node": ">=24.11.0"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { loadToolContext } from "../internal/toolContext.js";
|
|
2
|
-
import { Effect, FileSystem, Path } from "effect";
|
|
2
|
+
import { Effect, FileSystem, Layer, Path } from "effect";
|
|
3
3
|
import { McpSchema, McpServer } from "effect/ai";
|
|
4
4
|
|
|
5
5
|
// src/resources/indexResource.ts
|
|
@@ -26,9 +26,15 @@ import { McpSchema, McpServer } from "effect/ai";
|
|
|
26
26
|
* at all — the declared `mimeType` option only documents the resource in
|
|
27
27
|
* `resources/list`, it is never merged into a `resources/read` response.
|
|
28
28
|
*
|
|
29
|
+
* The platform services `content` reads are captured once when the layer
|
|
30
|
+
* builds and provided to every read: since Effect 4.1 a resource handler's
|
|
31
|
+
* services are request-level `McpRequest<"Requires", S>` requirements, and
|
|
32
|
+
* these are fixed for the server's lifetime.
|
|
33
|
+
*
|
|
29
34
|
* @public
|
|
30
35
|
*/
|
|
31
|
-
const IndexResource = (projectRoot) =>
|
|
36
|
+
const IndexResource = (projectRoot) => Layer.unwrap(Effect.map(Effect.context(), (services) => indexResource(projectRoot, services)));
|
|
37
|
+
const indexResource = (projectRoot, services) => McpServer.resource({
|
|
32
38
|
uri: "okf://index",
|
|
33
39
|
name: "OKF bundle index",
|
|
34
40
|
description: "The bundle's root index.md — the entry point for orienting on this OKF bundle.",
|
|
@@ -42,7 +48,7 @@ const IndexResource = (projectRoot) => McpServer.resource({
|
|
|
42
48
|
mimeType: "text/markdown",
|
|
43
49
|
text: yield* fs.readFileString(indexPath).pipe(Effect.mapError(() => new McpSchema.InternalError({ message: `no readable index.md at ${indexPath}` })))
|
|
44
50
|
}] };
|
|
45
|
-
})
|
|
51
|
+
}).pipe(Effect.provide(services))
|
|
46
52
|
});
|
|
47
53
|
|
|
48
54
|
export { IndexResource };
|
package/server.js
CHANGED
|
@@ -52,6 +52,10 @@ const SERVER_INSTRUCTIONS = [
|
|
|
52
52
|
* call carries, at every depth, in one response, instead of only the
|
|
53
53
|
* first.
|
|
54
54
|
*
|
|
55
|
+
* The toolkit and resources go in as `McpStdio.layer`'s `registrations`
|
|
56
|
+
* (Effect 4.1's shape): they build before the server reads its first
|
|
57
|
+
* request, and their build-time logs go to stderr, never onto the wire.
|
|
58
|
+
*
|
|
55
59
|
* `protocols` ships three adapters, newest first -- the same list
|
|
56
60
|
* `McpStdio.protocols` defaults to, spelled out here since the decision
|
|
57
61
|
* behind the exact order is this package's own
|
|
@@ -70,7 +74,7 @@ const SERVER_INSTRUCTIONS = [
|
|
|
70
74
|
*
|
|
71
75
|
* @public
|
|
72
76
|
*/
|
|
73
|
-
const ServerLayer = (projectRoot, options = {}) =>
|
|
77
|
+
const ServerLayer = (projectRoot, options = {}) => McpStdio.layer({
|
|
74
78
|
name: "okfit",
|
|
75
79
|
version: MCP_VERSION,
|
|
76
80
|
instructions: SERVER_INSTRUCTIONS,
|
|
@@ -78,7 +82,8 @@ const ServerLayer = (projectRoot, options = {}) => Layer.mergeAll(McpToolkit.lay
|
|
|
78
82
|
McpProtocol.v2026_07_28,
|
|
79
83
|
McpProtocol.v2025_11_25,
|
|
80
84
|
McpProtocol.v2025_06_18
|
|
81
|
-
]
|
|
82
|
-
|
|
85
|
+
],
|
|
86
|
+
registrations: Layer.mergeAll(McpToolkit.layer(OkfitToolkit).pipe(Layer.provide(ToolsLayer(projectRoot, options.distribution))), ConceptResources(projectRoot), IndexResource(projectRoot)).pipe(Layer.provide(Layer.mergeAll(Git.layer, GitHistory.layer)))
|
|
87
|
+
});
|
|
83
88
|
|
|
84
89
|
export { SERVER_INSTRUCTIONS, ServerLayer };
|
package/toolkit.js
CHANGED
|
@@ -4,6 +4,7 @@ import { getConcept, handleGetConcept } from "./tools/getConcept.js";
|
|
|
4
4
|
import { handleListConcepts, listConcepts } from "./tools/listConcepts.js";
|
|
5
5
|
import { handleStaleReport, staleReport } from "./tools/staleReport.js";
|
|
6
6
|
import { handleValidateBundle, validateBundle } from "./tools/validateBundle.js";
|
|
7
|
+
import { Effect } from "effect";
|
|
7
8
|
import { Toolkit } from "effect/ai";
|
|
8
9
|
|
|
9
10
|
// src/toolkit.ts
|
|
@@ -22,15 +23,25 @@ const OkfitToolkit = Toolkit.make(describeVocabulary, listConcepts, getConcept,
|
|
|
22
23
|
* `validate_bundle` renders a `JsonEnvelope`, so it is the only handler
|
|
23
24
|
* that needs it.
|
|
24
25
|
*
|
|
26
|
+
* The {@link ToolServices} are captured once, when this layer builds, and
|
|
27
|
+
* provided to every call. Since Effect 4.1 a tool's declared `dependencies`
|
|
28
|
+
* become per-request `McpRequest<"Requires", S>` requirements, which a
|
|
29
|
+
* plain `Layer.provide` no longer meets; these services are fixed for the
|
|
30
|
+
* server's lifetime, so the build-time capture is the shape that fits.
|
|
31
|
+
*
|
|
25
32
|
* @public
|
|
26
33
|
*/
|
|
27
|
-
const ToolsLayer = (projectRoot, distribution) => OkfitToolkit.toLayer({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
const ToolsLayer = (projectRoot, distribution) => OkfitToolkit.toLayer(Effect.gen(function* () {
|
|
35
|
+
const services = yield* Effect.context();
|
|
36
|
+
const provide = (effect) => Effect.provide(effect, services);
|
|
37
|
+
return {
|
|
38
|
+
describe_vocabulary: () => provide(handleDescribeVocabulary(projectRoot)),
|
|
39
|
+
list_concepts: (params) => provide(handleListConcepts(projectRoot, params)),
|
|
40
|
+
get_concept: (params) => provide(handleGetConcept(projectRoot, params)),
|
|
41
|
+
concept_neighbors: (params) => provide(handleConceptNeighbors(projectRoot, params)),
|
|
42
|
+
stale_report: (params) => provide(handleStaleReport(projectRoot, params)),
|
|
43
|
+
validate_bundle: (params) => provide(handleValidateBundle(projectRoot, params, distribution))
|
|
44
|
+
};
|
|
45
|
+
}));
|
|
35
46
|
|
|
36
47
|
export { OkfitToolkit, ToolsLayer };
|
|
@@ -5,17 +5,17 @@ import { ConceptNeighborsSuccess } from "../schema/tools.js";
|
|
|
5
5
|
import { conceptNotFound } from "../internal/conceptNotFound.js";
|
|
6
6
|
import { toolSignals } from "../internal/toolSignals.js";
|
|
7
7
|
import { ToolOutcome } from "@effected/mcp";
|
|
8
|
-
import {
|
|
8
|
+
import { DateTime, Effect, Schema } from "effect";
|
|
9
9
|
import { Tool } from "effect/ai";
|
|
10
10
|
import { ConceptQuery, signalFor } from "@okfit/engine";
|
|
11
|
-
import { AppDirs, Xdg } from "@effected/xdg";
|
|
12
11
|
|
|
13
12
|
// src/tools/conceptNeighbors.ts
|
|
14
13
|
const DESCRIPTION = "Returns the graph neighbours of one concept: everything it links to (outgoing) and everything that links to it (incoming), each with the node kind and, for a concept target, its full summary. Use it after get_concept to walk the bundle's link graph one hop at a time without loading every concept.";
|
|
15
14
|
/**
|
|
16
|
-
* `dependencies
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* No `dependencies`: since Effect 4.1 a declared dependency becomes a
|
|
16
|
+
* per-request `McpRequest<"Requires", S>` requirement. The platform services
|
|
17
|
+
* the handler needs are captured once when `ToolsLayer` builds instead
|
|
18
|
+
* (`toolkit.ts`), so the handler's own requirement channel is `never`.
|
|
19
19
|
*
|
|
20
20
|
* @public
|
|
21
21
|
*/
|
|
@@ -23,14 +23,7 @@ const conceptNeighbors = Tool.make("concept_neighbors", {
|
|
|
23
23
|
description: DESCRIPTION,
|
|
24
24
|
parameters: Schema.Struct({ id: Schema.String }),
|
|
25
25
|
success: ConceptNeighborsSuccess,
|
|
26
|
-
failure: McpToolError
|
|
27
|
-
dependencies: [
|
|
28
|
-
FileSystem.FileSystem,
|
|
29
|
-
Path.Path,
|
|
30
|
-
AppDirs,
|
|
31
|
-
Xdg,
|
|
32
|
-
Crypto.Crypto
|
|
33
|
-
]
|
|
26
|
+
failure: McpToolError
|
|
34
27
|
}).annotate(Tool.Title, "Concept graph neighbors").annotate(Tool.Readonly, true).annotate(Tool.Idempotent, true).annotate(Tool.OpenWorld, false);
|
|
35
28
|
/**
|
|
36
29
|
* An unknown or empty id is an expected outcome, not a wrong call: it is
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { McpToolError } from "../errors.js";
|
|
2
2
|
import { resolveConfigOnly } from "../internal/toolContext.js";
|
|
3
3
|
import { DescribeVocabularySuccess } from "../schema/tools.js";
|
|
4
|
-
import { Effect,
|
|
4
|
+
import { Effect, Option } from "effect";
|
|
5
5
|
import { Tool } from "effect/ai";
|
|
6
6
|
import { contextEnvelope } from "@okfit/engine";
|
|
7
|
-
import { AppDirs, Xdg } from "@effected/xdg";
|
|
8
7
|
|
|
9
8
|
// src/tools/describeVocabulary.ts
|
|
10
9
|
const DESCRIPTION = "Returns this project's resolved okfit configuration: project root, bundle root, active profile, agent actor, every concept type and tag the config declares, and docs_presets, the active profile's Surface templates (empty without a profile). Call this first, before filtering or writing any concept, to learn which names exist.";
|
|
11
10
|
/**
|
|
12
|
-
* `dependencies
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* (verified against `.repos/effect/packages/effect/src/ai/Tool.ts`
|
|
17
|
-
* `dependencies`/`HandlerServices`; not spelled out in the brief's snippet).
|
|
11
|
+
* No `dependencies`: since Effect 4.1 a declared dependency becomes a
|
|
12
|
+
* per-request `McpRequest<"Requires", S>` requirement. The platform services
|
|
13
|
+
* the handler needs are captured once when `ToolsLayer` builds instead
|
|
14
|
+
* (`toolkit.ts`), so the handler's own requirement channel is `never`.
|
|
18
15
|
*
|
|
19
16
|
* `parameters` is `Tool.EmptyParams`, not the brief's `Schema.Struct({})`:
|
|
20
17
|
* a zero-key `Schema.Struct` fails `McpServer.layerStdio`'s build with a
|
|
@@ -30,13 +27,7 @@ const describeVocabulary = Tool.make("describe_vocabulary", {
|
|
|
30
27
|
description: DESCRIPTION,
|
|
31
28
|
parameters: Tool.EmptyParams,
|
|
32
29
|
success: DescribeVocabularySuccess,
|
|
33
|
-
failure: McpToolError
|
|
34
|
-
dependencies: [
|
|
35
|
-
FileSystem.FileSystem,
|
|
36
|
-
Path.Path,
|
|
37
|
-
AppDirs,
|
|
38
|
-
Xdg
|
|
39
|
-
]
|
|
30
|
+
failure: McpToolError
|
|
40
31
|
}).annotate(Tool.Title, "Describe okfit vocabulary").annotate(Tool.Readonly, true).annotate(Tool.Idempotent, true).annotate(Tool.OpenWorld, false);
|
|
41
32
|
/** @public */
|
|
42
33
|
const handleDescribeVocabulary = (projectRoot) => Effect.gen(function* () {
|
package/tools/getConcept.js
CHANGED
|
@@ -5,19 +5,17 @@ import { conceptNotFound } from "../internal/conceptNotFound.js";
|
|
|
5
5
|
import { toolSignals } from "../internal/toolSignals.js";
|
|
6
6
|
import { ToolOutcome } from "@effected/mcp";
|
|
7
7
|
import { Derive } from "@okfit/core";
|
|
8
|
-
import {
|
|
8
|
+
import { DateTime, Effect, Schema } from "effect";
|
|
9
9
|
import { Tool } from "effect/ai";
|
|
10
10
|
import { ConceptQuery, signalFor, toTrustDrift } from "@okfit/engine";
|
|
11
|
-
import { AppDirs, Xdg } from "@effected/xdg";
|
|
12
11
|
|
|
13
12
|
// src/tools/getConcept.ts
|
|
14
13
|
const DESCRIPTION = "Returns one concept by id: its decoded frontmatter, raw markdown, bundle-relative path, every outgoing link (with where it was written and whether the target is a concept, a file, or missing), and its okfit trust signal: tier, integrity, stale and drift. Accepts a tolerant id, with or without a leading slash or trailing .md.";
|
|
15
14
|
/**
|
|
16
|
-
* `dependencies
|
|
17
|
-
*
|
|
18
|
-
* the
|
|
19
|
-
* `
|
|
20
|
-
* `HandlersFrom` when it is passed to `OkfitToolkit.toLayer`.
|
|
15
|
+
* No `dependencies`: since Effect 4.1 a declared dependency becomes a
|
|
16
|
+
* per-request `McpRequest<"Requires", S>` requirement. The platform services
|
|
17
|
+
* the handler needs are captured once when `ToolsLayer` builds instead
|
|
18
|
+
* (`toolkit.ts`), so the handler's own requirement channel is `never`.
|
|
21
19
|
*
|
|
22
20
|
* @public
|
|
23
21
|
*/
|
|
@@ -25,14 +23,7 @@ const getConcept = Tool.make("get_concept", {
|
|
|
25
23
|
description: DESCRIPTION,
|
|
26
24
|
parameters: Schema.Struct({ id: Schema.String }),
|
|
27
25
|
success: GetConceptSuccess,
|
|
28
|
-
failure: McpToolError
|
|
29
|
-
dependencies: [
|
|
30
|
-
FileSystem.FileSystem,
|
|
31
|
-
Path.Path,
|
|
32
|
-
AppDirs,
|
|
33
|
-
Xdg,
|
|
34
|
-
Crypto.Crypto
|
|
35
|
-
]
|
|
26
|
+
failure: McpToolError
|
|
36
27
|
}).annotate(Tool.Title, "Get one OKF concept").annotate(Tool.Readonly, true).annotate(Tool.Idempotent, true).annotate(Tool.OpenWorld, false);
|
|
37
28
|
/**
|
|
38
29
|
* An unknown or empty id is an expected outcome, not a wrong call: it is
|
package/tools/listConcepts.js
CHANGED
|
@@ -5,20 +5,17 @@ import { ListConceptsParams, ListConceptsSuccess } from "../schema/tools.js";
|
|
|
5
5
|
import { toolSignals } from "../internal/toolSignals.js";
|
|
6
6
|
import { resolveNow } from "../internal/resolveNow.js";
|
|
7
7
|
import { ToolFailure, ToolRefusal } from "@effected/mcp";
|
|
8
|
-
import {
|
|
8
|
+
import { Effect } from "effect";
|
|
9
9
|
import { Tool } from "effect/ai";
|
|
10
10
|
import { ConceptQuery, signalFor } from "@okfit/engine";
|
|
11
|
-
import { AppDirs, Xdg } from "@effected/xdg";
|
|
12
11
|
|
|
13
12
|
// src/tools/listConcepts.ts
|
|
14
13
|
const DESCRIPTION = "Lists concept summaries, filtered by exact type, tags that must all be present (AND), status, verified (true: current human verification; false: never verified), drifted or stale. Each summary carries tier, integrity and stale. now (ISO-8601 with offset) sets the staleness time. Pages by limit (default 200, max 1000) and offset, with total. An unknown type or tag fails with the valid names.";
|
|
15
14
|
/**
|
|
16
|
-
* `dependencies
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* `
|
|
20
|
-
* `Tool.HandlerServices` infers `never`, failing the handler record against
|
|
21
|
-
* `HandlersFrom` when it is passed to `OkfitToolkit.toLayer`.
|
|
15
|
+
* No `dependencies`: since Effect 4.1 a declared dependency becomes a
|
|
16
|
+
* per-request `McpRequest<"Requires", S>` requirement. The platform services
|
|
17
|
+
* the handler needs are captured once when `ToolsLayer` builds instead
|
|
18
|
+
* (`toolkit.ts`), so the handler's own requirement channel is `never`.
|
|
22
19
|
*
|
|
23
20
|
* @public
|
|
24
21
|
*/
|
|
@@ -26,14 +23,7 @@ const listConcepts = Tool.make("list_concepts", {
|
|
|
26
23
|
description: DESCRIPTION,
|
|
27
24
|
parameters: ListConceptsParams,
|
|
28
25
|
success: ListConceptsSuccess,
|
|
29
|
-
failure: McpToolError
|
|
30
|
-
dependencies: [
|
|
31
|
-
FileSystem.FileSystem,
|
|
32
|
-
Path.Path,
|
|
33
|
-
AppDirs,
|
|
34
|
-
Xdg,
|
|
35
|
-
Crypto.Crypto
|
|
36
|
-
]
|
|
26
|
+
failure: McpToolError
|
|
37
27
|
}).annotate(Tool.Title, "List OKF concepts").annotate(Tool.Readonly, true).annotate(Tool.Idempotent, true).annotate(Tool.OpenWorld, false);
|
|
38
28
|
/**
|
|
39
29
|
* Deviation from the brief's literal snippet: `message` is composed through
|
package/tools/staleReport.js
CHANGED
|
@@ -5,19 +5,17 @@ import { StaleReportParams, StaleReportSuccess } from "../schema/tools.js";
|
|
|
5
5
|
import { toolSignals } from "../internal/toolSignals.js";
|
|
6
6
|
import { resolveNow } from "../internal/resolveNow.js";
|
|
7
7
|
import { Derive } from "@okfit/core";
|
|
8
|
-
import {
|
|
8
|
+
import { DateTime, Effect } from "effect";
|
|
9
9
|
import { Tool } from "effect/ai";
|
|
10
10
|
import { signalFor, toTrustDrift } from "@okfit/engine";
|
|
11
|
-
import { AppDirs, Xdg } from "@effected/xdg";
|
|
12
11
|
|
|
13
12
|
// src/tools/staleReport.ts
|
|
14
13
|
const DESCRIPTION = "Lists every stale or drifted concept. items: stale_after passed, each with its summary, the date and whole days past. drifted: human-verified concepts whose content changed since (or was never bound), with the reason and last editor. Uses the current time unless now is given (ISO-8601 with an explicit offset).";
|
|
15
14
|
/**
|
|
16
|
-
* `dependencies
|
|
17
|
-
* `
|
|
18
|
-
*
|
|
19
|
-
* the handler
|
|
20
|
-
* `OkfitToolkit.toLayer`.
|
|
15
|
+
* No `dependencies`: since Effect 4.1 a declared dependency becomes a
|
|
16
|
+
* per-request `McpRequest<"Requires", S>` requirement. The platform services
|
|
17
|
+
* the handler needs are captured once when `ToolsLayer` builds instead
|
|
18
|
+
* (`toolkit.ts`), so the handler's own requirement channel is `never`.
|
|
21
19
|
*
|
|
22
20
|
* @public
|
|
23
21
|
*/
|
|
@@ -25,14 +23,7 @@ const staleReport = Tool.make("stale_report", {
|
|
|
25
23
|
description: DESCRIPTION,
|
|
26
24
|
parameters: StaleReportParams,
|
|
27
25
|
success: StaleReportSuccess,
|
|
28
|
-
failure: McpToolError
|
|
29
|
-
dependencies: [
|
|
30
|
-
FileSystem.FileSystem,
|
|
31
|
-
Path.Path,
|
|
32
|
-
AppDirs,
|
|
33
|
-
Xdg,
|
|
34
|
-
Crypto.Crypto
|
|
35
|
-
]
|
|
26
|
+
failure: McpToolError
|
|
36
27
|
}).annotate(Tool.Title, "Stale concepts").annotate(Tool.Readonly, true).annotate(Tool.Idempotent, true).annotate(Tool.OpenWorld, false);
|
|
37
28
|
/** @public */
|
|
38
29
|
const handleStaleReport = (projectRoot, params) => Effect.gen(function* () {
|
package/tools/validateBundle.js
CHANGED
|
@@ -5,31 +5,24 @@ import { resolveNow } from "../internal/resolveNow.js";
|
|
|
5
5
|
import { MCP_VERSION } from "../version.js";
|
|
6
6
|
import { ToolRefusal } from "@effected/mcp";
|
|
7
7
|
import { OKF_SPEC_VERSION } from "@okfit/core";
|
|
8
|
-
import {
|
|
8
|
+
import { Effect, Option } from "effect";
|
|
9
9
|
import { Tool } from "effect/ai";
|
|
10
10
|
import { DocumentPathError, JsonEnvelope, collect, forDiagnostics, json, provideDocuments, run } from "@okfit/engine";
|
|
11
|
-
import { GitHistory } from "@okfit/profiles";
|
|
12
|
-
import { Git } from "@effected/git";
|
|
13
|
-
import { AppDirs, Xdg } from "@effected/xdg";
|
|
14
11
|
|
|
15
12
|
// src/tools/validateBundle.ts
|
|
16
13
|
const DESCRIPTION = "Returns the report `okfit validate --format json` prints, unchanged: each diagnostic's file, code, severity, message and range, the summary counts and the CLI's exit code. Call it after editing any concept file. Optional documents: [{ path, text }] (bundle-relative, e.g. metrics/churn.md) stand in for disk, a file not yet written under an existing directory included; nothing is written.";
|
|
17
14
|
/**
|
|
18
|
-
* `dependencies
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* `
|
|
22
|
-
* `OkfitToolkit.toLayer`.
|
|
15
|
+
* No `dependencies`: since Effect 4.1 a declared dependency becomes a
|
|
16
|
+
* per-request `McpRequest<"Requires", S>` requirement. The platform services
|
|
17
|
+
* the handler needs are captured once when `ToolsLayer` builds instead
|
|
18
|
+
* (`toolkit.ts`), so the handler's own requirement channel is `never`.
|
|
23
19
|
*
|
|
24
|
-
* `Git` and `
|
|
25
|
-
* requirement channel
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* same channel for issue #19's body-digest tier of `Provenance.lint`, and
|
|
31
|
-
* is provided the same way -- `OkfitPlatform`'s `NodeServices.layer` bundles
|
|
32
|
-
* it alongside `FileSystem`/`Path`.
|
|
20
|
+
* `Git`, `GitHistory` and `Digest` reach the handler the same way: B3
|
|
21
|
+
* widened `run()`'s requirement channel so it can run `Provenance.lint`'s
|
|
22
|
+
* `generated-at-drift` check (S-8, S-16) and its body-digest tier (issue
|
|
23
|
+
* #19). `server.ts`'s `ServerLayer` builds `Git`/`GitHistory` from the
|
|
24
|
+
* `ChildProcessSpawner` `@okfit/engine`'s `OkfitPlatform` supplies, which
|
|
25
|
+
* also merges `NodeCrypto.layerDigest` beside `NodeServices.layer`.
|
|
33
26
|
*
|
|
34
27
|
* @public
|
|
35
28
|
*/
|
|
@@ -37,16 +30,7 @@ const validateBundle = Tool.make("validate_bundle", {
|
|
|
37
30
|
description: DESCRIPTION,
|
|
38
31
|
parameters: ValidateBundleParams,
|
|
39
32
|
success: JsonEnvelope,
|
|
40
|
-
failure: McpToolError
|
|
41
|
-
dependencies: [
|
|
42
|
-
FileSystem.FileSystem,
|
|
43
|
-
Path.Path,
|
|
44
|
-
AppDirs,
|
|
45
|
-
Xdg,
|
|
46
|
-
Git,
|
|
47
|
-
GitHistory,
|
|
48
|
-
Crypto.Crypto
|
|
49
|
-
]
|
|
33
|
+
failure: McpToolError
|
|
50
34
|
}).annotate(Tool.Title, "Validate the bundle").annotate(Tool.Readonly, true).annotate(Tool.Idempotent, true).annotate(Tool.OpenWorld, false);
|
|
51
35
|
/**
|
|
52
36
|
* This tool does not call `loadToolContext`: `run()` calls `Bundle.load`
|
package/tsdoc-metadata.json
CHANGED