wyrm-mcp 7.2.0 → 7.2.2
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/LICENSE +26 -667
- package/NOTICE +14 -33
- package/dist/activation.d.ts.map +1 -1
- package/dist/activation.js +1 -44
- package/dist/activation.js.map +1 -1
- package/dist/agent-daemon.js +4 -281
- package/dist/agent-loop.js +7 -332
- package/dist/analytics.js +13 -236
- package/dist/attribution.js +1 -49
- package/dist/audit.js +2 -457
- package/dist/auto-capture.js +3 -138
- package/dist/auto-orchestrator.js +1 -325
- package/dist/autoconfig.js +39 -840
- package/dist/buddy-runner.js +1 -109
- package/dist/buddy.js +14 -564
- package/dist/build-flags.js +1 -17
- package/dist/capabilities.js +3 -183
- package/dist/capture.js +1 -56
- package/dist/causality.js +6 -107
- package/dist/cli.js +20 -281
- package/dist/cloud/cli.js +5 -541
- package/dist/cloud/client.js +1 -221
- package/dist/cloud/crypto.js +1 -85
- package/dist/cloud/machine-id.js +2 -113
- package/dist/cloud/recovery.js +1 -60
- package/dist/cloud/sync-engine.js +7 -543
- package/dist/cloud-backup.js +5 -579
- package/dist/cloud-profile.js +1 -138
- package/dist/cloud-sync-entrypoint.js +1 -47
- package/dist/cloud-sync.js +2 -309
- package/dist/constellation.js +12 -168
- package/dist/context-build-budgeted.js +4 -144
- package/dist/context-ranking.js +1 -69
- package/dist/crypto.js +1 -179
- package/dist/daemon-write-endpoint.js +1 -290
- package/dist/daemon-writer.js +2 -406
- package/dist/database.js +43 -1110
- package/dist/deprecations.js +2 -162
- package/dist/design.js +13 -141
- package/dist/event-replication.js +1 -112
- package/dist/events-sse.js +7 -43
- package/dist/events.js +6 -238
- package/dist/failure-patterns.js +42 -659
- package/dist/federation.js +12 -236
- package/dist/goals.js +13 -101
- package/dist/golden.js +3 -355
- package/dist/handlers/agent.js +4 -165
- package/dist/handlers/alias-adapters.js +1 -129
- package/dist/handlers/aliases.js +1 -171
- package/dist/handlers/audit.js +1 -87
- package/dist/handlers/boundary.js +1 -221
- package/dist/handlers/capture.js +73 -1109
- package/dist/handlers/causality.js +7 -114
- package/dist/handlers/cloud.js +85 -382
- package/dist/handlers/companion.js +28 -459
- package/dist/handlers/datalake.js +7 -187
- package/dist/handlers/dispatch-context.js +0 -22
- package/dist/handlers/entity.js +25 -256
- package/dist/handlers/events.js +16 -335
- package/dist/handlers/failure.js +13 -340
- package/dist/handlers/goals.js +4 -296
- package/dist/handlers/intelligence.js +126 -674
- package/dist/handlers/invoicing.js +1 -70
- package/dist/handlers/mcpclient.js +6 -137
- package/dist/handlers/orchestration.js +40 -125
- package/dist/handlers/output-schemas.js +1 -24
- package/dist/handlers/presence.js +3 -99
- package/dist/handlers/project.js +28 -182
- package/dist/handlers/prompts.js +6 -157
- package/dist/handlers/quest.js +4 -224
- package/dist/handlers/recall.js +11 -218
- package/dist/handlers/registry.js +1 -167
- package/dist/handlers/resources.js +1 -288
- package/dist/handlers/review.js +11 -74
- package/dist/handlers/run.js +17 -487
- package/dist/handlers/search.js +15 -326
- package/dist/handlers/session.js +28 -615
- package/dist/handlers/share.js +8 -184
- package/dist/handlers/shims.js +1 -464
- package/dist/handlers/skill.js +67 -449
- package/dist/handlers/survivors.js +1 -120
- package/dist/handlers/symbols.js +8 -109
- package/dist/handlers/syncops.js +4 -302
- package/dist/handlers/types.js +1 -27
- package/dist/harvest.js +5 -191
- package/dist/hours.js +7 -156
- package/dist/http-auth.js +3 -321
- package/dist/http-fast.js +21 -1137
- package/dist/icons.js +1 -47
- package/dist/index.js +2 -924
- package/dist/indexer.js +4 -145
- package/dist/intelligence.js +31 -261
- package/dist/internal-dispatch.js +3 -212
- package/dist/keyset.js +1 -110
- package/dist/knowledge-graph.js +12 -176
- package/dist/license.d.ts +11 -0
- package/dist/license.d.ts.map +1 -1
- package/dist/license.js +2 -414
- package/dist/license.js.map +1 -1
- package/dist/logger.js +2 -199
- package/dist/maintenance.js +2 -148
- package/dist/mcp-client.js +6 -262
- package/dist/memory-artifacts.js +30 -449
- package/dist/migrate-prompt.js +2 -124
- package/dist/migrations.js +40 -655
- package/dist/performance.js +1 -228
- package/dist/presence.js +11 -140
- package/dist/priority-embed.js +5 -164
- package/dist/providers/embedding-provider.js +1 -196
- package/dist/readonly-gate.js +1 -29
- package/dist/rehydration.js +9 -157
- package/dist/reindex.js +1 -88
- package/dist/render-target.js +21 -514
- package/dist/render.js +4 -280
- package/dist/repl-guard.js +1 -173
- package/dist/replication-daemon-entrypoint.js +1 -31
- package/dist/replication-daemon.js +2 -262
- package/dist/resilience.js +1 -591
- package/dist/reverse-bridge.js +5 -360
- package/dist/security.js +1 -244
- package/dist/session-seen.js +3 -51
- package/dist/setup.js +1 -260
- package/dist/skill-author.js +5 -168
- package/dist/spec-kit.js +1 -191
- package/dist/sqlite-busy.js +1 -154
- package/dist/statusline.js +11 -315
- package/dist/sub-agent.js +13 -262
- package/dist/summarizer.js +13 -139
- package/dist/symbols.js +7 -283
- package/dist/sync.js +5 -359
- package/dist/tasks-dispatch.js +1 -84
- package/dist/tasks.js +1 -282
- package/dist/token-budget.js +1 -143
- package/dist/tool-analytics.js +7 -129
- package/dist/tool-annotations.js +1 -365
- package/dist/tool-manifest-v2.json +1 -1
- package/dist/tool-manifest.json +1 -1
- package/dist/tool-profiles.js +1 -75
- package/dist/trace-harvest.js +6 -244
- package/dist/types.js +1 -30
- package/dist/ui-dashboard.js +41 -50
- package/dist/ulid.js +1 -81
- package/dist/validate.js +1 -129
- package/dist/vault.js +1 -534
- package/dist/vectors.js +3 -184
- package/dist/version-check.js +4 -136
- package/dist/visibility.js +19 -155
- package/dist/wyrm-cli.js +98 -2451
- package/dist/wyrm-cli.js.map +1 -1
- package/dist/wyrm-guard.js +14 -424
- package/dist/wyrm-loop.js +3 -150
- package/dist/wyrm-manifest.json +1 -1
- package/dist/wyrm-statusline-daemon.js +1 -11
- package/dist/wyrm-statusline.js +4 -56
- package/dist/wyrm-ui.js +9 -77
- package/package.json +4 -2
package/dist/ulid.js
CHANGED
|
@@ -1,81 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Wyrm ULID — crypto-based monotonic ULID generator (v7 F2, T008).
|
|
3
|
-
*
|
|
4
|
-
* @copyright 2026 Ghost Protocol (Pvt) Ltd.
|
|
5
|
-
* @license AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. See LICENSE.
|
|
6
|
-
*
|
|
7
|
-
* 26-char Crockford-base32 identifier: 10 chars of millisecond timestamp +
|
|
8
|
-
* 16 chars (80 bits) of crypto randomness. Used as `runs.run_id` (migration 20)
|
|
9
|
-
* so run ids sort lexicographically in creation order — `ORDER BY run_id`
|
|
10
|
-
* is `ORDER BY started-at` for free, with no coordination table.
|
|
11
|
-
*
|
|
12
|
-
* Monotonic within this process: two calls in the same millisecond (or after a
|
|
13
|
-
* backwards clock step) increment the random tail instead of re-rolling, so ids
|
|
14
|
-
* from one generator are ALWAYS strictly increasing. Zero dependencies — built
|
|
15
|
-
* on node:crypto randomBytes (Article I: fully offline, no LLM, no network).
|
|
16
|
-
*/
|
|
17
|
-
import { randomBytes } from 'crypto';
|
|
18
|
-
/** Crockford base32 alphabet (no I, L, O, U — unambiguous when read aloud). */
|
|
19
|
-
const ENCODING = '0123456789ABCDEFGHJKMNPQRSTVWXYZ';
|
|
20
|
-
const TIME_LEN = 10; // 48-bit ms timestamp -> 10 base32 chars (good past year 10889)
|
|
21
|
-
const RANDOM_LEN = 16; // 80 bits of randomness -> 16 base32 chars
|
|
22
|
-
let lastTime = -1;
|
|
23
|
-
let lastRandom = [];
|
|
24
|
-
function encodeTime(time) {
|
|
25
|
-
let out = '';
|
|
26
|
-
for (let i = 0; i < TIME_LEN; i++) {
|
|
27
|
-
out = ENCODING[time % 32] + out;
|
|
28
|
-
time = Math.floor(time / 32);
|
|
29
|
-
}
|
|
30
|
-
return out;
|
|
31
|
-
}
|
|
32
|
-
/** 16 uniform base32 digits from crypto randomness (256 % 32 === 0: no modulo bias). */
|
|
33
|
-
function randomDigits() {
|
|
34
|
-
const bytes = randomBytes(RANDOM_LEN);
|
|
35
|
-
const digits = new Array(RANDOM_LEN);
|
|
36
|
-
for (let i = 0; i < RANDOM_LEN; i++)
|
|
37
|
-
digits[i] = bytes[i] % 32;
|
|
38
|
-
return digits;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Generate a monotonic ULID. `now` is injectable for tests; defaults to
|
|
42
|
-
* Date.now(). If the clock reads the same ms as (or earlier than) the previous
|
|
43
|
-
* call, the previous timestamp is reused and the random tail incremented —
|
|
44
|
-
* strict lexicographic monotonicity survives same-ms bursts and clock skew.
|
|
45
|
-
*/
|
|
46
|
-
export function ulid(now = Date.now()) {
|
|
47
|
-
let digits;
|
|
48
|
-
let time = now;
|
|
49
|
-
if (now <= lastTime) {
|
|
50
|
-
// Same millisecond or clock went backwards: stay monotonic by reusing the
|
|
51
|
-
// last timestamp and incrementing the 80-bit random tail by one.
|
|
52
|
-
time = lastTime;
|
|
53
|
-
digits = lastRandom.slice();
|
|
54
|
-
let i = RANDOM_LEN - 1;
|
|
55
|
-
for (; i >= 0; i--) {
|
|
56
|
-
if (digits[i] < 31) {
|
|
57
|
-
digits[i]++;
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
digits[i] = 0;
|
|
61
|
-
}
|
|
62
|
-
if (i < 0) {
|
|
63
|
-
// 2^80 increments in one ms — practically unreachable; re-roll.
|
|
64
|
-
digits = randomDigits();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
digits = randomDigits();
|
|
69
|
-
}
|
|
70
|
-
lastTime = time;
|
|
71
|
-
lastRandom = digits;
|
|
72
|
-
let tail = '';
|
|
73
|
-
for (let i = 0; i < RANDOM_LEN; i++)
|
|
74
|
-
tail += ENCODING[digits[i]];
|
|
75
|
-
return encodeTime(time) + tail;
|
|
76
|
-
}
|
|
77
|
-
/** Shape check: 26 Crockford-base32 chars (excludes I, L, O, U). */
|
|
78
|
-
export function isUlid(value) {
|
|
79
|
-
return typeof value === 'string' && /^[0-9A-HJKMNP-TV-Z]{26}$/.test(value);
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=ulid.js.map
|
|
1
|
+
import{randomBytes as a}from"crypto";const s="0123456789ABCDEFGHJKMNPQRSTVWXYZ",u=10,n=16;let r=-1,f=[];function d(e){let t="";for(let i=0;i<u;i++)t=s[e%32]+t,e=Math.floor(e/32);return t}function c(){const e=a(n),t=new Array(n);for(let i=0;i<n;i++)t[i]=e[i]%32;return t}function m(e=Date.now()){let t,i=e;if(e<=r){i=r,t=f.slice();let o=n-1;for(;o>=0;o--){if(t[o]<31){t[o]++;break}t[o]=0}o<0&&(t=c())}else t=c();r=i,f=t;let l="";for(let o=0;o<n;o++)l+=s[t[o]];return d(i)+l}function D(e){return typeof e=="string"&&/^[0-9A-HJKMNP-TV-Z]{26}$/.test(e)}export{D as isUlid,m as ulid};
|
package/dist/validate.js
CHANGED
|
@@ -1,129 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Boundary input validation for MCP tool arguments.
|
|
3
|
-
*
|
|
4
|
-
* v7 Pillar 4 (harden by construction) / Constitution Article VII (secure by
|
|
5
|
-
* default). Coerce + validate a tool argument AT THE DISPATCH SEAM so a handler
|
|
6
|
-
* never receives an out-of-contract value — closing the class the v6.14.1
|
|
7
|
-
* `wyrm_prune` SQL-injection belonged to (a string where an integer was assumed).
|
|
8
|
-
*
|
|
9
|
-
* Every validator throws {@link ValidationError} on bad input; the CallTool
|
|
10
|
-
* dispatcher catches it and returns a clean `isError` response — never a crash,
|
|
11
|
-
* never an injection sink. The low-level MCP `Server` treats `inputSchema` as
|
|
12
|
-
* advisory only, so this is the real enforcement layer.
|
|
13
|
-
*
|
|
14
|
-
* @copyright 2026 Ghost Protocol (Pvt) Ltd.
|
|
15
|
-
* @license AGPL-3.0-or-later
|
|
16
|
-
*/
|
|
17
|
-
export class ValidationError extends Error {
|
|
18
|
-
field;
|
|
19
|
-
constructor(field, reason) {
|
|
20
|
-
super(`'${field}' ${reason}`);
|
|
21
|
-
this.name = 'ValidationError';
|
|
22
|
-
this.field = field;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
const isNil = (v) => v === undefined || v === null;
|
|
26
|
-
/** Integer, coerced from a clean numeric string. Returns `default`/undefined when absent. */
|
|
27
|
-
export function asInt(field, v, opts = {}) {
|
|
28
|
-
if (isNil(v))
|
|
29
|
-
return opts.default;
|
|
30
|
-
let n;
|
|
31
|
-
if (typeof v === 'number')
|
|
32
|
-
n = v;
|
|
33
|
-
else if (typeof v === 'string' && /^[+-]?\d+$/.test(v.trim()))
|
|
34
|
-
n = Number(v.trim());
|
|
35
|
-
else
|
|
36
|
-
throw new ValidationError(field, 'must be an integer');
|
|
37
|
-
if (!Number.isInteger(n))
|
|
38
|
-
throw new ValidationError(field, 'must be an integer');
|
|
39
|
-
if (opts.min !== undefined && n < opts.min)
|
|
40
|
-
throw new ValidationError(field, `must be >= ${opts.min}`);
|
|
41
|
-
if (opts.max !== undefined && n > opts.max)
|
|
42
|
-
throw new ValidationError(field, `must be <= ${opts.max}`);
|
|
43
|
-
return n;
|
|
44
|
-
}
|
|
45
|
-
/** Required integer — throws if absent. */
|
|
46
|
-
export function requireInt(field, v, opts = {}) {
|
|
47
|
-
const n = asInt(field, v, opts);
|
|
48
|
-
if (n === undefined)
|
|
49
|
-
throw new ValidationError(field, 'is required');
|
|
50
|
-
return n;
|
|
51
|
-
}
|
|
52
|
-
/** Finite number (float allowed). */
|
|
53
|
-
export function asNumber(field, v, opts = {}) {
|
|
54
|
-
if (isNil(v))
|
|
55
|
-
return opts.default;
|
|
56
|
-
let n;
|
|
57
|
-
if (typeof v === 'number')
|
|
58
|
-
n = v;
|
|
59
|
-
else if (typeof v === 'string' && v.trim() !== '' && Number.isFinite(Number(v)))
|
|
60
|
-
n = Number(v);
|
|
61
|
-
else
|
|
62
|
-
throw new ValidationError(field, 'must be a number');
|
|
63
|
-
if (!Number.isFinite(n))
|
|
64
|
-
throw new ValidationError(field, 'must be a finite number');
|
|
65
|
-
if (opts.min !== undefined && n < opts.min)
|
|
66
|
-
throw new ValidationError(field, `must be >= ${opts.min}`);
|
|
67
|
-
if (opts.max !== undefined && n > opts.max)
|
|
68
|
-
throw new ValidationError(field, `must be <= ${opts.max}`);
|
|
69
|
-
return n;
|
|
70
|
-
}
|
|
71
|
-
/** String with optional length + pattern bounds. */
|
|
72
|
-
export function asString(field, v, opts = {}) {
|
|
73
|
-
if (isNil(v))
|
|
74
|
-
return opts.default;
|
|
75
|
-
if (typeof v !== 'string')
|
|
76
|
-
throw new ValidationError(field, 'must be a string');
|
|
77
|
-
if (opts.minLen !== undefined && v.length < opts.minLen)
|
|
78
|
-
throw new ValidationError(field, `must be at least ${opts.minLen} characters`);
|
|
79
|
-
if (opts.maxLen !== undefined && v.length > opts.maxLen)
|
|
80
|
-
throw new ValidationError(field, `must be at most ${opts.maxLen} characters`);
|
|
81
|
-
if (opts.pattern && !opts.pattern.test(v))
|
|
82
|
-
throw new ValidationError(field, 'has an invalid format');
|
|
83
|
-
return v;
|
|
84
|
-
}
|
|
85
|
-
/** Required string — throws if absent. */
|
|
86
|
-
export function requireString(field, v, opts = {}) {
|
|
87
|
-
const s = asString(field, v, opts);
|
|
88
|
-
if (s === undefined)
|
|
89
|
-
throw new ValidationError(field, 'is required');
|
|
90
|
-
return s;
|
|
91
|
-
}
|
|
92
|
-
/** Boolean, accepting the common truthy/falsey wire encodings (`'1'`/`'0'`, `'true'`/`'false'`, `1`/`0`). */
|
|
93
|
-
export function asBool(field, v, def) {
|
|
94
|
-
if (isNil(v))
|
|
95
|
-
return def;
|
|
96
|
-
if (typeof v === 'boolean')
|
|
97
|
-
return v;
|
|
98
|
-
if (v === 'true' || v === '1' || v === 1)
|
|
99
|
-
return true;
|
|
100
|
-
if (v === 'false' || v === '0' || v === 0)
|
|
101
|
-
return false;
|
|
102
|
-
throw new ValidationError(field, 'must be a boolean');
|
|
103
|
-
}
|
|
104
|
-
/** One of a fixed allowed set. */
|
|
105
|
-
export function asEnum(field, v, allowed, def) {
|
|
106
|
-
if (isNil(v))
|
|
107
|
-
return def;
|
|
108
|
-
if (typeof v !== 'string' || !allowed.includes(v)) {
|
|
109
|
-
throw new ValidationError(field, `must be one of: ${allowed.join(', ')}`);
|
|
110
|
-
}
|
|
111
|
-
return v;
|
|
112
|
-
}
|
|
113
|
-
/** Array of strings, each optionally length-bounded. */
|
|
114
|
-
export function asStringArray(field, v, opts = {}) {
|
|
115
|
-
if (isNil(v))
|
|
116
|
-
return undefined;
|
|
117
|
-
if (!Array.isArray(v))
|
|
118
|
-
throw new ValidationError(field, 'must be an array');
|
|
119
|
-
if (opts.maxItems !== undefined && v.length > opts.maxItems)
|
|
120
|
-
throw new ValidationError(field, `must have at most ${opts.maxItems} items`);
|
|
121
|
-
return v.map((item, i) => {
|
|
122
|
-
if (typeof item !== 'string')
|
|
123
|
-
throw new ValidationError(`${field}[${i}]`, 'must be a string');
|
|
124
|
-
if (opts.maxLen !== undefined && item.length > opts.maxLen)
|
|
125
|
-
throw new ValidationError(`${field}[${i}]`, `must be at most ${opts.maxLen} characters`);
|
|
126
|
-
return item;
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
//# sourceMappingURL=validate.js.map
|
|
1
|
+
class i extends Error{field;constructor(e,n){super(`'${e}' ${n}`),this.name="ValidationError",this.field=e}}const u=r=>r==null;function m(r,e,n={}){if(u(e))return n.default;let t;if(typeof e=="number")t=e;else if(typeof e=="string"&&/^[+-]?\d+$/.test(e.trim()))t=Number(e.trim());else throw new i(r,"must be an integer");if(!Number.isInteger(t))throw new i(r,"must be an integer");if(n.min!==void 0&&t<n.min)throw new i(r,`must be >= ${n.min}`);if(n.max!==void 0&&t>n.max)throw new i(r,`must be <= ${n.max}`);return t}function s(r,e,n={}){const t=m(r,e,n);if(t===void 0)throw new i(r,"is required");return t}function o(r,e,n={}){if(u(e))return n.default;let t;if(typeof e=="number")t=e;else if(typeof e=="string"&&e.trim()!==""&&Number.isFinite(Number(e)))t=Number(e);else throw new i(r,"must be a number");if(!Number.isFinite(t))throw new i(r,"must be a finite number");if(n.min!==void 0&&t<n.min)throw new i(r,`must be >= ${n.min}`);if(n.max!==void 0&&t>n.max)throw new i(r,`must be <= ${n.max}`);return t}function f(r,e,n={}){if(u(e))return n.default;if(typeof e!="string")throw new i(r,"must be a string");if(n.minLen!==void 0&&e.length<n.minLen)throw new i(r,`must be at least ${n.minLen} characters`);if(n.maxLen!==void 0&&e.length>n.maxLen)throw new i(r,`must be at most ${n.maxLen} characters`);if(n.pattern&&!n.pattern.test(e))throw new i(r,"has an invalid format");return e}function w(r,e,n={}){const t=f(r,e,n);if(t===void 0)throw new i(r,"is required");return t}function h(r,e,n){if(u(e))return n;if(typeof e=="boolean")return e;if(e==="true"||e==="1"||e===1)return!0;if(e==="false"||e==="0"||e===0)return!1;throw new i(r,"must be a boolean")}function b(r,e,n,t){if(u(e))return t;if(typeof e!="string"||!n.includes(e))throw new i(r,`must be one of: ${n.join(", ")}`);return e}function x(r,e,n={}){if(!u(e)){if(!Array.isArray(e))throw new i(r,"must be an array");if(n.maxItems!==void 0&&e.length>n.maxItems)throw new i(r,`must have at most ${n.maxItems} items`);return e.map((t,a)=>{if(typeof t!="string")throw new i(`${r}[${a}]`,"must be a string");if(n.maxLen!==void 0&&t.length>n.maxLen)throw new i(`${r}[${a}]`,`must be at most ${n.maxLen} characters`);return t})}}export{i as ValidationError,h as asBool,b as asEnum,m as asInt,o as asNumber,f as asString,x as asStringArray,s as requireInt,w as requireString};
|