@xemahq/kernel-contracts 0.24.0 → 0.25.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/LICENSE ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
@@ -29,7 +29,8 @@ export declare enum ContributionKind {
29
29
  OpenCodePlugin = "opencode-plugin",
30
30
  Capability = "capability",
31
31
  ResourceOwnership = "resource-ownership",
32
- StageMachine = "stage-machine"
32
+ StageMachine = "stage-machine",
33
+ SearchType = "search-type"
33
34
  }
34
35
  export declare const ContributionKindSchema: z.ZodEnum<typeof ContributionKind>;
35
36
  export type ContributionKindValue = `${ContributionKind}`;
@@ -1 +1 @@
1
- {"version":3,"file":"contribution-kind.d.ts","sourceRoot":"","sources":["../../../src/contribution/lib/contribution-kind.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IAM9B,WAAW,iBAAiB;IAW5B,cAAc,oBAAoB;IAElC,kBAAkB,yBAAyB;IAE3C,IAAI,SAAS;IAEb,UAAU,gBAAgB;IAE1B,oBAAoB,0BAA0B;IAE9C,oBAAoB,2BAA2B;IAE/C,yBAAyB,gCAAgC;IAGzD,mBAAmB,yBAAyB;IAI5C,cAAc,oBAAoB;IAElC,eAAe,qBAAqB;IAEpC,iBAAiB,uBAAuB;IAExC,yBAAyB,gCAAgC;IAEzD,WAAW,iBAAiB;IAI5B,UAAU,gBAAgB;IAE1B,YAAY,kBAAkB;IAE9B,cAAc,oBAAoB;IAgBlC,UAAU,eAAe;IAezB,iBAAiB,uBAAuB;IAcxC,YAAY,kBAAkB;IAkB9B,UAAU,gBAAgB;CAC3B;AAMD,eAAO,MAAM,sBAAsB,oCAAiC,CAAC;AAErE,MAAM,MAAM,qBAAqB,GAAG,GAAG,gBAAgB,EAAE,CAAC"}
@@ -34,6 +34,7 @@ var ContributionKind;
34
34
  ContributionKind["Capability"] = "capability";
35
35
  ContributionKind["ResourceOwnership"] = "resource-ownership";
36
36
  ContributionKind["StageMachine"] = "stage-machine";
37
+ ContributionKind["SearchType"] = "search-type";
37
38
  })(ContributionKind || (exports.ContributionKind = ContributionKind = {}));
38
39
  exports.ContributionKindSchema = zod_1.z.nativeEnum(ContributionKind);
39
40
  //# sourceMappingURL=contribution-kind.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contribution-kind.js","sourceRoot":"","sources":["../../../src/contribution/lib/contribution-kind.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAoBxB,IAAY,gBAoHX;AApHD,WAAY,gBAAgB;IAE1B,gDAA4B,CAAA;IAC5B,wCAAoB,CAAA;IACpB,kDAA8B,CAAA;IAC9B,8CAA0B,CAAA;IAC1B,kDAA8B,CAAA;IAC9B,8CAA0B,CAAA;IAC1B,gDAA4B,CAAA;IAC5B,2EAAuD,CAAA;IACvD,8CAA0B,CAAA;IAQ1B,kDAA8B,CAAA;I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E1B,kDAA8B,CAAA;IAE9B,sDAAkC,CAAA;IAgBlC,6CAAyB,CAAA;IAezB,4DAAwC,CAAA;IAcxC,kDAA8B,CAAA;IAkB9B,8CAA0B,CAAA;AAC5B,CAAC,EAtIW,gBAAgB,gCAAhB,gBAAgB,QAsI3B;AAMY,QAAA,sBAAsB,GAAG,OAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './lib/search-contribution';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/search/index.ts"],"names":[],"mappings":"AAkBA,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./lib/search-contribution"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/search/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAkBA,4DAA0C"}
@@ -0,0 +1,27 @@
1
+ import { z } from 'zod';
2
+ import { type CapabilityRef } from '../../capability';
3
+ import { XemaObjectKind } from '../../object';
4
+ import { ResourceVisibilityPattern } from '../../resource';
5
+ export interface SearchTypeRenderHints {
6
+ readonly label: string;
7
+ readonly icon?: string;
8
+ readonly routeTemplate?: string;
9
+ }
10
+ export declare const SearchTypeRenderHintsSchema: z.ZodType<SearchTypeRenderHints>;
11
+ export interface SearchTypeAuthzMapping {
12
+ readonly resourceType: string;
13
+ readonly defaultVisibility: ResourceVisibilityPattern;
14
+ }
15
+ export declare const SearchTypeAuthzMappingSchema: z.ZodType<SearchTypeAuthzMapping>;
16
+ export interface SearchTypeContributionManifest {
17
+ readonly objectKind: XemaObjectKind;
18
+ readonly docType?: string;
19
+ readonly renderHints: SearchTypeRenderHints;
20
+ readonly searchableFields: readonly string[];
21
+ readonly embeddingEligibleDefault: boolean;
22
+ readonly authz: SearchTypeAuthzMapping;
23
+ readonly searchReplayCapabilityRef?: CapabilityRef;
24
+ }
25
+ export declare const SearchTypeContributionManifestSchema: z.ZodType<SearchTypeContributionManifest>;
26
+ export declare function searchTypeNaturalKey(objectKind: XemaObjectKind, docType?: string): string;
27
+ //# sourceMappingURL=search-contribution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-contribution.d.ts","sourceRoot":"","sources":["../../../src/search/lib/search-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAwB,MAAM,cAAc,CAAC;AACpE,OAAO,EACL,yBAAyB,EAE1B,MAAM,gBAAgB,CAAC;AA6BxB,MAAM,WAAW,qBAAqB;IAEpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAMvB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,eAAO,MAAM,2BAA2B,EAAE,CAAC,CAAC,OAAO,CAAC,qBAAqB,CASjC,CAAC;AAWzC,MAAM,WAAW,sBAAsB;IAErC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B,QAAQ,CAAC,iBAAiB,EAAE,yBAAyB,CAAC;CACvD;AAED,eAAO,MAAM,4BAA4B,EAAE,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAIlC,CAAC;AAiB1C,MAAM,WAAW,8BAA8B;IAK7C,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IAMpC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAE1B,QAAQ,CAAC,WAAW,EAAE,qBAAqB,CAAC;IAK5C,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IAM7C,QAAQ,CAAC,wBAAwB,EAAE,OAAO,CAAC;IAE3C,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC;IAOvC,QAAQ,CAAC,yBAAyB,CAAC,EAAE,aAAa,CAAC;CACpD;AASD,eAAO,MAAM,oCAAoC,EAAE,CAAC,CAAC,OAAO,CAAC,8BAA8B,CAY1C,CAAC;AAOlD,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,cAAc,EAC1B,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAER"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SearchTypeContributionManifestSchema = exports.SearchTypeAuthzMappingSchema = exports.SearchTypeRenderHintsSchema = void 0;
4
+ exports.searchTypeNaturalKey = searchTypeNaturalKey;
5
+ const zod_1 = require("zod");
6
+ const capability_1 = require("../../capability");
7
+ const object_1 = require("../../object");
8
+ const resource_1 = require("../../resource");
9
+ const SEARCH_TYPE_STRING_MAX = 200;
10
+ const SEARCH_TYPE_ROUTE_TEMPLATE_MAX = 500;
11
+ const SEARCH_TYPE_FIELDS_MAX = 100;
12
+ exports.SearchTypeRenderHintsSchema = zod_1.z.object({
13
+ label: zod_1.z.string().min(1).max(SEARCH_TYPE_STRING_MAX),
14
+ icon: zod_1.z.string().min(1).max(SEARCH_TYPE_STRING_MAX).optional(),
15
+ routeTemplate: zod_1.z
16
+ .string()
17
+ .min(1)
18
+ .max(SEARCH_TYPE_ROUTE_TEMPLATE_MAX)
19
+ .optional(),
20
+ });
21
+ exports.SearchTypeAuthzMappingSchema = zod_1.z.object({
22
+ resourceType: zod_1.z.string().min(1).max(SEARCH_TYPE_STRING_MAX),
23
+ defaultVisibility: resource_1.ResourceVisibilityPatternSchema,
24
+ });
25
+ exports.SearchTypeContributionManifestSchema = zod_1.z.object({
26
+ objectKind: object_1.XemaObjectKindSchema,
27
+ docType: zod_1.z.string().min(1).max(SEARCH_TYPE_STRING_MAX).optional(),
28
+ renderHints: exports.SearchTypeRenderHintsSchema,
29
+ searchableFields: zod_1.z
30
+ .array(zod_1.z.string().min(1).max(SEARCH_TYPE_STRING_MAX))
31
+ .min(1)
32
+ .max(SEARCH_TYPE_FIELDS_MAX),
33
+ embeddingEligibleDefault: zod_1.z.boolean(),
34
+ authz: exports.SearchTypeAuthzMappingSchema,
35
+ searchReplayCapabilityRef: capability_1.CapabilityRefSchema.optional(),
36
+ });
37
+ function searchTypeNaturalKey(objectKind, docType) {
38
+ return docType ? `${objectKind}/${docType}` : String(objectKind);
39
+ }
40
+ //# sourceMappingURL=search-contribution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-contribution.js","sourceRoot":"","sources":["../../../src/search/lib/search-contribution.ts"],"names":[],"mappings":";;;AA+JA,oDAKC;AApKD,6BAAwB;AAExB,iDAA2E;AAC3E,yCAAoE;AACpE,6CAGwB;AAOxB,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAOnC,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAO3C,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAqBtB,QAAA,2BAA2B,GACtC,OAAC,CAAC,MAAM,CAAC;IACP,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xemahq/kernel-contracts",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "description": "Consolidated Xema OS kernel wire contracts — pure types + zod schemas for the kernel protocol surfaces. One package, one npm scope, wildcard per-surface subpath exports. No framework/runtime deps.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Neuralchowder Inc. <developer@xema.dev> (https://xema.dev)",
@@ -19,28 +19,18 @@
19
19
  "dist",
20
20
  "src"
21
21
  ],
22
- "scripts": {
23
- "clean": "rm -rf dist",
24
- "build": "tsc -p tsconfig.json && node scripts/emit-awp-spec.mjs",
25
- "format": "prettier --write \"src/**/*.ts\"",
26
- "typecheck": "tsc -p tsconfig.json --noEmit",
27
- "lint": "eslint .",
28
- "check:boundary": "node scripts/check-subpath-dag.mjs",
29
- "docs:manifest-reference": "node scripts/generate-biome-manifest-reference.mjs",
30
- "test": "node --test \"tests/*.spec.mjs\""
31
- },
32
22
  "devDependencies": {
33
- "@eslint/js": "catalog:",
34
- "@types/node": "catalog:",
35
- "eslint": "catalog:",
36
- "eslint-config-prettier": "catalog:",
23
+ "@eslint/js": "^9.39.4",
24
+ "@types/node": "25.2.3",
25
+ "eslint": "^9.39.4",
26
+ "eslint-config-prettier": "^10.1.8",
37
27
  "eslint-plugin-import": "^2.31.0",
38
- "prettier": "catalog:",
39
- "typescript": "catalog:",
40
- "typescript-eslint": "catalog:"
28
+ "prettier": "3.6.2",
29
+ "typescript": "5.9.3",
30
+ "typescript-eslint": "^8.56.1"
41
31
  },
42
32
  "dependencies": {
43
- "zod": "catalog:"
33
+ "zod": "^4.3.6"
44
34
  },
45
35
  "exports": {
46
36
  "./*": {
@@ -49,5 +39,15 @@
49
39
  "default": "./dist/*/index.js"
50
40
  },
51
41
  "./package.json": "./package.json"
42
+ },
43
+ "scripts": {
44
+ "clean": "rm -rf dist",
45
+ "build": "tsc -p tsconfig.json && node scripts/emit-awp-spec.mjs",
46
+ "format": "prettier --write \"src/**/*.ts\"",
47
+ "typecheck": "tsc -p tsconfig.json --noEmit",
48
+ "lint": "eslint .",
49
+ "check:boundary": "node scripts/check-subpath-dag.mjs",
50
+ "docs:manifest-reference": "node scripts/generate-biome-manifest-reference.mjs",
51
+ "test": "node --test \"tests/*.spec.mjs\""
52
52
  }
53
- }
53
+ }
@@ -134,6 +134,24 @@ export enum ContributionKind {
134
134
  * stage machine is a host-domain concept, not a kernel one.
135
135
  */
136
136
  StageMachine = 'stage-machine',
137
+
138
+ // -- Search result-type self-registration ----------------------------------
139
+ /**
140
+ * A search RESULT-TYPE declaration contributed by a biome — the
141
+ * `XemaObjectKind`/`docType` it covers, render/route hints (label, icon,
142
+ * deep-link template), the searchable-field set + embedding-eligibility
143
+ * default, and the authz mapping (`resourceType` + default
144
+ * `ResourceVisibilityPattern`). The kernel owns this enum member AND the
145
+ * manifest schema (`SearchTypeContributionManifestSchema`, exported from
146
+ * `@xemahq/kernel-contracts/search`), mirroring the `Capability` and
147
+ * `ResourceOwnership` kinds: a single value-identical wire shape both the
148
+ * contribution-file parser (`search-type.parser.ts` in `biome-host-api`) and
149
+ * the owning service (`search-api`) validate fail-fast. Provenance is stamped
150
+ * by the parser from the discovering biome's manifest — authors do not
151
+ * declare it inline. RESULT-TYPES are contributed (declarative, boot-time);
152
+ * document INSTANCES are event-fed (runtime, via `IndexableDocument`).
153
+ */
154
+ SearchType = 'search-type',
137
155
  }
138
156
 
139
157
  /**
@@ -0,0 +1,19 @@
1
+ // ═══════════════════════════════════════════════════════════════════════════
2
+ // @xemahq/kernel-contracts/search — search RESULT-TYPE contribution contract.
3
+ //
4
+ // Pure types + Zod schemas for the `ContributionKind.SearchType` manifest: the
5
+ // declarative, boot-time registration of a search result-type (the
6
+ // `(XemaObjectKind, docType)` facet) a biome contributes to `search-api`. The
7
+ // object model (`object` subpath) is the identity backbone, the authz mapping
8
+ // reuses the `resource` subpath's `ResourceVisibilityPattern`, and the optional
9
+ // replay ref reuses the `capability` subpath's `CapabilityRef` — this surface
10
+ // therefore declares exactly three cross-subpath edges
11
+ // (`search -> object`, `search -> resource`, `search -> capability`), all
12
+ // acyclic. Zero runtime deps beyond `zod`.
13
+ //
14
+ // NOTE: this is distinct from the `search-source` subpath, which carries the
15
+ // runtime `IndexableDocument` (document INSTANCES, event-fed). RESULT-TYPES are
16
+ // contributed (declarative); INSTANCES are event-fed (runtime).
17
+ // ═══════════════════════════════════════════════════════════════════════════
18
+
19
+ export * from './lib/search-contribution';
@@ -0,0 +1,165 @@
1
+ import { z } from 'zod';
2
+
3
+ import { CapabilityRefSchema, type CapabilityRef } from '../../capability';
4
+ import { XemaObjectKind, XemaObjectKindSchema } from '../../object';
5
+ import {
6
+ ResourceVisibilityPattern,
7
+ ResourceVisibilityPatternSchema,
8
+ } from '../../resource';
9
+
10
+ /**
11
+ * Maximum length of the short identifier / label strings on a search-type
12
+ * manifest. Bounded so describe/list responses stay small and persisted rows
13
+ * have a predictable upper size.
14
+ */
15
+ const SEARCH_TYPE_STRING_MAX = 200;
16
+
17
+ /**
18
+ * Maximum length of the deep-link route template. A route template is a small
19
+ * path pattern (e.g. `/kb/{orgId}/pages/{slug}`), never a full document, so a
20
+ * generous-but-bounded cap keeps a contribution envelope small.
21
+ */
22
+ const SEARCH_TYPE_ROUTE_TEMPLATE_MAX = 500;
23
+
24
+ /**
25
+ * Hard cap on the number of searchable fields a single result-type may declare.
26
+ * A result-type that genuinely needs more distinct searchable fields is a
27
+ * modelling smell — fold the extra text into `content`.
28
+ */
29
+ const SEARCH_TYPE_FIELDS_MAX = 100;
30
+
31
+ /**
32
+ * `SearchTypeRenderHints` — the generic render/route hints a result-type ships
33
+ * so the frontend can present a hit WITHOUT hardcoding a per-kind switch. The
34
+ * search-web biome's generic renderer reads these; a new biome becomes
35
+ * fully-renderable purely by contributing them.
36
+ */
37
+ export interface SearchTypeRenderHints {
38
+ /** Human-readable result-type label (e.g. "Knowledge Page"). ≤ 200 chars. */
39
+ readonly label: string;
40
+ /** Optional icon slug/name the frontend maps to an icon component. ≤ 200 chars. */
41
+ readonly icon?: string;
42
+ /**
43
+ * Optional deep-link route template with `{placeholder}` segments the
44
+ * frontend fills from a result's fields (e.g. `/kb/{orgId}/pages/{slug}`).
45
+ * ≤ 500 chars. Absent ⇒ the result is not directly deep-linkable.
46
+ */
47
+ readonly routeTemplate?: string;
48
+ }
49
+
50
+ export const SearchTypeRenderHintsSchema: z.ZodType<SearchTypeRenderHints> =
51
+ z.object({
52
+ label: z.string().min(1).max(SEARCH_TYPE_STRING_MAX),
53
+ icon: z.string().min(1).max(SEARCH_TYPE_STRING_MAX).optional(),
54
+ routeTemplate: z
55
+ .string()
56
+ .min(1)
57
+ .max(SEARCH_TYPE_ROUTE_TEMPLATE_MAX)
58
+ .optional(),
59
+ }) as z.ZodType<SearchTypeRenderHints>;
60
+
61
+ /**
62
+ * `SearchTypeAuthzMapping` — how instances of this result-type map onto the
63
+ * result-level permission model. `resourceType` is the FGA resource-type slug
64
+ * used for the `authorization-api` `ListObjects` push-down; `defaultVisibility`
65
+ * is the fallback `ResourceVisibilityPattern` applied to an instance that does
66
+ * not carry its own per-instance visibility. Reuses the kernel
67
+ * `ResourceVisibilityPattern` — the SAME closed set the `ResourceOwnership`
68
+ * contribution declares — so search and object-registry never drift.
69
+ */
70
+ export interface SearchTypeAuthzMapping {
71
+ /** The FGA/authorization resource-type slug for this result-type. ≤ 200 chars. */
72
+ readonly resourceType: string;
73
+ /** Fallback visibility for an instance with no explicit per-instance pattern. */
74
+ readonly defaultVisibility: ResourceVisibilityPattern;
75
+ }
76
+
77
+ export const SearchTypeAuthzMappingSchema: z.ZodType<SearchTypeAuthzMapping> =
78
+ z.object({
79
+ resourceType: z.string().min(1).max(SEARCH_TYPE_STRING_MAX),
80
+ defaultVisibility: ResourceVisibilityPatternSchema,
81
+ }) as z.ZodType<SearchTypeAuthzMapping>;
82
+
83
+ /**
84
+ * Manifest shape carried by every `ContributionKind.SearchType` envelope.
85
+ * One contribution = one search RESULT-TYPE (the `(objectKind, docType)`
86
+ * facet).
87
+ *
88
+ * Mirrors `CapabilityContributionManifest` / `ResourceOwnershipContributionManifest`
89
+ * precisely: a value-identical subset of the wire body the owning service
90
+ * (`search-api`) accepts, validated fail-fast at biome-discovery time.
91
+ * Provenance (`biome.id`, `biome.version`) is NOT a field here — the
92
+ * `SearchTypeParser` stamps it from the discovering biome's `xema-biome.json`.
93
+ * Authors do not declare provenance inline.
94
+ *
95
+ * Validation is fail-fast: a contribution that violates any constraint is
96
+ * rejected at boot. No silent coercion.
97
+ */
98
+ export interface SearchTypeContributionManifest {
99
+ /**
100
+ * The `XemaObjectKind` this result-type covers. The object model is the
101
+ * identity/scope backbone — every result addresses through it.
102
+ */
103
+ readonly objectKind: XemaObjectKind;
104
+ /**
105
+ * Optional biome sub-facet under `objectKind` (e.g. `kb_page` under
106
+ * `knowledge-page`). Absent ⇒ the result-type covers the kind as a whole.
107
+ * The natural key of a result-type is `(objectKind, docType)`.
108
+ */
109
+ readonly docType?: string;
110
+ /** Generic render/route hints so the frontend presents hits without a per-kind switch. */
111
+ readonly renderHints: SearchTypeRenderHints;
112
+ /**
113
+ * The set of instance fields that carry retrieval-worthy text for this
114
+ * result-type. At least one; hard-capped at 100.
115
+ */
116
+ readonly searchableFields: readonly string[];
117
+ /**
118
+ * Default embedding-eligibility for instances of this result-type when the
119
+ * instance itself does not declare `embeddingEligible`. A closed, declared
120
+ * default — never inferred from any other field.
121
+ */
122
+ readonly embeddingEligibleDefault: boolean;
123
+ /** How instances of this result-type map onto the result-level permission model. */
124
+ readonly authz: SearchTypeAuthzMapping;
125
+ /**
126
+ * Optional capability ref for replaying/opening an instance of this
127
+ * result-type (e.g. `knowledge-base:page.replay@1`). Absent ⇒ this
128
+ * result-type has no replay capability. A typed `CapabilityRef`, never a
129
+ * free-form string.
130
+ */
131
+ readonly searchReplayCapabilityRef?: CapabilityRef;
132
+ }
133
+
134
+ /**
135
+ * Zod validator for `SearchTypeContributionManifest`. The biome-discovery
136
+ * parser AND `search-api`'s contribution-sync handler BOTH route every
137
+ * candidate envelope through this schema, so a malformed contribution fails at
138
+ * the boundary instead of at the wire (mirrors
139
+ * `CapabilityContributionManifestSchema`).
140
+ */
141
+ export const SearchTypeContributionManifestSchema: z.ZodType<SearchTypeContributionManifest> =
142
+ z.object({
143
+ objectKind: XemaObjectKindSchema,
144
+ docType: z.string().min(1).max(SEARCH_TYPE_STRING_MAX).optional(),
145
+ renderHints: SearchTypeRenderHintsSchema,
146
+ searchableFields: z
147
+ .array(z.string().min(1).max(SEARCH_TYPE_STRING_MAX))
148
+ .min(1)
149
+ .max(SEARCH_TYPE_FIELDS_MAX),
150
+ embeddingEligibleDefault: z.boolean(),
151
+ authz: SearchTypeAuthzMappingSchema,
152
+ searchReplayCapabilityRef: CapabilityRefSchema.optional(),
153
+ }) as z.ZodType<SearchTypeContributionManifest>;
154
+
155
+ /**
156
+ * The stable natural key of a result-type: `objectKind` when no `docType`, else
157
+ * `objectKind/docType`. Centralized so the parser slug, the DB unique key, and
158
+ * the reconciler's `seenKeyOf` all agree.
159
+ */
160
+ export function searchTypeNaturalKey(
161
+ objectKind: XemaObjectKind,
162
+ docType?: string,
163
+ ): string {
164
+ return docType ? `${objectKind}/${docType}` : String(objectKind);
165
+ }