@contractspec/example.locale-jurisdiction-gate 1.44.1 → 1.45.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.
@@ -1,20 +1,20 @@
1
1
  $ tsdown
2
2
  ℹ tsdown v0.18.3 powered by rolldown v1.0.0-beta.57
3
3
  ℹ config file: /home/runner/work/contractspec/contractspec/packages/examples/locale-jurisdiction-gate/tsdown.config.js
4
- ℹ entry: src/events.ts, src/example.ts, src/index.ts, src/locale-jurisdiction-gate.feature.ts, src/docs/index.ts, src/docs/locale-jurisdiction-gate.docblock.ts, src/entities/index.ts, src/entities/models.ts, src/handlers/demo.handlers.ts, src/handlers/index.ts, src/policy/guard.ts, src/policy/index.ts, src/policy/types.ts, src/operations/assistant.ts, src/operations/index.ts
4
+ ℹ entry: src/events.ts, src/example.ts, src/index.ts, src/locale-jurisdiction-gate.feature.ts, src/docs/index.ts, src/docs/locale-jurisdiction-gate.docblock.ts, src/entities/index.ts, src/entities/models.ts, src/handlers/demo.handlers.ts, src/handlers/index.ts, src/operations/assistant.ts, src/operations/index.ts, src/policy/guard.ts, src/policy/index.ts, src/policy/types.ts
5
5
  ℹ target: esnext
6
6
  ℹ tsconfig: tsconfig.json
7
7
  ℹ Build start
8
8
  ℹ Cleaning 51 files
9
9
  ℹ dist/entities/models.js 3.95 kB │ gzip: 0.83 kB
10
- ℹ dist/operations/assistant.js 3.24 kB │ gzip: 1.07 kB
11
- ℹ dist/events.js 3.06 kB │ gzip: 0.67 kB
10
+ ℹ dist/operations/assistant.js 3.25 kB │ gzip: 1.07 kB
11
+ ℹ dist/events.js 3.07 kB │ gzip: 0.68 kB
12
12
  ℹ dist/handlers/demo.handlers.js 2.46 kB │ gzip: 0.90 kB
13
13
  ℹ dist/policy/guard.js 1.90 kB │ gzip: 0.76 kB
14
14
  ℹ dist/docs/locale-jurisdiction-gate.docblock.js 1.64 kB │ gzip: 0.74 kB
15
15
  ℹ dist/index.js 1.27 kB │ gzip: 0.40 kB
16
- ℹ dist/locale-jurisdiction-gate.feature.js 1.04 kB │ gzip: 0.46 kB
17
- ℹ dist/example.js 0.94 kB │ gzip: 0.50 kB
16
+ ℹ dist/locale-jurisdiction-gate.feature.js 1.08 kB │ gzip: 0.46 kB
17
+ ℹ dist/example.js 1.05 kB │ gzip: 0.55 kB
18
18
  ℹ dist/entities/index.js 0.36 kB │ gzip: 0.16 kB
19
19
  ℹ dist/operations/index.js 0.16 kB │ gzip: 0.10 kB
20
20
  ℹ dist/policy/index.js 0.15 kB │ gzip: 0.11 kB
@@ -23,12 +23,12 @@ $ tsdown
23
23
  ℹ dist/policy/types.js 0.00 kB │ gzip: 0.02 kB
24
24
  ℹ dist/handlers/demo.handlers.js.map 5.97 kB │ gzip: 1.81 kB
25
25
  ℹ dist/entities/models.js.map 5.85 kB │ gzip: 1.20 kB
26
- ℹ dist/operations/assistant.js.map 4.58 kB │ gzip: 1.40 kB
27
- ℹ dist/events.js.map 4.39 kB │ gzip: 0.92 kB
26
+ ℹ dist/operations/assistant.js.map 4.60 kB │ gzip: 1.41 kB
27
+ ℹ dist/events.js.map 4.40 kB │ gzip: 0.93 kB
28
28
  ℹ dist/policy/guard.js.map 4.12 kB │ gzip: 1.44 kB
29
29
  ℹ dist/docs/locale-jurisdiction-gate.docblock.js.map 2.16 kB │ gzip: 0.93 kB
30
- ℹ dist/locale-jurisdiction-gate.feature.js.map 1.68 kB │ gzip: 0.73 kB
31
- ℹ dist/example.js.map 1.34 kB │ gzip: 0.68 kB
30
+ ℹ dist/locale-jurisdiction-gate.feature.js.map 1.73 kB │ gzip: 0.73 kB
31
+ ℹ dist/example.js.map 1.61 kB │ gzip: 0.78 kB
32
32
  ℹ dist/entities/models.d.ts.map 0.91 kB │ gzip: 0.39 kB
33
33
  ℹ dist/policy/guard.d.ts.map 0.76 kB │ gzip: 0.39 kB
34
34
  ℹ dist/operations/assistant.d.ts.map 0.65 kB │ gzip: 0.28 kB
@@ -36,21 +36,21 @@ $ tsdown
36
36
  ℹ dist/handlers/demo.handlers.d.ts.map 0.45 kB │ gzip: 0.26 kB
37
37
  ℹ dist/policy/types.d.ts.map 0.25 kB │ gzip: 0.19 kB
38
38
  ℹ dist/locale-jurisdiction-gate.feature.d.ts.map 0.18 kB │ gzip: 0.14 kB
39
- ℹ dist/example.d.ts.map 0.14 kB │ gzip: 0.13 kB
39
+ ℹ dist/example.d.ts.map 0.12 kB │ gzip: 0.12 kB
40
40
  ℹ dist/operations/assistant.d.ts 7.28 kB │ gzip: 0.64 kB
41
41
  ℹ dist/entities/models.d.ts 5.48 kB │ gzip: 0.68 kB
42
42
  ℹ dist/events.d.ts 2.20 kB │ gzip: 0.38 kB
43
43
  ℹ dist/handlers/demo.handlers.d.ts 1.48 kB │ gzip: 0.55 kB
44
44
  ℹ dist/index.d.ts 1.37 kB │ gzip: 0.42 kB
45
- ℹ dist/example.d.ts 1.20 kB │ gzip: 0.49 kB
46
45
  ℹ dist/policy/guard.d.ts 0.93 kB │ gzip: 0.42 kB
47
46
  ℹ dist/policy/types.d.ts 0.46 kB │ gzip: 0.31 kB
48
47
  ℹ dist/entities/index.d.ts 0.36 kB │ gzip: 0.16 kB
49
48
  ℹ dist/locale-jurisdiction-gate.feature.d.ts 0.30 kB │ gzip: 0.18 kB
50
49
  ℹ dist/policy/index.d.ts 0.26 kB │ gzip: 0.14 kB
50
+ ℹ dist/example.d.ts 0.20 kB │ gzip: 0.16 kB
51
51
  ℹ dist/operations/index.d.ts 0.16 kB │ gzip: 0.10 kB
52
52
  ℹ dist/handlers/index.d.ts 0.15 kB │ gzip: 0.09 kB
53
53
  ℹ dist/docs/index.d.ts 0.01 kB │ gzip: 0.03 kB
54
54
  ℹ dist/docs/locale-jurisdiction-gate.docblock.d.ts 0.01 kB │ gzip: 0.03 kB
55
- ℹ 46 files, total: 76.00 kB
56
- ✔ Build complete in 24437ms
55
+ ℹ 46 files, total: 75.52 kB
56
+ ✔ Build complete in 23631ms
@@ -8,14 +8,14 @@ $ tsdown
8
8
  ℹ tsconfig: tsconfig.json
9
9
  ℹ Build start
10
10
  ℹ dist/entities/models.js 3.95 kB │ gzip: 0.83 kB
11
- ℹ dist/operations/assistant.js 3.24 kB │ gzip: 1.07 kB
12
- ℹ dist/events.js 3.06 kB │ gzip: 0.67 kB
11
+ ℹ dist/operations/assistant.js 3.25 kB │ gzip: 1.07 kB
12
+ ℹ dist/events.js 3.07 kB │ gzip: 0.68 kB
13
13
  ℹ dist/handlers/demo.handlers.js 2.46 kB │ gzip: 0.90 kB
14
14
  ℹ dist/policy/guard.js 1.90 kB │ gzip: 0.76 kB
15
15
  ℹ dist/docs/locale-jurisdiction-gate.docblock.js 1.64 kB │ gzip: 0.74 kB
16
16
  ℹ dist/index.js 1.27 kB │ gzip: 0.40 kB
17
- ℹ dist/locale-jurisdiction-gate.feature.js 1.04 kB │ gzip: 0.46 kB
18
- ℹ dist/example.js 0.94 kB │ gzip: 0.50 kB
17
+ ℹ dist/locale-jurisdiction-gate.feature.js 1.08 kB │ gzip: 0.46 kB
18
+ ℹ dist/example.js 1.05 kB │ gzip: 0.55 kB
19
19
  ℹ dist/entities/index.js 0.36 kB │ gzip: 0.16 kB
20
20
  ℹ dist/operations/index.js 0.16 kB │ gzip: 0.10 kB
21
21
  ℹ dist/policy/index.js 0.15 kB │ gzip: 0.11 kB
@@ -24,12 +24,12 @@ $ tsdown
24
24
  ℹ dist/policy/types.js 0.00 kB │ gzip: 0.02 kB
25
25
  ℹ dist/handlers/demo.handlers.js.map 5.97 kB │ gzip: 1.81 kB
26
26
  ℹ dist/entities/models.js.map 5.85 kB │ gzip: 1.20 kB
27
- ℹ dist/operations/assistant.js.map 4.58 kB │ gzip: 1.40 kB
28
- ℹ dist/events.js.map 4.39 kB │ gzip: 0.92 kB
27
+ ℹ dist/operations/assistant.js.map 4.60 kB │ gzip: 1.41 kB
28
+ ℹ dist/events.js.map 4.40 kB │ gzip: 0.93 kB
29
29
  ℹ dist/policy/guard.js.map 4.12 kB │ gzip: 1.44 kB
30
30
  ℹ dist/docs/locale-jurisdiction-gate.docblock.js.map 2.16 kB │ gzip: 0.93 kB
31
- ℹ dist/locale-jurisdiction-gate.feature.js.map 1.68 kB │ gzip: 0.73 kB
32
- ℹ dist/example.js.map 1.34 kB │ gzip: 0.68 kB
31
+ ℹ dist/locale-jurisdiction-gate.feature.js.map 1.73 kB │ gzip: 0.73 kB
32
+ ℹ dist/example.js.map 1.61 kB │ gzip: 0.78 kB
33
33
  ℹ dist/entities/models.d.ts.map 0.91 kB │ gzip: 0.39 kB
34
34
  ℹ dist/policy/guard.d.ts.map 0.76 kB │ gzip: 0.39 kB
35
35
  ℹ dist/operations/assistant.d.ts.map 0.65 kB │ gzip: 0.28 kB
@@ -37,21 +37,21 @@ $ tsdown
37
37
  ℹ dist/handlers/demo.handlers.d.ts.map 0.45 kB │ gzip: 0.26 kB
38
38
  ℹ dist/policy/types.d.ts.map 0.25 kB │ gzip: 0.19 kB
39
39
  ℹ dist/locale-jurisdiction-gate.feature.d.ts.map 0.18 kB │ gzip: 0.14 kB
40
- ℹ dist/example.d.ts.map 0.14 kB │ gzip: 0.13 kB
40
+ ℹ dist/example.d.ts.map 0.12 kB │ gzip: 0.12 kB
41
41
  ℹ dist/operations/assistant.d.ts 7.28 kB │ gzip: 0.64 kB
42
- ℹ dist/entities/models.d.ts 5.43 kB │ gzip: 0.67 kB
43
- ℹ dist/events.d.ts 2.22 kB │ gzip: 0.38 kB
42
+ ℹ dist/entities/models.d.ts 5.48 kB │ gzip: 0.68 kB
43
+ ℹ dist/events.d.ts 2.20 kB │ gzip: 0.38 kB
44
44
  ℹ dist/handlers/demo.handlers.d.ts 1.48 kB │ gzip: 0.55 kB
45
45
  ℹ dist/index.d.ts 1.37 kB │ gzip: 0.42 kB
46
- ℹ dist/example.d.ts 1.20 kB │ gzip: 0.49 kB
47
46
  ℹ dist/policy/guard.d.ts 0.93 kB │ gzip: 0.42 kB
48
47
  ℹ dist/policy/types.d.ts 0.46 kB │ gzip: 0.31 kB
49
48
  ℹ dist/entities/index.d.ts 0.36 kB │ gzip: 0.16 kB
50
49
  ℹ dist/locale-jurisdiction-gate.feature.d.ts 0.30 kB │ gzip: 0.18 kB
51
50
  ℹ dist/policy/index.d.ts 0.26 kB │ gzip: 0.14 kB
51
+ ℹ dist/example.d.ts 0.20 kB │ gzip: 0.16 kB
52
52
  ℹ dist/operations/index.d.ts 0.16 kB │ gzip: 0.10 kB
53
53
  ℹ dist/handlers/index.d.ts 0.15 kB │ gzip: 0.09 kB
54
54
  ℹ dist/docs/index.d.ts 0.01 kB │ gzip: 0.03 kB
55
55
  ℹ dist/docs/locale-jurisdiction-gate.docblock.d.ts 0.01 kB │ gzip: 0.03 kB
56
- ℹ 46 files, total: 75.97 kB
57
- ✔ Build complete in 23885ms
56
+ ℹ 46 files, total: 75.52 kB
57
+ ✔ Build complete in 24950ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @contractspec/example.locale-jurisdiction-gate
2
2
 
3
+ ## 1.45.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e73ca1d: feat: improve app config and examples contracts
8
+ feat: Contract layers support (features, examples, app-configs)
9
+
10
+ ### New CLI Commands
11
+ - `contractspec list layers` - List all contract layers with filtering
12
+
13
+ ### Enhanced Commands
14
+ - `contractspec ci` - New `layers` check category validates features/examples/config
15
+ - `contractspec doctor` - New `layers` health checks
16
+ - `contractspec integrity` - Now shows layer statistics
17
+
18
+ ### New APIs
19
+ - `discoverLayers()` - Scan workspace for all layer files
20
+ - `scanExampleSource()` - Parse ExampleSpec from source code
21
+ - `isExampleFile()` - Check if file is an example spec
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [e73ca1d]
26
+ - @contractspec/lib.contracts@1.45.0
27
+ - @contractspec/lib.schema@1.45.0
28
+
3
29
  ## 1.44.1
4
30
 
5
31
  ### Patch Changes
package/dist/events.js CHANGED
@@ -31,7 +31,7 @@ const AssistantAnswerRequestedPayload = defineSchemaModel({
31
31
  const AssistantAnswerRequestedEvent = defineEvent({
32
32
  meta: {
33
33
  key: "assistant.answer.requested",
34
- version: 1,
34
+ version: "1.0.0",
35
35
  description: "Assistant answer requested (policy gate will run).",
36
36
  stability: "experimental",
37
37
  owners: ["@examples"],
@@ -60,7 +60,7 @@ const AssistantAnswerBlockedPayload = defineSchemaModel({
60
60
  const AssistantAnswerBlockedEvent = defineEvent({
61
61
  meta: {
62
62
  key: "assistant.answer.blocked",
63
- version: 1,
63
+ version: "1.0.0",
64
64
  description: "Assistant answer blocked (fail-closed).",
65
65
  stability: "experimental",
66
66
  owners: ["@examples"],
@@ -105,7 +105,7 @@ const AssistantAnswerDeliveredPayload = defineSchemaModel({
105
105
  const AssistantAnswerDeliveredEvent = defineEvent({
106
106
  meta: {
107
107
  key: "assistant.answer.delivered",
108
- version: 1,
108
+ version: "1.0.0",
109
109
  description: "Assistant answer delivered (must include KB snapshot citations).",
110
110
  stability: "experimental",
111
111
  owners: ["@examples"],
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","names":[],"sources":["../src/events.ts"],"sourcesContent":["import { defineEvent, defineSchemaModel } from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum } from '@contractspec/lib.schema';\n\nconst AssistantAnswerRequestedPayload = defineSchemaModel({\n name: 'AssistantAnswerRequestedPayload',\n description: 'Emitted when an assistant answer is requested (pre-gate).',\n fields: {\n traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n locale: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n kbSnapshotId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n allowedScope: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nexport const AssistantAnswerRequestedEvent = defineEvent({\n meta: {\n key: 'assistant.answer.requested',\n version: 1,\n description: 'Assistant answer requested (policy gate will run).',\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['assistant', 'policy'],\n },\n payload: AssistantAnswerRequestedPayload,\n});\n\nconst AssistantAnswerBlockedPayload = defineSchemaModel({\n name: 'AssistantAnswerBlockedPayload',\n description: 'Emitted when a request is blocked by the gate.',\n fields: {\n traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n reasonCode: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nexport const AssistantAnswerBlockedEvent = defineEvent({\n meta: {\n key: 'assistant.answer.blocked',\n version: 1,\n description: 'Assistant answer blocked (fail-closed).',\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['assistant', 'policy', 'blocked'],\n },\n payload: AssistantAnswerBlockedPayload,\n});\n\nconst AssistantAnswerDeliveredPayload = defineSchemaModel({\n name: 'AssistantAnswerDeliveredPayload',\n description: 'Emitted when a structured, cited answer is delivered.',\n fields: {\n traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n locale: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n kbSnapshotId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n allowedScope: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n citationsCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n});\n\nexport const AssistantAnswerDeliveredEvent = defineEvent({\n meta: {\n key: 'assistant.answer.delivered',\n version: 1,\n description:\n 'Assistant answer delivered (must include KB snapshot citations).',\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['assistant', 'policy', 'delivered'],\n },\n payload: AssistantAnswerDeliveredPayload,\n});\n"],"mappings":";;;;AAGA,MAAM,kCAAkC,kBAAkB;CACxD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC5E;CACF,CAAC;AAEF,MAAa,gCAAgC,YAAY;CACvD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,YAAY;EACrB,MAAM,CAAC,aAAa,SAAS;EAC9B;CACD,SAAS;CACV,CAAC;AAEF,MAAM,gCAAgC,kBAAkB;CACtD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,YAAY;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACzE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE;CACF,CAAC;AAEF,MAAa,8BAA8B,YAAY;CACrD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,YAAY;EACrB,MAAM;GAAC;GAAa;GAAU;GAAU;EACzC;CACD,SAAS;CACV,CAAC;AAEF,MAAM,kCAAkC,kBAAkB;CACxD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,gBAAgB;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EAC3E;CACF,CAAC;AAEF,MAAa,gCAAgC,YAAY;CACvD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aACE;EACF,WAAW;EACX,QAAQ,CAAC,YAAY;EACrB,MAAM;GAAC;GAAa;GAAU;GAAY;EAC3C;CACD,SAAS;CACV,CAAC"}
1
+ {"version":3,"file":"events.js","names":[],"sources":["../src/events.ts"],"sourcesContent":["import { defineEvent, defineSchemaModel } from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum } from '@contractspec/lib.schema';\n\nconst AssistantAnswerRequestedPayload = defineSchemaModel({\n name: 'AssistantAnswerRequestedPayload',\n description: 'Emitted when an assistant answer is requested (pre-gate).',\n fields: {\n traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n locale: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n kbSnapshotId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n allowedScope: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nexport const AssistantAnswerRequestedEvent = defineEvent({\n meta: {\n key: 'assistant.answer.requested',\n version: '1.0.0',\n description: 'Assistant answer requested (policy gate will run).',\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['assistant', 'policy'],\n },\n payload: AssistantAnswerRequestedPayload,\n});\n\nconst AssistantAnswerBlockedPayload = defineSchemaModel({\n name: 'AssistantAnswerBlockedPayload',\n description: 'Emitted when a request is blocked by the gate.',\n fields: {\n traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n reasonCode: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nexport const AssistantAnswerBlockedEvent = defineEvent({\n meta: {\n key: 'assistant.answer.blocked',\n version: '1.0.0',\n description: 'Assistant answer blocked (fail-closed).',\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['assistant', 'policy', 'blocked'],\n },\n payload: AssistantAnswerBlockedPayload,\n});\n\nconst AssistantAnswerDeliveredPayload = defineSchemaModel({\n name: 'AssistantAnswerDeliveredPayload',\n description: 'Emitted when a structured, cited answer is delivered.',\n fields: {\n traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n locale: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n kbSnapshotId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n allowedScope: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n citationsCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n});\n\nexport const AssistantAnswerDeliveredEvent = defineEvent({\n meta: {\n key: 'assistant.answer.delivered',\n version: '1.0.0',\n description:\n 'Assistant answer delivered (must include KB snapshot citations).',\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['assistant', 'policy', 'delivered'],\n },\n payload: AssistantAnswerDeliveredPayload,\n});\n"],"mappings":";;;;AAGA,MAAM,kCAAkC,kBAAkB;CACxD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC5E;CACF,CAAC;AAEF,MAAa,gCAAgC,YAAY;CACvD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,YAAY;EACrB,MAAM,CAAC,aAAa,SAAS;EAC9B;CACD,SAAS;CACV,CAAC;AAEF,MAAM,gCAAgC,kBAAkB;CACtD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,YAAY;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACzE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE;CACF,CAAC;AAEF,MAAa,8BAA8B,YAAY;CACrD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,YAAY;EACrB,MAAM;GAAC;GAAa;GAAU;GAAU;EACzC;CACD,SAAS;CACV,CAAC;AAEF,MAAM,kCAAkC,kBAAkB;CACxD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,gBAAgB;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EAC3E;CACF,CAAC;AAEF,MAAa,gCAAgC,YAAY;CACvD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aACE;EACF,WAAW;EACX,QAAQ,CAAC,YAAY;EACrB,MAAM;GAAC;GAAa;GAAU;GAAY;EAC3C;CACD,SAAS;CACV,CAAC"}
package/dist/example.d.ts CHANGED
@@ -1,36 +1,7 @@
1
+ import { ExampleSpec } from "@contractspec/lib.contracts";
2
+
1
3
  //#region src/example.d.ts
2
- declare const example: {
3
- readonly id: "locale-jurisdiction-gate";
4
- readonly title: "Locale / Jurisdiction Gate";
5
- readonly summary: "Fail-closed gating for assistant calls: locale + jurisdiction + kbSnapshotId + allowedScope must be explicit, answers must cite a snapshot.";
6
- readonly tags: readonly ["policy", "locale", "jurisdiction", "assistant", "gating"];
7
- readonly kind: "knowledge";
8
- readonly visibility: "public";
9
- readonly docs: {
10
- readonly rootDocId: "docs.examples.locale-jurisdiction-gate";
11
- };
12
- readonly entrypoints: {
13
- readonly packageName: "@contractspec/example.locale-jurisdiction-gate";
14
- readonly feature: "./feature";
15
- readonly contracts: "./contracts";
16
- readonly handlers: "./handlers";
17
- readonly docs: "./docs";
18
- };
19
- readonly surfaces: {
20
- readonly templates: true;
21
- readonly sandbox: {
22
- readonly enabled: true;
23
- readonly modes: readonly ["markdown", "specs"];
24
- };
25
- readonly studio: {
26
- readonly enabled: true;
27
- readonly installable: true;
28
- };
29
- readonly mcp: {
30
- readonly enabled: true;
31
- };
32
- };
33
- };
4
+ declare const example: ExampleSpec;
34
5
  //#endregion
35
6
  export { example as default };
36
7
  //# sourceMappingURL=example.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";cAAM;EAAA,SAAA,EAwBI,EAAA,0BAAA"}
1
+ {"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";;;cAEM,SAAS"}
package/dist/example.js CHANGED
@@ -1,17 +1,22 @@
1
1
  //#region src/example.ts
2
2
  const example = {
3
- id: "locale-jurisdiction-gate",
4
- title: "Locale / Jurisdiction Gate",
5
- summary: "Fail-closed gating for assistant calls: locale + jurisdiction + kbSnapshotId + allowedScope must be explicit, answers must cite a snapshot.",
6
- tags: [
7
- "policy",
8
- "locale",
9
- "jurisdiction",
10
- "assistant",
11
- "gating"
12
- ],
13
- kind: "knowledge",
14
- visibility: "public",
3
+ meta: {
4
+ key: "locale-jurisdiction-gate",
5
+ version: "1.0.0",
6
+ title: "Locale / Jurisdiction Gate",
7
+ description: "Fail-closed gating for assistant calls: locale + jurisdiction + kbSnapshotId + allowedScope must be explicit, answers must cite a snapshot.",
8
+ kind: "knowledge",
9
+ visibility: "public",
10
+ stability: "experimental",
11
+ owners: ["@platform.core"],
12
+ tags: [
13
+ "policy",
14
+ "locale",
15
+ "jurisdiction",
16
+ "assistant",
17
+ "gating"
18
+ ]
19
+ },
15
20
  docs: { rootDocId: "docs.examples.locale-jurisdiction-gate" },
16
21
  entrypoints: {
17
22
  packageName: "@contractspec/example.locale-jurisdiction-gate",
@@ -1 +1 @@
1
- {"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["const example = {\n id: 'locale-jurisdiction-gate',\n title: 'Locale / Jurisdiction Gate',\n summary:\n 'Fail-closed gating for assistant calls: locale + jurisdiction + kbSnapshotId + allowedScope must be explicit, answers must cite a snapshot.',\n tags: ['policy', 'locale', 'jurisdiction', 'assistant', 'gating'],\n kind: 'knowledge',\n visibility: 'public',\n docs: {\n rootDocId: 'docs.examples.locale-jurisdiction-gate',\n },\n entrypoints: {\n packageName: '@contractspec/example.locale-jurisdiction-gate',\n feature: './feature',\n contracts: './contracts',\n handlers: './handlers',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: { enabled: true, modes: ['markdown', 'specs'] },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n} as const;\n\nexport default example;\n"],"mappings":";AAAA,MAAM,UAAU;CACd,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;EAAC;EAAU;EAAU;EAAgB;EAAa;EAAS;CACjE,MAAM;CACN,YAAY;CACZ,MAAM,EACJ,WAAW,0CACZ;CACD,aAAa;EACX,aAAa;EACb,SAAS;EACT,WAAW;EACX,UAAU;EACV,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GAAE,SAAS;GAAM,OAAO,CAAC,YAAY,QAAQ;GAAE;EACxD,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF;AAED,sBAAe"}
1
+ {"version":3,"file":"example.js","names":["example: ExampleSpec"],"sources":["../src/example.ts"],"sourcesContent":["import type { ExampleSpec } from '@contractspec/lib.contracts';\n\nconst example: ExampleSpec = {\n meta: {\n key: 'locale-jurisdiction-gate',\n version: '1.0.0',\n title: 'Locale / Jurisdiction Gate',\n description:\n 'Fail-closed gating for assistant calls: locale + jurisdiction + kbSnapshotId + allowedScope must be explicit, answers must cite a snapshot.',\n kind: 'knowledge',\n visibility: 'public',\n stability: 'experimental',\n owners: ['@platform.core'],\n tags: ['policy', 'locale', 'jurisdiction', 'assistant', 'gating'],\n },\n docs: {\n rootDocId: 'docs.examples.locale-jurisdiction-gate',\n },\n entrypoints: {\n packageName: '@contractspec/example.locale-jurisdiction-gate',\n feature: './feature',\n contracts: './contracts',\n handlers: './handlers',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: { enabled: true, modes: ['markdown', 'specs'] },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n};\n\nexport default example;\n"],"mappings":";AAEA,MAAMA,UAAuB;CAC3B,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAU;GAAU;GAAgB;GAAa;GAAS;EAClE;CACD,MAAM,EACJ,WAAW,0CACZ;CACD,aAAa;EACX,aAAa;EACb,SAAS;EACT,WAAW;EACX,UAAU;EACV,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GAAE,SAAS;GAAM,OAAO,CAAC,YAAY,QAAQ;GAAE;EACxD,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF;AAED,sBAAe"}
@@ -2,7 +2,7 @@
2
2
  const LocaleJurisdictionGateFeature = {
3
3
  meta: {
4
4
  key: "locale-jurisdiction-gate",
5
- version: 1,
5
+ version: "1.0.0",
6
6
  title: "Locale + Jurisdiction Gate",
7
7
  description: "Fail-closed gating for assistant calls requiring locale/jurisdiction/snapshot/scope and citations.",
8
8
  domain: "knowledge",
@@ -18,23 +18,23 @@ const LocaleJurisdictionGateFeature = {
18
18
  },
19
19
  operations: [{
20
20
  key: "assistant.answer",
21
- version: 1
21
+ version: "1.0.0"
22
22
  }, {
23
23
  key: "assistant.explainConcept",
24
- version: 1
24
+ version: "1.0.0"
25
25
  }],
26
26
  events: [
27
27
  {
28
28
  key: "assistant.answer.requested",
29
- version: 1
29
+ version: "1.0.0"
30
30
  },
31
31
  {
32
32
  key: "assistant.answer.blocked",
33
- version: 1
33
+ version: "1.0.0"
34
34
  },
35
35
  {
36
36
  key: "assistant.answer.delivered",
37
- version: 1
37
+ version: "1.0.0"
38
38
  }
39
39
  ],
40
40
  presentations: [],
@@ -42,7 +42,7 @@ const LocaleJurisdictionGateFeature = {
42
42
  presentationsTargets: [],
43
43
  capabilities: { requires: [{
44
44
  key: "knowledge",
45
- version: 1
45
+ version: "1.0.0"
46
46
  }] }
47
47
  };
48
48
 
@@ -1 +1 @@
1
- {"version":3,"file":"locale-jurisdiction-gate.feature.js","names":["LocaleJurisdictionGateFeature: FeatureModuleSpec"],"sources":["../src/locale-jurisdiction-gate.feature.ts"],"sourcesContent":["import type { FeatureModuleSpec } from '@contractspec/lib.contracts';\n\nexport const LocaleJurisdictionGateFeature: FeatureModuleSpec = {\n meta: {\n key: 'locale-jurisdiction-gate',\n version: 1,\n title: 'Locale + Jurisdiction Gate',\n description:\n 'Fail-closed gating for assistant calls requiring locale/jurisdiction/snapshot/scope and citations.',\n domain: 'knowledge',\n owners: ['@examples'],\n tags: ['assistant', 'policy', 'locale', 'jurisdiction', 'knowledge'],\n stability: 'experimental',\n },\n operations: [\n { key: 'assistant.answer', version: 1 },\n { key: 'assistant.explainConcept', version: 1 },\n ],\n events: [\n { key: 'assistant.answer.requested', version: 1 },\n { key: 'assistant.answer.blocked', version: 1 },\n { key: 'assistant.answer.delivered', version: 1 },\n ],\n presentations: [],\n opToPresentation: [],\n presentationsTargets: [],\n capabilities: {\n requires: [{ key: 'knowledge', version: 1 }],\n },\n};\n"],"mappings":";AAEA,MAAaA,gCAAmD;CAC9D,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,QAAQ;EACR,QAAQ,CAAC,YAAY;EACrB,MAAM;GAAC;GAAa;GAAU;GAAU;GAAgB;GAAY;EACpE,WAAW;EACZ;CACD,YAAY,CACV;EAAE,KAAK;EAAoB,SAAS;EAAG,EACvC;EAAE,KAAK;EAA4B,SAAS;EAAG,CAChD;CACD,QAAQ;EACN;GAAE,KAAK;GAA8B,SAAS;GAAG;EACjD;GAAE,KAAK;GAA4B,SAAS;GAAG;EAC/C;GAAE,KAAK;GAA8B,SAAS;GAAG;EAClD;CACD,eAAe,EAAE;CACjB,kBAAkB,EAAE;CACpB,sBAAsB,EAAE;CACxB,cAAc,EACZ,UAAU,CAAC;EAAE,KAAK;EAAa,SAAS;EAAG,CAAC,EAC7C;CACF"}
1
+ {"version":3,"file":"locale-jurisdiction-gate.feature.js","names":["LocaleJurisdictionGateFeature: FeatureModuleSpec"],"sources":["../src/locale-jurisdiction-gate.feature.ts"],"sourcesContent":["import type { FeatureModuleSpec } from '@contractspec/lib.contracts';\n\nexport const LocaleJurisdictionGateFeature: FeatureModuleSpec = {\n meta: {\n key: 'locale-jurisdiction-gate',\n version: '1.0.0',\n title: 'Locale + Jurisdiction Gate',\n description:\n 'Fail-closed gating for assistant calls requiring locale/jurisdiction/snapshot/scope and citations.',\n domain: 'knowledge',\n owners: ['@examples'],\n tags: ['assistant', 'policy', 'locale', 'jurisdiction', 'knowledge'],\n stability: 'experimental',\n },\n operations: [\n { key: 'assistant.answer', version: '1.0.0' },\n { key: 'assistant.explainConcept', version: '1.0.0' },\n ],\n events: [\n { key: 'assistant.answer.requested', version: '1.0.0' },\n { key: 'assistant.answer.blocked', version: '1.0.0' },\n { key: 'assistant.answer.delivered', version: '1.0.0' },\n ],\n presentations: [],\n opToPresentation: [],\n presentationsTargets: [],\n capabilities: {\n requires: [{ key: 'knowledge', version: '1.0.0' }],\n },\n};\n"],"mappings":";AAEA,MAAaA,gCAAmD;CAC9D,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,QAAQ;EACR,QAAQ,CAAC,YAAY;EACrB,MAAM;GAAC;GAAa;GAAU;GAAU;GAAgB;GAAY;EACpE,WAAW;EACZ;CACD,YAAY,CACV;EAAE,KAAK;EAAoB,SAAS;EAAS,EAC7C;EAAE,KAAK;EAA4B,SAAS;EAAS,CACtD;CACD,QAAQ;EACN;GAAE,KAAK;GAA8B,SAAS;GAAS;EACvD;GAAE,KAAK;GAA4B,SAAS;GAAS;EACrD;GAAE,KAAK;GAA8B,SAAS;GAAS;EACxD;CACD,eAAe,EAAE;CACjB,kBAAkB,EAAE;CACpB,sBAAsB,EAAE;CACxB,cAAc,EACZ,UAAU,CAAC;EAAE,KAAK;EAAa,SAAS;EAAS,CAAC,EACnD;CACF"}
@@ -34,7 +34,7 @@ const AssistantConceptInput = defineSchemaModel$1({
34
34
  const AssistantAnswerContract = defineCommand({
35
35
  meta: {
36
36
  key: "assistant.answer",
37
- version: 1,
37
+ version: "1.0.0",
38
38
  stability: "experimental",
39
39
  owners: ["@examples"],
40
40
  tags: [
@@ -89,7 +89,7 @@ const AssistantAnswerContract = defineCommand({
89
89
  const AssistantExplainConceptContract = defineCommand({
90
90
  meta: {
91
91
  key: "assistant.explainConcept",
92
- version: 1,
92
+ version: "1.0.0",
93
93
  stability: "experimental",
94
94
  owners: ["@examples"],
95
95
  tags: [
@@ -1 +1 @@
1
- {"version":3,"file":"assistant.js","names":["defineSchemaModel"],"sources":["../../src/operations/assistant.ts"],"sourcesContent":["import { defineCommand } from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\n\nimport {\n AssistantAnswerIRModel,\n LLMCallEnvelopeModel,\n} from '../entities/models';\n\nconst AssistantQuestionInput = defineSchemaModel({\n name: 'AssistantQuestionInput',\n description: 'Input for assistant calls with mandatory envelope.',\n fields: {\n envelope: { type: LLMCallEnvelopeModel, isOptional: false },\n question: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst AssistantConceptInput = defineSchemaModel({\n name: 'AssistantConceptInput',\n description: 'Input for explaining a concept with mandatory envelope.',\n fields: {\n envelope: { type: LLMCallEnvelopeModel, isOptional: false },\n conceptKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nexport const AssistantAnswerContract = defineCommand({\n meta: {\n key: 'assistant.answer',\n version: 1,\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['assistant', 'policy', 'locale', 'jurisdiction', 'knowledge'],\n description:\n 'Answer a user question using a KB snapshot with strict locale/jurisdiction gating.',\n goal: 'Provide policy-safe answers that cite a KB snapshot or refuse.',\n context:\n 'Called by UI or workflows; must fail-closed if envelope is invalid or citations are missing.',\n },\n io: {\n input: AssistantQuestionInput,\n output: AssistantAnswerIRModel,\n errors: {\n LOCALE_REQUIRED: {\n description: 'Locale is required and must be supported',\n http: 400,\n gqlCode: 'LOCALE_REQUIRED',\n when: 'locale is missing or unsupported',\n },\n JURISDICTION_REQUIRED: {\n description: 'Jurisdiction is required',\n http: 400,\n gqlCode: 'JURISDICTION_REQUIRED',\n when: 'jurisdiction is missing',\n },\n KB_SNAPSHOT_REQUIRED: {\n description: 'KB snapshot id is required',\n http: 400,\n gqlCode: 'KB_SNAPSHOT_REQUIRED',\n when: 'kbSnapshotId is missing',\n },\n CITATIONS_REQUIRED: {\n description: 'Answers must include citations to a KB snapshot',\n http: 422,\n gqlCode: 'CITATIONS_REQUIRED',\n when: 'answer has no citations',\n },\n SCOPE_VIOLATION: {\n description:\n 'Answer violates allowed scope and must be refused/escalated',\n http: 403,\n gqlCode: 'SCOPE_VIOLATION',\n when: 'output includes forbidden content under the given allowedScope',\n },\n },\n },\n policy: { auth: 'user' },\n});\n\nexport const AssistantExplainConceptContract = defineCommand({\n meta: {\n key: 'assistant.explainConcept',\n version: 1,\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['assistant', 'policy', 'knowledge', 'concepts'],\n description:\n 'Explain a concept using a KB snapshot with strict locale/jurisdiction gating.',\n goal: 'Explain concepts with citations or refuse.',\n context: 'Same constraints as assistant.answer.',\n },\n io: {\n input: AssistantConceptInput,\n output: AssistantAnswerIRModel,\n errors: AssistantAnswerContract.io.errors,\n },\n policy: { auth: 'user' },\n});\n"],"mappings":";;;;;AAQA,MAAM,yBAAyBA,oBAAkB;CAC/C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,UAAU;GAAE,MAAM;GAAsB,YAAY;GAAO;EAC3D,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE;CACF,CAAC;AAEF,MAAM,wBAAwBA,oBAAkB;CAC9C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,UAAU;GAAE,MAAM;GAAsB,YAAY;GAAO;EAC3D,YAAY;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC1E;CACF,CAAC;AAEF,MAAa,0BAA0B,cAAc;CACnD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,YAAY;EACrB,MAAM;GAAC;GAAa;GAAU;GAAU;GAAgB;GAAY;EACpE,aACE;EACF,MAAM;EACN,SACE;EACH;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACR,QAAQ;GACN,iBAAiB;IACf,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACD,uBAAuB;IACrB,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACD,sBAAsB;IACpB,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACD,oBAAoB;IAClB,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACD,iBAAiB;IACf,aACE;IACF,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACF;EACF;CACD,QAAQ,EAAE,MAAM,QAAQ;CACzB,CAAC;AAEF,MAAa,kCAAkC,cAAc;CAC3D,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,YAAY;EACrB,MAAM;GAAC;GAAa;GAAU;GAAa;GAAW;EACtD,aACE;EACF,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACR,QAAQ,wBAAwB,GAAG;EACpC;CACD,QAAQ,EAAE,MAAM,QAAQ;CACzB,CAAC"}
1
+ {"version":3,"file":"assistant.js","names":["defineSchemaModel"],"sources":["../../src/operations/assistant.ts"],"sourcesContent":["import { defineCommand } from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\n\nimport {\n AssistantAnswerIRModel,\n LLMCallEnvelopeModel,\n} from '../entities/models';\n\nconst AssistantQuestionInput = defineSchemaModel({\n name: 'AssistantQuestionInput',\n description: 'Input for assistant calls with mandatory envelope.',\n fields: {\n envelope: { type: LLMCallEnvelopeModel, isOptional: false },\n question: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst AssistantConceptInput = defineSchemaModel({\n name: 'AssistantConceptInput',\n description: 'Input for explaining a concept with mandatory envelope.',\n fields: {\n envelope: { type: LLMCallEnvelopeModel, isOptional: false },\n conceptKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nexport const AssistantAnswerContract = defineCommand({\n meta: {\n key: 'assistant.answer',\n version: '1.0.0',\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['assistant', 'policy', 'locale', 'jurisdiction', 'knowledge'],\n description:\n 'Answer a user question using a KB snapshot with strict locale/jurisdiction gating.',\n goal: 'Provide policy-safe answers that cite a KB snapshot or refuse.',\n context:\n 'Called by UI or workflows; must fail-closed if envelope is invalid or citations are missing.',\n },\n io: {\n input: AssistantQuestionInput,\n output: AssistantAnswerIRModel,\n errors: {\n LOCALE_REQUIRED: {\n description: 'Locale is required and must be supported',\n http: 400,\n gqlCode: 'LOCALE_REQUIRED',\n when: 'locale is missing or unsupported',\n },\n JURISDICTION_REQUIRED: {\n description: 'Jurisdiction is required',\n http: 400,\n gqlCode: 'JURISDICTION_REQUIRED',\n when: 'jurisdiction is missing',\n },\n KB_SNAPSHOT_REQUIRED: {\n description: 'KB snapshot id is required',\n http: 400,\n gqlCode: 'KB_SNAPSHOT_REQUIRED',\n when: 'kbSnapshotId is missing',\n },\n CITATIONS_REQUIRED: {\n description: 'Answers must include citations to a KB snapshot',\n http: 422,\n gqlCode: 'CITATIONS_REQUIRED',\n when: 'answer has no citations',\n },\n SCOPE_VIOLATION: {\n description:\n 'Answer violates allowed scope and must be refused/escalated',\n http: 403,\n gqlCode: 'SCOPE_VIOLATION',\n when: 'output includes forbidden content under the given allowedScope',\n },\n },\n },\n policy: { auth: 'user' },\n});\n\nexport const AssistantExplainConceptContract = defineCommand({\n meta: {\n key: 'assistant.explainConcept',\n version: '1.0.0',\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['assistant', 'policy', 'knowledge', 'concepts'],\n description:\n 'Explain a concept using a KB snapshot with strict locale/jurisdiction gating.',\n goal: 'Explain concepts with citations or refuse.',\n context: 'Same constraints as assistant.answer.',\n },\n io: {\n input: AssistantConceptInput,\n output: AssistantAnswerIRModel,\n errors: AssistantAnswerContract.io.errors,\n },\n policy: { auth: 'user' },\n});\n"],"mappings":";;;;;AAQA,MAAM,yBAAyBA,oBAAkB;CAC/C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,UAAU;GAAE,MAAM;GAAsB,YAAY;GAAO;EAC3D,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE;CACF,CAAC;AAEF,MAAM,wBAAwBA,oBAAkB;CAC9C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,UAAU;GAAE,MAAM;GAAsB,YAAY;GAAO;EAC3D,YAAY;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC1E;CACF,CAAC;AAEF,MAAa,0BAA0B,cAAc;CACnD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,YAAY;EACrB,MAAM;GAAC;GAAa;GAAU;GAAU;GAAgB;GAAY;EACpE,aACE;EACF,MAAM;EACN,SACE;EACH;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACR,QAAQ;GACN,iBAAiB;IACf,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACD,uBAAuB;IACrB,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACD,sBAAsB;IACpB,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACD,oBAAoB;IAClB,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACD,iBAAiB;IACf,aACE;IACF,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACF;EACF;CACD,QAAQ,EAAE,MAAM,QAAQ;CACzB,CAAC;AAEF,MAAa,kCAAkC,cAAc;CAC3D,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,YAAY;EACrB,MAAM;GAAC;GAAa;GAAU;GAAa;GAAW;EACtD,aACE;EACF,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACR,QAAQ,wBAAwB,GAAG;EACpC;CACD,QAAQ,EAAE,MAAM,QAAQ;CACzB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contractspec/example.locale-jurisdiction-gate",
3
- "version": "1.44.1",
3
+ "version": "1.45.0",
4
4
  "description": "Example: enforce locale + jurisdiction + kbSnapshotId + allowed scope for assistant calls (fail-closed).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -38,13 +38,13 @@
38
38
  "test": "bun test"
39
39
  },
40
40
  "dependencies": {
41
- "@contractspec/lib.contracts": "1.44.1",
42
- "@contractspec/lib.schema": "1.44.1",
41
+ "@contractspec/lib.contracts": "1.45.0",
42
+ "@contractspec/lib.schema": "1.45.0",
43
43
  "zod": "^4.1.13"
44
44
  },
45
45
  "devDependencies": {
46
- "@contractspec/tool.tsdown": "1.44.1",
47
- "@contractspec/tool.typescript": "1.44.1",
46
+ "@contractspec/tool.tsdown": "1.45.0",
47
+ "@contractspec/tool.typescript": "1.45.0",
48
48
  "tsdown": "^0.18.3",
49
49
  "typescript": "^5.9.3"
50
50
  },
package/src/events.ts CHANGED
@@ -16,7 +16,7 @@ const AssistantAnswerRequestedPayload = defineSchemaModel({
16
16
  export const AssistantAnswerRequestedEvent = defineEvent({
17
17
  meta: {
18
18
  key: 'assistant.answer.requested',
19
- version: 1,
19
+ version: '1.0.0',
20
20
  description: 'Assistant answer requested (policy gate will run).',
21
21
  stability: 'experimental',
22
22
  owners: ['@examples'],
@@ -38,7 +38,7 @@ const AssistantAnswerBlockedPayload = defineSchemaModel({
38
38
  export const AssistantAnswerBlockedEvent = defineEvent({
39
39
  meta: {
40
40
  key: 'assistant.answer.blocked',
41
- version: 1,
41
+ version: '1.0.0',
42
42
  description: 'Assistant answer blocked (fail-closed).',
43
43
  stability: 'experimental',
44
44
  owners: ['@examples'],
@@ -63,7 +63,7 @@ const AssistantAnswerDeliveredPayload = defineSchemaModel({
63
63
  export const AssistantAnswerDeliveredEvent = defineEvent({
64
64
  meta: {
65
65
  key: 'assistant.answer.delivered',
66
- version: 1,
66
+ version: '1.0.0',
67
67
  description:
68
68
  'Assistant answer delivered (must include KB snapshot citations).',
69
69
  stability: 'experimental',
package/src/example.ts CHANGED
@@ -1,11 +1,18 @@
1
- const example = {
2
- id: 'locale-jurisdiction-gate',
3
- title: 'Locale / Jurisdiction Gate',
4
- summary:
5
- 'Fail-closed gating for assistant calls: locale + jurisdiction + kbSnapshotId + allowedScope must be explicit, answers must cite a snapshot.',
6
- tags: ['policy', 'locale', 'jurisdiction', 'assistant', 'gating'],
7
- kind: 'knowledge',
8
- visibility: 'public',
1
+ import type { ExampleSpec } from '@contractspec/lib.contracts';
2
+
3
+ const example: ExampleSpec = {
4
+ meta: {
5
+ key: 'locale-jurisdiction-gate',
6
+ version: '1.0.0',
7
+ title: 'Locale / Jurisdiction Gate',
8
+ description:
9
+ 'Fail-closed gating for assistant calls: locale + jurisdiction + kbSnapshotId + allowedScope must be explicit, answers must cite a snapshot.',
10
+ kind: 'knowledge',
11
+ visibility: 'public',
12
+ stability: 'experimental',
13
+ owners: ['@platform.core'],
14
+ tags: ['policy', 'locale', 'jurisdiction', 'assistant', 'gating'],
15
+ },
9
16
  docs: {
10
17
  rootDocId: 'docs.examples.locale-jurisdiction-gate',
11
18
  },
@@ -22,6 +29,6 @@ const example = {
22
29
  studio: { enabled: true, installable: true },
23
30
  mcp: { enabled: true },
24
31
  },
25
- } as const;
32
+ };
26
33
 
27
34
  export default example;
@@ -3,7 +3,7 @@ import type { FeatureModuleSpec } from '@contractspec/lib.contracts';
3
3
  export const LocaleJurisdictionGateFeature: FeatureModuleSpec = {
4
4
  meta: {
5
5
  key: 'locale-jurisdiction-gate',
6
- version: 1,
6
+ version: '1.0.0',
7
7
  title: 'Locale + Jurisdiction Gate',
8
8
  description:
9
9
  'Fail-closed gating for assistant calls requiring locale/jurisdiction/snapshot/scope and citations.',
@@ -13,18 +13,18 @@ export const LocaleJurisdictionGateFeature: FeatureModuleSpec = {
13
13
  stability: 'experimental',
14
14
  },
15
15
  operations: [
16
- { key: 'assistant.answer', version: 1 },
17
- { key: 'assistant.explainConcept', version: 1 },
16
+ { key: 'assistant.answer', version: '1.0.0' },
17
+ { key: 'assistant.explainConcept', version: '1.0.0' },
18
18
  ],
19
19
  events: [
20
- { key: 'assistant.answer.requested', version: 1 },
21
- { key: 'assistant.answer.blocked', version: 1 },
22
- { key: 'assistant.answer.delivered', version: 1 },
20
+ { key: 'assistant.answer.requested', version: '1.0.0' },
21
+ { key: 'assistant.answer.blocked', version: '1.0.0' },
22
+ { key: 'assistant.answer.delivered', version: '1.0.0' },
23
23
  ],
24
24
  presentations: [],
25
25
  opToPresentation: [],
26
26
  presentationsTargets: [],
27
27
  capabilities: {
28
- requires: [{ key: 'knowledge', version: 1 }],
28
+ requires: [{ key: 'knowledge', version: '1.0.0' }],
29
29
  },
30
30
  };
@@ -27,7 +27,7 @@ const AssistantConceptInput = defineSchemaModel({
27
27
  export const AssistantAnswerContract = defineCommand({
28
28
  meta: {
29
29
  key: 'assistant.answer',
30
- version: 1,
30
+ version: '1.0.0',
31
31
  stability: 'experimental',
32
32
  owners: ['@examples'],
33
33
  tags: ['assistant', 'policy', 'locale', 'jurisdiction', 'knowledge'],
@@ -80,7 +80,7 @@ export const AssistantAnswerContract = defineCommand({
80
80
  export const AssistantExplainConceptContract = defineCommand({
81
81
  meta: {
82
82
  key: 'assistant.explainConcept',
83
- version: 1,
83
+ version: '1.0.0',
84
84
  stability: 'experimental',
85
85
  owners: ['@examples'],
86
86
  tags: ['assistant', 'policy', 'knowledge', 'concepts'],