@agent-wiki/mcp 0.22.3 → 0.22.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +31 -0
  2. package/dist/cli.js +177 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/evidence-migration.js +1 -1
  5. package/dist/evidence-migration.js.map +1 -1
  6. package/dist/evidence-report.d.ts +70 -1
  7. package/dist/evidence-report.d.ts.map +1 -1
  8. package/dist/evidence-report.js +228 -5
  9. package/dist/evidence-report.js.map +1 -1
  10. package/dist/evidence-report.test.js +176 -0
  11. package/dist/evidence-report.test.js.map +1 -1
  12. package/dist/evidence-search.d.ts +71 -0
  13. package/dist/evidence-search.d.ts.map +1 -1
  14. package/dist/evidence-search.js +104 -1
  15. package/dist/evidence-search.js.map +1 -1
  16. package/dist/evidence-search.test.js +58 -1
  17. package/dist/evidence-search.test.js.map +1 -1
  18. package/dist/index.d.ts +10 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +5 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/okf-compat.d.ts +152 -0
  23. package/dist/okf-compat.d.ts.map +1 -0
  24. package/dist/okf-compat.js +604 -0
  25. package/dist/okf-compat.js.map +1 -0
  26. package/dist/okf-compat.test.d.ts +2 -0
  27. package/dist/okf-compat.test.d.ts.map +1 -0
  28. package/dist/okf-compat.test.js +234 -0
  29. package/dist/okf-compat.test.js.map +1 -0
  30. package/dist/okf-export.d.ts +63 -0
  31. package/dist/okf-export.d.ts.map +1 -0
  32. package/dist/okf-export.js +655 -0
  33. package/dist/okf-export.js.map +1 -0
  34. package/dist/okf-export.test.d.ts +2 -0
  35. package/dist/okf-export.test.d.ts.map +1 -0
  36. package/dist/okf-export.test.js +469 -0
  37. package/dist/okf-export.test.js.map +1 -0
  38. package/dist/okf-import.d.ts +136 -0
  39. package/dist/okf-import.d.ts.map +1 -0
  40. package/dist/okf-import.js +471 -0
  41. package/dist/okf-import.js.map +1 -0
  42. package/dist/okf-import.test.d.ts +2 -0
  43. package/dist/okf-import.test.d.ts.map +1 -0
  44. package/dist/okf-import.test.js +339 -0
  45. package/dist/okf-import.test.js.map +1 -0
  46. package/dist/okf-trust.test.d.ts +2 -0
  47. package/dist/okf-trust.test.d.ts.map +1 -0
  48. package/dist/okf-trust.test.js +223 -0
  49. package/dist/okf-trust.test.js.map +1 -0
  50. package/dist/okf.d.ts +128 -0
  51. package/dist/okf.d.ts.map +1 -0
  52. package/dist/okf.js +659 -0
  53. package/dist/okf.js.map +1 -0
  54. package/dist/search-currency.d.ts +44 -0
  55. package/dist/search-currency.d.ts.map +1 -0
  56. package/dist/search-currency.js +111 -0
  57. package/dist/search-currency.js.map +1 -0
  58. package/dist/search.d.ts +19 -0
  59. package/dist/search.d.ts.map +1 -1
  60. package/dist/search.js.map +1 -1
  61. package/dist/server.d.ts +0 -1
  62. package/dist/server.d.ts.map +1 -1
  63. package/dist/server.js +753 -49
  64. package/dist/server.js.map +1 -1
  65. package/dist/server.test.js +848 -0
  66. package/dist/server.test.js.map +1 -1
  67. package/dist/wiki-graph.d.ts +126 -0
  68. package/dist/wiki-graph.d.ts.map +1 -0
  69. package/dist/wiki-graph.js +479 -0
  70. package/dist/wiki-graph.js.map +1 -0
  71. package/dist/wiki-graph.test.d.ts +2 -0
  72. package/dist/wiki-graph.test.d.ts.map +1 -0
  73. package/dist/wiki-graph.test.js +216 -0
  74. package/dist/wiki-graph.test.js.map +1 -0
  75. package/dist/wiki.d.ts +140 -1
  76. package/dist/wiki.d.ts.map +1 -1
  77. package/dist/wiki.js +509 -23
  78. package/dist/wiki.js.map +1 -1
  79. package/dist/worklist.d.ts +43 -0
  80. package/dist/worklist.d.ts.map +1 -0
  81. package/dist/worklist.js +147 -0
  82. package/dist/worklist.js.map +1 -0
  83. package/dist/worklist.test.d.ts +2 -0
  84. package/dist/worklist.test.d.ts.map +1 -0
  85. package/dist/worklist.test.js +233 -0
  86. package/dist/worklist.test.js.map +1 -0
  87. package/docs/evidence-envelope.md +26 -1
  88. package/docs/okf-adoption-plan.md +566 -0
  89. package/docs/okf-compat-plan.md +418 -0
  90. package/docs/okf-extensions.md +245 -0
  91. package/docs/open-knowledge-format.md +280 -0
  92. package/docs/tools.md +264 -2
  93. package/package.json +1 -1
  94. package/schemas/agent-wiki-okf.schema.json +130 -0
  95. package/skills/agent-wiki/SKILL.md +7 -0
  96. package/skills/agent-wiki/references/tools-reference.md +80 -3
@@ -0,0 +1,152 @@
1
+ /**
2
+ * Reading Open Knowledge Format (OKF) v0.3 shapes.
3
+ *
4
+ * OKF here is the upstream specification
5
+ * (https://github.com/open-knowledge-format/open-knowledge-format, SPEC.md), not
6
+ * agent-wiki's own package profile in okf.ts. Section numbers (§) refer to that spec.
7
+ *
8
+ * Everything in this file is pure: it turns frontmatter and body text into values and
9
+ * reads nothing from disk. agent-wiki's native shapes (string sources, [[wikilinks]])
10
+ * keep working; these helpers make the reader accept the OKF shapes next to them.
11
+ */
12
+ /**
13
+ * `tags` as a list of strings. A scalar is one tag and is not split at commas (§11.2).
14
+ */
15
+ export declare function readTags(value: unknown): string[];
16
+ /**
17
+ * `sources` as a list of strings, whichever shape the page uses:
18
+ * - agent-wiki: a string per source (`raw/report.md`, a URL)
19
+ * - OKF §5.1: a mapping per source with a required `resource`
20
+ * A mapping contributes its `resource`. An entry without one is ignored, as §11.2 rule 3
21
+ * asks. One mapping without the list dash counts as a list of one.
22
+ */
23
+ export declare function readSources(value: unknown): string[];
24
+ /** `index.md` and `log.md` are reserved at every level of an OKF bundle (§3.1). */
25
+ export declare function isOkfReservedFile(pagePath: string): boolean;
26
+ /**
27
+ * agent-wiki's own frontmatter keys and the extension keys an OKF export writes them as
28
+ * (§4.1: producers put their own keys under `x-`).
29
+ */
30
+ export declare const AGENT_WIKI_EXTENSION_KEYS: Readonly<Record<string, string>>;
31
+ /**
32
+ * Frontmatter as agent-wiki reads it: where a page carries an `x-agent-wiki-*` key and
33
+ * not the native one, the native key is filled in. A page that went out through an OKF
34
+ * export and came back through an import then means what it meant before: a
35
+ * reconciliation page still settles its contradiction, a synthesis page is still one.
36
+ * `pagePath` is the page the frontmatter belongs to: a marked `sources` entry may name
37
+ * its page relative to that one (§6.2).
38
+ * Returns the same object when there is nothing to fill in; the file is never rewritten.
39
+ */
40
+ export declare function withNativeKeys(fm: Record<string, unknown>, pagePath?: string): Record<string, unknown>;
41
+ /**
42
+ * For a page that agent-wiki writes: move every `x-agent-wiki-*` key to its native name,
43
+ * in place. A written page is in native form, so a flag that the write path clears (an
44
+ * imported page that gets sources stops being `legacyUnsupported`) does not come back
45
+ * through the extension key on the next read. A native key that is present wins.
46
+ */
47
+ export declare function moveToNativeKeys(fm: Record<string, unknown>): void;
48
+ /**
49
+ * Resolve an in-bundle link target or path field (§6) to a path relative to the bundle
50
+ * root, without leading slash. Returns null for a URL, for a target that leaves the root
51
+ * (external, never read), and for an empty target. `#fragment` and `?query` are dropped
52
+ * and percent-encoding is decoded.
53
+ */
54
+ export declare function resolveBundlePath(target: string, fromPage: string): string | null;
55
+ /**
56
+ * Replace every `[[wikilink]]` outside code. `replace` gets the target and the alias (the
57
+ * part after `|`, if any) and returns the text to put in its place. Wikilinks inside
58
+ * fenced blocks, indented blocks and code spans are examples, and are left alone.
59
+ */
60
+ export declare function replaceWikilinks(body: string, replace: (target: string, alias: string | undefined) => string): string;
61
+ export interface LinkOccurrence {
62
+ /**
63
+ * A `[[wikilink]]` target as written (alias dropped), or, for a Markdown link, the
64
+ * target resolved to a path from the wiki root, written with a leading `/` and without
65
+ * `.md`. The leading slash marks an exact path: a wikilink may be found by basename, a
66
+ * Markdown link names one file and nothing else.
67
+ */
68
+ link: string;
69
+ /** 0-based line of the body the link is on. */
70
+ line: number;
71
+ }
72
+ /** True for a link that came from a Markdown link and must resolve by exact path. */
73
+ export declare function isExactLink(link: string): boolean;
74
+ /**
75
+ * Every link in a body, in order of appearance: `[[wikilinks]]` (agent-wiki's own
76
+ * syntax) and standard Markdown links to `.md` files inside the wiki (§6.1), inline,
77
+ * reference-style and shortcut. Wikilinks are taken from the whole body, as before;
78
+ * Markdown links inside code are skipped.
79
+ */
80
+ export declare function scanLinks(body: string, pagePath: string): LinkOccurrence[];
81
+ /**
82
+ * The pages a body links to, each once, in order of first appearance. See `scanLinks`
83
+ * for the two forms a link takes.
84
+ */
85
+ export declare function extractLinks(body: string, pagePath: string): string[];
86
+ /**
87
+ * Parse an OKF timestamp (§5): an RFC 3339 date-time with an offset, or a date only,
88
+ * which means the start of that day in UTC. A YAML-native date arrives as a Date. A
89
+ * date-time without an offset is not valid. Returns epoch milliseconds, or null.
90
+ */
91
+ export declare function parseOkfTimestamp(value: unknown): number | null;
92
+ export type OkfTrustTier = "unverified" | "machine-confirmed" | "human-reviewed";
93
+ /** The tiers from lowest to highest (§5.3). */
94
+ export declare const OKF_TRUST_TIERS: readonly OkfTrustTier[];
95
+ export declare function isOkfActor(value: unknown): value is string;
96
+ /** `verified` as a list of events; one bare `{ by, at }` mapping is a list of one (§5.2). */
97
+ export declare function readVerified(value: unknown): unknown[];
98
+ /**
99
+ * True when two page bodies say the same thing: they differ at most in whitespace and in
100
+ * `[[wikilink]]` markup around the same words. §5.2: a trivial edit (format, whitespace,
101
+ * link repair) does not change `generated.at`; agent-wiki's auto-linking is such an edit.
102
+ * Everything else counts as a change, on purpose: a wrongly kept review is worse than a
103
+ * review that has to be given again.
104
+ */
105
+ export declare function sameContent(a: string, b: string): boolean;
106
+ export interface OkfTrust {
107
+ tier: OkfTrustTier;
108
+ /**
109
+ * True when the tier would be higher but for §5.3: the page has a review that was made
110
+ * before its content last changed, and that review no longer counts.
111
+ */
112
+ lapsed: boolean;
113
+ /** The highest tier the reviews on file would give if they were all current. */
114
+ before_change?: OkfTrustTier;
115
+ }
116
+ /**
117
+ * The trust tier with what §5.3 lets a consumer show next to it: "verified before the
118
+ * last change". Undefined when the page makes no trust statement at all.
119
+ */
120
+ export declare function okfTrust(fm: Record<string, unknown>): OkfTrust | undefined;
121
+ /**
122
+ * Trust tier from `generated` and `verified` (§5.3), or undefined when the page carries
123
+ * neither family: a native agent-wiki page makes no trust statement, which is different
124
+ * from an OKF concept that says nobody has verified it.
125
+ *
126
+ * Only current events count: those at or after `generated.at`, or all of them when
127
+ * `generated` is absent. An event without both `by` and `at` is ignored.
128
+ */
129
+ export declare function okfTrustTier(fm: Record<string, unknown>): OkfTrustTier | undefined;
130
+ export interface OkfLifecycle {
131
+ /** The `status` value as written, or undefined when absent (which means stable). */
132
+ status?: string;
133
+ /** False for `deprecated`, `draft` and any value outside the vocabulary (§5.4). */
134
+ current: boolean;
135
+ /** Where `superseded_by` points, relative to the wiki root; only for a deprecated page. */
136
+ supersededBy?: string;
137
+ /** "stale" when now >= stale_after, "malformed" when the value cannot be parsed. */
138
+ staleness: "fresh" | "stale" | "malformed" | "unset";
139
+ /** The `stale_after` value as written. */
140
+ staleAfter?: string;
141
+ }
142
+ /**
143
+ * Lifecycle from `status`, `superseded_by` and `stale_after` (§5.4, §5.5). A page with
144
+ * none of these is current and has no staleness statement.
145
+ */
146
+ export declare function okfLifecycle(fm: Record<string, unknown>, pagePath: string, now?: number): OkfLifecycle;
147
+ /**
148
+ * Why a page should not be relied on as current knowledge, as short clauses for an
149
+ * envelope rationale; empty when its lifecycle fields raise nothing.
150
+ */
151
+ export declare function lifecycleConcerns(lc: OkfLifecycle): string[];
152
+ //# sourceMappingURL=okf-compat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"okf-compat.d.ts","sourceRoot":"","sources":["../src/okf-compat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAeH;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAIjD;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAapD;AAED,mFAAmF;AACnF,wBAAgB,iBAAiB,CAAC,QAAQ,EA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