@setu-ts/kernel 0.0.0-stage → 0.10.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.
Files changed (79) hide show
  1. package/AGENT_CARD.md +47 -0
  2. package/LICENSE +21 -0
  3. package/README.md +152 -2
  4. package/dist/application/application.d.ts +174 -0
  5. package/dist/application/application.d.ts.map +1 -0
  6. package/dist/application/application.js +1905 -0
  7. package/dist/application/application.js.map +1 -0
  8. package/dist/application/inject-body.d.ts +58 -0
  9. package/dist/application/inject-body.d.ts.map +1 -0
  10. package/dist/application/inject-body.js +82 -0
  11. package/dist/application/inject-body.js.map +1 -0
  12. package/dist/context/request-context.d.ts +32 -0
  13. package/dist/context/request-context.d.ts.map +1 -0
  14. package/dist/context/request-context.js +136 -0
  15. package/dist/context/request-context.js.map +1 -0
  16. package/dist/context/response.d.ts +60 -0
  17. package/dist/context/response.d.ts.map +1 -0
  18. package/dist/context/response.js +193 -0
  19. package/dist/context/response.js.map +1 -0
  20. package/dist/diagnostics/buffer.d.ts +143 -0
  21. package/dist/diagnostics/buffer.d.ts.map +1 -0
  22. package/dist/diagnostics/buffer.js +190 -0
  23. package/dist/diagnostics/buffer.js.map +1 -0
  24. package/dist/diagnostics/collector.d.ts +284 -0
  25. package/dist/diagnostics/collector.d.ts.map +1 -0
  26. package/dist/diagnostics/collector.js +810 -0
  27. package/dist/diagnostics/collector.js.map +1 -0
  28. package/dist/diagnostics/projection.d.ts +153 -0
  29. package/dist/diagnostics/projection.d.ts.map +1 -0
  30. package/dist/diagnostics/projection.js +226 -0
  31. package/dist/diagnostics/projection.js.map +1 -0
  32. package/dist/index.d.ts +12 -0
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.js +11 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/lifecycle/lifecycle-manager.d.ts +136 -0
  37. package/dist/lifecycle/lifecycle-manager.d.ts.map +1 -0
  38. package/dist/lifecycle/lifecycle-manager.js +206 -0
  39. package/dist/lifecycle/lifecycle-manager.js.map +1 -0
  40. package/dist/pipeline/execute-chain.d.ts +71 -0
  41. package/dist/pipeline/execute-chain.d.ts.map +1 -0
  42. package/dist/pipeline/execute-chain.js +104 -0
  43. package/dist/pipeline/execute-chain.js.map +1 -0
  44. package/dist/pipeline/middleware-pipeline.d.ts +68 -0
  45. package/dist/pipeline/middleware-pipeline.d.ts.map +1 -0
  46. package/dist/pipeline/middleware-pipeline.js +82 -0
  47. package/dist/pipeline/middleware-pipeline.js.map +1 -0
  48. package/dist/registry/plugin-resolver.d.ts +42 -0
  49. package/dist/registry/plugin-resolver.d.ts.map +1 -0
  50. package/dist/registry/plugin-resolver.js +140 -0
  51. package/dist/registry/plugin-resolver.js.map +1 -0
  52. package/dist/registry/service-registry.d.ts +110 -0
  53. package/dist/registry/service-registry.d.ts.map +1 -0
  54. package/dist/registry/service-registry.js +197 -0
  55. package/dist/registry/service-registry.js.map +1 -0
  56. package/dist/router/route-matcher.d.ts +85 -0
  57. package/dist/router/route-matcher.d.ts.map +1 -0
  58. package/dist/router/route-matcher.js +105 -0
  59. package/dist/router/route-matcher.js.map +1 -0
  60. package/dist/router/router.d.ts +130 -0
  61. package/dist/router/router.d.ts.map +1 -0
  62. package/dist/router/router.js +350 -0
  63. package/dist/router/router.js.map +1 -0
  64. package/package.json +49 -3
  65. package/src/application/application.ts +2326 -0
  66. package/src/application/inject-body.ts +130 -0
  67. package/src/context/request-context.ts +169 -0
  68. package/src/context/response.ts +246 -0
  69. package/src/diagnostics/buffer.ts +243 -0
  70. package/src/diagnostics/collector.ts +1030 -0
  71. package/src/diagnostics/projection.ts +322 -0
  72. package/src/index.ts +20 -0
  73. package/src/lifecycle/lifecycle-manager.ts +282 -0
  74. package/src/pipeline/execute-chain.ts +162 -0
  75. package/src/pipeline/middleware-pipeline.ts +129 -0
  76. package/src/registry/plugin-resolver.ts +185 -0
  77. package/src/registry/service-registry.ts +262 -0
  78. package/src/router/route-matcher.ts +134 -0
  79. package/src/router/router.ts +485 -0
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Router — programmatic route registration with method-based matching,
3
+ * parameter extraction, group facades, and static-over-param preference.
4
+ *
5
+ * Route matching is delegated to Hono as of Milestone 22; the kernel
6
+ * maintains a `RouteEntry` map so it can return `{ definition, params }`
7
+ * in the same shape the pipeline terminal expects, and apply its own
8
+ * deterministic tie-break (§3.6) when Hono returns multiple candidates.
9
+ *
10
+ * @module
11
+ */
12
+ import type { HttpMethod, IRouterApi, RouteDefinition, RouteHandler, RouteInfo } from '@setu-ts/common';
13
+ export interface RouteEntry {
14
+ pattern: string;
15
+ method: HttpMethod;
16
+ definition: RouteDefinition;
17
+ index: number;
18
+ /**
19
+ * Static-segment count — hoisted to registration time (AI_GUIDELINES §14) and
20
+ * read by the tie-break in {@linkcode Router.match}.
21
+ *
22
+ * The parsed `Segment[]` it is derived from is deliberately NOT retained: it
23
+ * was stored on every entry and read by nothing once Hono took over matching
24
+ * in M22.
25
+ */
26
+ statics: number;
27
+ /**
28
+ * Wildcard-segment count — hoisted at registration beside {@linkcode
29
+ * RouteEntry.statics} and read ASCENDING by the tie-break in {@linkcode
30
+ * Router.match}.
31
+ *
32
+ * Before M70g a `*` was counted as a static segment, so `/*` tied with
33
+ * `/openapi.json` and outranked `/a/:id`. Counting it separately is what makes
34
+ * an application catch-all sort last instead of eating every single-segment
35
+ * route registered after it.
36
+ */
37
+ wildcards: number;
38
+ /** Plugin that registered this route, if it was registered by a plugin. */
39
+ owner?: string;
40
+ }
41
+ /**
42
+ * A route registration reported to the diagnostics collector at its owning
43
+ * mutation boundary, carrying only bounded registration primitives.
44
+ *
45
+ * @since 0.8.0
46
+ */
47
+ export interface RouteRegistrationEvent {
48
+ readonly kind: 'register';
49
+ /** The entry's insertion index — the identity dispatch uses to name the route. */
50
+ readonly entryIndex: number;
51
+ /**
52
+ * The method as registered — typed as the raw string deliberately, because
53
+ * projecting onto the supported verb vocabulary is the COLLECTOR's decision
54
+ * (unsupported input is omitted there, never widened).
55
+ */
56
+ readonly method: string;
57
+ /** The COMPLETE registered pattern, including any group prefix. */
58
+ readonly pattern: string;
59
+ /** The plugin that registered the route, when one was registering. */
60
+ readonly owner: string | undefined;
61
+ /** How many middleware stages the route's definition declares. */
62
+ readonly middlewareCount: number;
63
+ }
64
+ export declare class Router implements IRouterApi {
65
+ #private;
66
+ constructor(owner?: () => string | undefined);
67
+ /**
68
+ * Installs the diagnostics sink that receives route registration events at
69
+ * the owning mutation boundary. Pass `undefined` to detach (teardown).
70
+ *
71
+ * @param sink - The collector-facing sink, or `undefined`
72
+ * @since 0.8.0
73
+ */
74
+ setDiagnosticsSink(sink: ((event: RouteRegistrationEvent) => void) | undefined): void;
75
+ get(path: string, route: RouteHandler | RouteDefinition): void;
76
+ post(path: string, route: RouteHandler | RouteDefinition): void;
77
+ put(path: string, route: RouteHandler | RouteDefinition): void;
78
+ patch(path: string, route: RouteHandler | RouteDefinition): void;
79
+ delete(path: string, route: RouteHandler | RouteDefinition): void;
80
+ head(path: string, route: RouteHandler | RouteDefinition): void;
81
+ options(path: string, route: RouteHandler | RouteDefinition): void;
82
+ group(prefix: string, configure: (router: IRouterApi) => void): void;
83
+ /**
84
+ * Finds the best matching route for the given method and path.
85
+ *
86
+ * Delegates to Hono's router for matching, then applies the kernel's own
87
+ * deterministic tie-break (§3.6 of M22 plan) when Hono returns multiple
88
+ * candidates of equal specificity.
89
+ *
90
+ * When multiple routes match, the ranking is:
91
+ *
92
+ * 1. more literal (static) segments;
93
+ * 2. then FEWER `*` wildcard segments;
94
+ * 3. then earliest registration order.
95
+ *
96
+ * The wildcard key is what makes an application catch-all lose to a route that
97
+ * names its path, in either registration order. Before M70g a `*` counted as a
98
+ * static segment, so `GET /*` tied with `GET /openapi.json` and won merely by
99
+ * registering first — which is how a full-stack application silently lost its
100
+ * OpenAPI endpoints.
101
+ *
102
+ * The rule compares COUNTS rather than comparing segment by segment, and that
103
+ * has one documented consequence: `/a/*` (one static, one wildcard) loses to
104
+ * `/:x/b` (one static, no wildcard) on a request for `/a/b`, where a
105
+ * per-position rule would prefer the literal `a`. That case is pinned by a test
106
+ * so a future change to per-segment ranking is a deliberate one.
107
+ *
108
+ * @param method - HTTP method
109
+ * @param path - Request path
110
+ * @returns The matched route entry and extracted params, or `null`
111
+ * @since 0.1.0
112
+ */
113
+ match(method: HttpMethod, path: string): {
114
+ definition: RouteDefinition;
115
+ params: Record<string, string>;
116
+ /** The selected entry — dispatch names the actual route node from its index. */
117
+ entry: RouteEntry;
118
+ } | null;
119
+ /**
120
+ * Returns all registered route entries, including the registration
121
+ * bookkeeping (`index`, `statics`, `wildcards`) that drives the tie-break.
122
+ *
123
+ * @returns The route entries in registration order
124
+ * @internal Test/diagnostics seam — `Router` is not exported from the package
125
+ * barrel, and plugins read routes through the contract's `listRoutes()`.
126
+ */
127
+ getAll(): readonly RouteEntry[];
128
+ listRoutes(): readonly RouteInfo[];
129
+ }
130
+ //# sourceMappingURL=router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router/router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,eAAe,EACf,YAAY,EACZ,SAAS,EACV,MAAM,iBAAiB,CAAC;AAIzB,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,UAAU,CAAC;IACnB,UAAU,EAAE,eAAe,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;OAOG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;;;OASG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,kFAAkF;IAClF,QAAQ,CAAC,UA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AK,CACH,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,MAAM,GACX;QACD,UAAU,EAAE,eAAe,CAAC;QAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC/B,gFAAgF;QAChF,KAAK,EAAE,UAAU,CAAC;KACnB,GAAG,IAAI;IA0FR;;;;;;;OAOG;IACH,MAAM,IAAI,SAAS,UAAU,EAAE;IAI/B,UAAU,IAAI,SAAS,SAAS,EAAE;CAQnC"}
@@ -0,0 +1,350 @@
1
+ import { parsePattern, staticSegmentCount, wildcardSegmentCount } from "./route-matcher.js";
2
+ // Hono imports — use LinearRouter (not the default SmartRouter) because the
3
+ // kernel's tie-break (§3.6) needs Hono to return EVERY overlapping candidate
4
+ // for a path so it can re-rank them by static-segment count + registration
5
+ // order. LinearRouter matches routes linearly and yields all candidates;
6
+ // it also never raises RegExpRouter's UnsupportedPathError on overlapping
7
+ // param patterns. Extracted params are strings either way.
8
+ import { Hono } from 'hono';
9
+ import { LinearRouter } from 'hono/router/linear-router';
10
+ /**
11
+ * Programmatic router implementing {@linkcode IRouterApi}. Supports all 7
12
+ * HTTP verbs, route groups with prefix composition, and static-over-param
13
+ * matching preference.
14
+ *
15
+ * @since 0.3.0
16
+ */
17
+ /**
18
+ * Key under which a route's {@linkcode RouteEntry} is carried on the stub
19
+ * handler Hono holds, so a match resolves the entry with a property read
20
+ * rather than a string key and a `Map` lookup on every request (M87).
21
+ */
22
+ const ROUTE_ENTRY = Symbol('setu.router.entry');
23
+ /** Shared empty params. Frozen, so a caller cannot mutate it into a shared surprise. */
24
+ const EMPTY_PARAMS = Object.freeze({});
25
+ /**
26
+ * Decodes Hono's raw (still percent-encoded) param values.
27
+ *
28
+ * Hono's low-level `router.match()` returns raw values — decoding normally
29
+ * happens in Hono's Context layer, which the kernel bypasses — so this
30
+ * preserves pre-M22 parity with the from-scratch matcher, which decoded per
31
+ * segment.
32
+ *
33
+ * Two allocations are avoided relative to the straightforward form (M87): a
34
+ * route with no params returns the shared frozen object rather than a fresh
35
+ * `{}`, and `decodeURIComponent` is skipped for a value containing no `%`,
36
+ * where it is an identity function (it does not decode `+`).
37
+ *
38
+ * @param raw - Hono's raw param record
39
+ * @returns The decoded params, or `null` when a value carries a malformed escape
40
+ */
41
+ function decodeParams(raw) {
42
+ let params;
43
+ // `Object.keys`, not `for...in`: own enumerable properties only. Hono
44
+ // currently builds its params with a null prototype, so `for...in` happens
45
+ // to be equivalent — verified, not assumed — but that is an undocumented
46
+ // internal of a dependency, and if it ever became a `{}` literal a polluted
47
+ // `Object.prototype` would start injecting route params on every match. The
48
+ // `Object.entries` form this replaced was immune by construction; keeping
49
+ // that property costs nothing, since `keys` allocates one array where
50
+ // `entries` allocated one array plus a pair per key.
51
+ for (const key of Object.keys(raw)) {
52
+ const value = raw[key];
53
+ let decoded;
54
+ if (value.includes('%')) {
55
+ try {
56
+ decoded = decodeURIComponent(value);
57
+ }
58
+ catch {
59
+ return null;
60
+ }
61
+ }
62
+ else {
63
+ decoded = value;
64
+ }
65
+ (params ??= {})[key] = decoded;
66
+ }
67
+ return params ?? EMPTY_PARAMS;
68
+ }
69
+ export class Router {
70
+ #routes = [];
71
+ #index = 0;
72
+ #hono = new Hono({ strict: false, router: new LinearRouter() });
73
+ /** Maps `${method} ${path}` → the kernel's RouteEntry. */
74
+ #entryMap = new Map();
75
+ #owner;
76
+ #diagnosticsSink;
77
+ constructor(owner = () => undefined) {
78
+ this.#owner = owner;
79
+ }
80
+ /**
81
+ * Installs the diagnostics sink that receives route registration events at
82
+ * the owning mutation boundary. Pass `undefined` to detach (teardown).
83
+ *
84
+ * @param sink - The collector-facing sink, or `undefined`
85
+ * @since 0.8.0
86
+ */
87
+ setDiagnosticsSink(sink) {
88
+ this.#diagnosticsSink = sink;
89
+ }
90
+ #registerMethod(method, path, route) {
91
+ const key = `${method} ${path}`;
92
+ const existing = this.#entryMap.get(key);
93
+ if (existing !== undefined) {
94
+ // Name the FIRST claimant. The message used to give the pattern and the
95
+ // second claimant, which is the half the stack trace already carries; the
96
+ // half a developer needs is who got there first — `StaticPlugin` at the
97
+ // root collides with the SSR catch-all, and the old message named neither
98
+ // plugin. `owner` has carried this since M68.
99
+ throw new Error(`Route '${key}' is already registered by ${describeRouteOwner(existing)}.`);
100
+ }
101
+ const definition = typeof route === 'function' ? { handler: route } : route;
102
+ const owner = this.#owner();
103
+ const segments = parsePattern(path);
104
+ // Hoist per-request work to registration time (AI_GUIDELINES §14): parse
105
+ // the pattern once here and keep only the static count the tie-break reads.
106
+ const entry = {
107
+ pattern: path,
108
+ method,
109
+ definition,
110
+ index: this.#index++,
111
+ statics: staticSegmentCount(segments),
112
+ wildcards: wildcardSegmentCount(segments),
113
+ ...(owner === undefined ? {} : { owner }),
114
+ };
115
+ this.#routes.push(entry);
116
+ this.#entryMap.set(key, entry);
117
+ // Reported at the owning mutation boundary, after the entry exists — a
118
+ // duplicate-key refusal above never reaches this line.
119
+ this.#diagnosticsSink?.({
120
+ kind: 'register',
121
+ entryIndex: entry.index,
122
+ method,
123
+ pattern: path,
124
+ owner,
125
+ middlewareCount: definition.middleware?.length ?? 0,
126
+ });
127
+ // Register on Hono with a stub handler. The stub does NOT execute the
128
+ // framework handler — it exists only so Hono's matcher records the
129
+ // route and extracts params. The real handler runs through the custom
130
+ // pipeline + executeChain (§3.2 of M22 plan).
131
+ // Use `app.on()` for all methods (covers HEAD, OPTIONS which Hono
132
+ // doesn't expose as direct methods).
133
+ const stubHandler = (_c, _next) => {
134
+ // Stub — never called during matching.
135
+ return new Response();
136
+ };
137
+ // Carry the entry on the stub itself. Hono hands the handler back in the
138
+ // match tuple, so `match()` reads the entry with one property access
139
+ // instead of building a `${method} ${path}` key and consulting
140
+ // `#entryMap` on every request (M87). `#entryMap` remains the duplicate
141
+ // registration guard; this is a second, per-request-free route to the
142
+ // same object, not a second source of truth.
143
+ stubHandler[ROUTE_ENTRY] = entry;
144
+ this.#hono.on(method.toUpperCase(), path, stubHandler);
145
+ }
146
+ get(path, route) {
147
+ this.#registerMethod('GET', path, route);
148
+ }
149
+ post(path, route) {
150
+ this.#registerMethod('POST', path, route);
151
+ }
152
+ put(path, route) {
153
+ this.#registerMethod('PUT', path, route);
154
+ }
155
+ patch(path, route) {
156
+ this.#registerMethod('PATCH', path, route);
157
+ }
158
+ delete(path, route) {
159
+ this.#registerMethod('DELETE', path, route);
160
+ }
161
+ head(path, route) {
162
+ this.#registerMethod('HEAD', path, route);
163
+ }
164
+ options(path, route) {
165
+ this.#registerMethod('OPTIONS', path, route);
166
+ }
167
+ group(prefix, configure) {
168
+ configure(new GroupRouter(this, prefix));
169
+ }
170
+ /**
171
+ * Finds the best matching route for the given method and path.
172
+ *
173
+ * Delegates to Hono's router for matching, then applies the kernel's own
174
+ * deterministic tie-break (§3.6 of M22 plan) when Hono returns multiple
175
+ * candidates of equal specificity.
176
+ *
177
+ * When multiple routes match, the ranking is:
178
+ *
179
+ * 1. more literal (static) segments;
180
+ * 2. then FEWER `*` wildcard segments;
181
+ * 3. then earliest registration order.
182
+ *
183
+ * The wildcard key is what makes an application catch-all lose to a route that
184
+ * names its path, in either registration order. Before M70g a `*` counted as a
185
+ * static segment, so `GET /*` tied with `GET /openapi.json` and won merely by
186
+ * registering first — which is how a full-stack application silently lost its
187
+ * OpenAPI endpoints.
188
+ *
189
+ * The rule compares COUNTS rather than comparing segment by segment, and that
190
+ * has one documented consequence: `/a/*` (one static, one wildcard) loses to
191
+ * `/:x/b` (one static, no wildcard) on a request for `/a/b`, where a
192
+ * per-position rule would prefer the literal `a`. That case is pinned by a test
193
+ * so a future change to per-segment ranking is a deliberate one.
194
+ *
195
+ * @param method - HTTP method
196
+ * @param path - Request path
197
+ * @returns The matched route entry and extracted params, or `null`
198
+ * @since 0.1.0
199
+ */
200
+ match(method, path) {
201
+ // Delegate to Hono's router for matching.
202
+ // honoMatch shape: [[[handler, routeInfo], params], ...]
203
+ // honoMatch[0] is the flat array of candidates.
204
+ // Each candidate: [[handler, routeInfo], params] where routeInfo = {basePath, path, method}.
205
+ const honoMatch = this.#hono.router.match(method, path);
206
+ const candidatesRaw = honoMatch[0];
207
+ // Hono always returns honoMatch[0] as an array; early-return when empty
208
+ // covers the case where no routes are registered or nothing matches.
209
+ if (candidatesRaw.length === 0) {
210
+ return null;
211
+ }
212
+ // Fast path: exactly one candidate, which is every request in an
213
+ // application without overlapping patterns (M87). The candidates array,
214
+ // the per-candidate object literal and the sort below cannot change the
215
+ // outcome when there is nothing to tie-break against, so none of them is
216
+ // built. This mirrors Hono's own single-match bypass.
217
+ if (candidatesRaw.length === 1) {
218
+ const [handlerRouteTuple, rawParams] = candidatesRaw[0];
219
+ const entry = handlerRouteTuple[0][ROUTE_ENTRY];
220
+ const params = decodeParams(rawParams);
221
+ // A malformed escape means this route does not match, mirroring the
222
+ // multi-candidate path's `continue` when every candidate is dropped.
223
+ return params === null ? null : { definition: entry.definition, params, entry };
224
+ }
225
+ // Build candidates array: map each Hono candidate to the kernel RouteEntry.
226
+ // Hono always provides well-formed routeInfo/method/path on matched
227
+ // candidates, and every candidate maps back to #entryMap since we
228
+ // register both simultaneously with identical paths.
229
+ const candidates = [];
230
+ for (const [handlerRouteTuple, rawParams] of candidatesRaw) {
231
+ const routeInfo = handlerRouteTuple[1];
232
+ const routePath = routeInfo.path;
233
+ const routeMethod = routeInfo.method;
234
+ const entry = this.#entryMap.get(`${routeMethod} ${routePath}`);
235
+ // Same decoder as the single-candidate path above (M87 review). Keeping
236
+ // a second inline copy here let the two disagree on identity as well as
237
+ // duplicating the rule: this one built a fresh `{}` for a param-less
238
+ // route while the fast path returns the shared frozen object, so
239
+ // whether `params` was mutable depended on how many routes happened to
240
+ // match. A malformed escape means this candidate does not match,
241
+ // mirroring the old matcher's `null` return.
242
+ const params = decodeParams(rawParams);
243
+ if (params === null) {
244
+ continue;
245
+ }
246
+ candidates.push({ routePath, params, entry });
247
+ }
248
+ // Every candidate may have been dropped for a malformed param escape.
249
+ if (candidates.length === 0) {
250
+ return null;
251
+ }
252
+ // If only one candidate, return it directly.
253
+ if (candidates.length === 1) {
254
+ const { entry, params } = candidates[0];
255
+ return { definition: entry.definition, params, entry };
256
+ }
257
+ // Tie-break: more static segments, then fewer wildcards, then earliest
258
+ // registration order (§3.6 of the M22 plan, extended by M70g).
259
+ candidates.sort((a, b) => {
260
+ if (a.entry.statics !== b.entry.statics) {
261
+ return b.entry.statics - a.entry.statics;
262
+ }
263
+ if (a.entry.wildcards !== b.entry.wildcards) {
264
+ return a.entry.wildcards - b.entry.wildcards;
265
+ }
266
+ return a.entry.index - b.entry.index;
267
+ });
268
+ const best = candidates[0];
269
+ return { definition: best.entry.definition, params: best.params, entry: best.entry };
270
+ }
271
+ /**
272
+ * Returns all registered route entries, including the registration
273
+ * bookkeeping (`index`, `statics`, `wildcards`) that drives the tie-break.
274
+ *
275
+ * @returns The route entries in registration order
276
+ * @internal Test/diagnostics seam — `Router` is not exported from the package
277
+ * barrel, and plugins read routes through the contract's `listRoutes()`.
278
+ */
279
+ getAll() {
280
+ return this.#routes;
281
+ }
282
+ listRoutes() {
283
+ return this.#routes.map((entry) => ({
284
+ method: entry.method,
285
+ path: entry.pattern,
286
+ ...(entry.owner === undefined ? {} : { owner: entry.owner }),
287
+ definition: entry.definition,
288
+ }));
289
+ }
290
+ }
291
+ /**
292
+ * Names the party that registered a route, for the duplicate-route refusal.
293
+ *
294
+ * Module-private with one caller by design: the two arms exist so the message
295
+ * never says "registered by undefined", and a second call site would be a second
296
+ * place for that wording to drift.
297
+ *
298
+ * @param entry - The entry already holding the `METHOD path` key
299
+ * @returns `plugin 'name'` for a plugin-registered route, `the application` otherwise
300
+ */
301
+ function describeRouteOwner(entry) {
302
+ return entry.owner === undefined ? 'the application' : `plugin '${entry.owner}'`;
303
+ }
304
+ /**
305
+ * Route group facade — prefixes every path registered inside the group
306
+ * callback. Nested groups compose prefixes transitively.
307
+ *
308
+ * @since 0.1.0
309
+ */
310
+ class GroupRouter {
311
+ #parent;
312
+ #prefix;
313
+ constructor(parent, prefix) {
314
+ this.#parent = parent;
315
+ this.#prefix = prefix;
316
+ }
317
+ #resolvePath(path) {
318
+ // Normalize: ensure single slash between prefix and path
319
+ const p = path === '/' ? '' : path;
320
+ return this.#prefix + p;
321
+ }
322
+ get(path, route) {
323
+ this.#parent.get(this.#resolvePath(path), route);
324
+ }
325
+ post(path, route) {
326
+ this.#parent.post(this.#resolvePath(path), route);
327
+ }
328
+ put(path, route) {
329
+ this.#parent.put(this.#resolvePath(path), route);
330
+ }
331
+ patch(path, route) {
332
+ this.#parent.patch(this.#resolvePath(path), route);
333
+ }
334
+ delete(path, route) {
335
+ this.#parent.delete(this.#resolvePath(path), route);
336
+ }
337
+ head(path, route) {
338
+ this.#parent.head(this.#resolvePath(path), route);
339
+ }
340
+ options(path, route) {
341
+ this.#parent.options(this.#resolvePath(path), route);
342
+ }
343
+ group(prefix, configure) {
344
+ this.#parent.group(this.#prefix + prefix, configure);
345
+ }
346
+ listRoutes() {
347
+ return this.#parent.listRoutes();
348
+ }
349
+ }
350
+ //# sourceMappingURL=router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/router/router.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAuD5F,4EAA4E;AAC5E,6EAA6E;AAC7E,2EAA2E;AAC3E,yEAAyE;AACzE,0EAA0E;AAC1E,2DAA2D;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD;;;;;;GAMG;AACH;;;;GAIG;AACH,MAAM,WAAW,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAEhD,wFAAwF;AACxF,MAAM,YAAY,GAA2B,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAE/D;;;;;;;;;;;;;;;GAeG;AAC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,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;IAED,IAAI,CAAC,IAAY,EAAE,KAAqC;QACtD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC;IAED,OAAO,CAAC,IAAY,EAAE,KAAqC;QACzD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,MAAc,EAAE,SAAuC;QAC3D,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,GAAG,MAAM,EAAE,SAAS,CAAC,CAAC;IACvD,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;IACnC,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,52 @@
1
1
  {
2
2
  "name": "@setu-ts/kernel",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.10.0",
4
+ "description": "Capability-token plugin kernel: service registry, middleware pipeline, router",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/setu-ts/setu-ts.git",
8
+ "directory": "packages/kernel"
9
+ },
10
+ "homepage": "https://github.com/setu-ts/setu-ts/tree/main/packages/kernel",
11
+ "bugs": {
12
+ "url": "https://github.com/setu-ts/setu-ts/issues"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "sideEffects": false,
18
+ "type": "module",
19
+ "license": "MIT",
20
+ "engines": {
21
+ "node": "^22.23.4 || ^24.22.1 || >=26.12.1"
22
+ },
23
+ "files": [
24
+ "dist",
25
+ "src",
26
+ "README.md",
27
+ "LICENSE",
28
+ "AGENT_CARD.md"
29
+ ],
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "default": "./dist/index.js"
34
+ }
35
+ },
36
+ "dependencies": {
37
+ "@setu-ts/common": "^0.10.0",
38
+ "hono": "^4.12.30"
39
+ },
40
+ "devDependencies": {
41
+ "@setu-ts/exceptions": "^0.10.0",
42
+ "@setu-ts/logger-plugin": "^0.10.0",
43
+ "@setu-ts/runtime": "^0.10.0",
44
+ "@setu-ts/testing": "^0.10.0",
45
+ "@types/node": "^24",
46
+ "typescript": "6.0.3",
47
+ "vitest": "5.0.3"
48
+ },
49
+ "scripts": {
50
+ "build": "tsc -b"
51
+ }
6
52
  }