@contractspec/example.locale-jurisdiction-gate 3.7.6 → 3.7.7
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/.turbo/turbo-build.log +3 -3
- package/AGENTS.md +50 -27
- package/README.md +57 -24
- package/dist/browser/entities/index.js +2 -2
- package/dist/browser/entities/models.js +2 -2
- package/dist/browser/events.js +1 -1
- package/dist/browser/index.js +42 -41
- package/dist/browser/operations/assistant.js +3 -3
- package/dist/browser/operations/index.js +3 -3
- package/dist/entities/index.js +2 -2
- package/dist/entities/models.js +2 -2
- package/dist/events.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +42 -41
- package/dist/node/entities/index.js +2 -2
- package/dist/node/entities/models.js +2 -2
- package/dist/node/events.js +1 -1
- package/dist/node/index.js +42 -41
- package/dist/node/operations/assistant.js +3 -3
- package/dist/node/operations/index.js +3 -3
- package/dist/operations/assistant.js +3 -3
- package/dist/operations/index.js +3 -3
- package/dist/policy/index.d.ts +1 -1
- package/package.json +4 -4
- package/src/docs/locale-jurisdiction-gate.docblock.ts +21 -21
- package/src/entities/models.ts +87 -87
- package/src/events.ts +55 -55
- package/src/example.ts +28 -28
- package/src/handlers/demo.handlers.test.ts +46 -46
- package/src/handlers/demo.handlers.ts +133 -133
- package/src/index.ts +3 -3
- package/src/locale-jurisdiction-gate.feature.ts +34 -34
- package/src/operations/assistant.ts +82 -82
- package/src/policy/guard.test.ts +18 -18
- package/src/policy/guard.ts +75 -75
- package/src/policy/index.ts +1 -1
- package/src/policy/types.ts +12 -12
- package/tsconfig.json +7 -15
- package/tsdown.config.js +7 -13
package/.turbo/turbo-build.log
CHANGED
|
@@ -3,7 +3,7 @@ $ bun run prebuild && bun run build:bundle && bun run build:types
|
|
|
3
3
|
$ contractspec-bun-build prebuild
|
|
4
4
|
$ contractspec-bun-build transpile
|
|
5
5
|
[contractspec-bun-build] transpile target=bun root=src entries=15 noBundle=false
|
|
6
|
-
Bundled 15 modules in
|
|
6
|
+
Bundled 15 modules in 15ms
|
|
7
7
|
|
|
8
8
|
docs/index.js 1.64 KB (entry point)
|
|
9
9
|
./index.js 18.69 KB (entry point)
|
|
@@ -22,7 +22,7 @@ Bundled 15 modules in 18ms
|
|
|
22
22
|
policy/guard.js 2.0 KB (entry point)
|
|
23
23
|
|
|
24
24
|
[contractspec-bun-build] transpile target=node root=src entries=15 noBundle=false
|
|
25
|
-
Bundled 15 modules in
|
|
25
|
+
Bundled 15 modules in 35ms
|
|
26
26
|
|
|
27
27
|
docs/index.js 1.63 KB (entry point)
|
|
28
28
|
./index.js 18.68 KB (entry point)
|
|
@@ -41,7 +41,7 @@ Bundled 15 modules in 24ms
|
|
|
41
41
|
policy/guard.js 2.0 KB (entry point)
|
|
42
42
|
|
|
43
43
|
[contractspec-bun-build] transpile target=browser root=src entries=15 noBundle=false
|
|
44
|
-
Bundled 15 modules in
|
|
44
|
+
Bundled 15 modules in 30ms
|
|
45
45
|
|
|
46
46
|
docs/index.js 1.63 KB (entry point)
|
|
47
47
|
./index.js 18.68 KB (entry point)
|
package/AGENTS.md
CHANGED
|
@@ -1,36 +1,59 @@
|
|
|
1
|
-
# AI Agent Guide
|
|
1
|
+
# AI Agent Guide — `@contractspec/example.locale-jurisdiction-gate`
|
|
2
2
|
|
|
3
3
|
Scope: `packages/examples/locale-jurisdiction-gate/*`
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Example: enforce locale + jurisdiction + kbSnapshotId + allowed scope for assistant calls (fail-closed).
|
|
6
6
|
|
|
7
7
|
## Quick Context
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
- `./
|
|
28
|
-
- `./locale-jurisdiction-gate.
|
|
29
|
-
- `./
|
|
9
|
+
- Layer: `example`.
|
|
10
|
+
- Package visibility: published package.
|
|
11
|
+
- Primary consumers are example explorers, template authors, and documentation readers.
|
|
12
|
+
- Related packages: `@contractspec/lib.contracts-spec`, `@contractspec/lib.schema`, `@contractspec/tool.bun`, `@contractspec/tool.typescript`.
|
|
13
|
+
|
|
14
|
+
## Architecture
|
|
15
|
+
|
|
16
|
+
- `src/docs/` contains docblocks and documentation-facing exports.
|
|
17
|
+
- `src/entities/` contains domain entities and value objects.
|
|
18
|
+
- `src/events.ts` is package-level event definitions.
|
|
19
|
+
- `src/example.ts` is the runnable example entrypoint.
|
|
20
|
+
- `src/handlers/` contains handlers or demo adapters wired to contract surfaces.
|
|
21
|
+
- `src/index.ts` is the root public barrel and package entrypoint.
|
|
22
|
+
- `src/locale-jurisdiction-gate.feature.ts` defines a feature entrypoint.
|
|
23
|
+
|
|
24
|
+
## Public Surface
|
|
25
|
+
|
|
26
|
+
- Export `.` resolves through `./src/index.ts`.
|
|
27
|
+
- Export `./docs` resolves through `./src/docs/index.ts`.
|
|
28
|
+
- Export `./docs/locale-jurisdiction-gate.docblock` resolves through `./src/docs/locale-jurisdiction-gate.docblock.ts`.
|
|
29
|
+
- Export `./entities` resolves through `./src/entities/index.ts`.
|
|
30
|
+
- Export `./entities/models` resolves through `./src/entities/models.ts`.
|
|
31
|
+
- Export `./events` resolves through `./src/events.ts`.
|
|
32
|
+
- Export `./example` resolves through `./src/example.ts`.
|
|
33
|
+
- Export `./handlers` resolves through `./src/handlers/index.ts`.
|
|
34
|
+
- Export `./handlers/demo.handlers` resolves through `./src/handlers/demo.handlers.ts`.
|
|
35
|
+
- Export `./locale-jurisdiction-gate.feature` resolves through `./src/locale-jurisdiction-gate.feature.ts`.
|
|
36
|
+
- The package publishes 15 total export subpaths; keep docs aligned with `package.json`.
|
|
37
|
+
|
|
38
|
+
## Guardrails
|
|
39
|
+
|
|
40
|
+
- Keep the example package demonstrative, buildable, and aligned with the exported feature surface.
|
|
41
|
+
- Do not add hidden production assumptions that are not actually implemented in the example.
|
|
42
|
+
- Changes here can affect downstream packages such as `@contractspec/lib.contracts-spec`, `@contractspec/lib.schema`, `@contractspec/tool.bun`, `@contractspec/tool.typescript`.
|
|
43
|
+
- Changes here can affect downstream packages such as `@contractspec/lib.contracts-spec`, `@contractspec/lib.schema`, `@contractspec/tool.bun`, `@contractspec/tool.typescript`.
|
|
30
44
|
|
|
31
45
|
## Local Commands
|
|
32
46
|
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
47
|
+
- `bun run dev` — contractspec-bun-build dev
|
|
48
|
+
- `bun run build` — bun run prebuild && bun run build:bundle && bun run build:types
|
|
49
|
+
- `bun run test` — bun test
|
|
50
|
+
- `bun run lint` — bun lint:fix
|
|
51
|
+
- `bun run lint:check` — biome check .
|
|
52
|
+
- `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
|
|
53
|
+
- `bun run typecheck` — tsc --noEmit
|
|
54
|
+
- `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
|
|
55
|
+
- `bun run publish:pkg:canary` — bun publish:pkg --tag canary
|
|
56
|
+
- `bun run clean` — rimraf dist .turbo
|
|
57
|
+
- `bun run build:bundle` — contractspec-bun-build transpile
|
|
58
|
+
- `bun run build:types` — contractspec-bun-build types
|
|
59
|
+
- `bun run prebuild` — contractspec-bun-build prebuild
|
package/README.md
CHANGED
|
@@ -1,42 +1,75 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @contractspec/example.locale-jurisdiction-gate
|
|
2
2
|
|
|
3
|
-
Website: https://contractspec.io
|
|
3
|
+
Website: https://contractspec.io
|
|
4
4
|
|
|
5
|
+
**Example: enforce locale + jurisdiction + kbSnapshotId + allowed scope for assistant calls (fail-closed).**
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
## What This Demonstrates
|
|
7
8
|
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
9
|
+
- Fail-closed policy guard pattern for AI assistant calls.
|
|
10
|
+
- Entity models for locale/jurisdiction gating.
|
|
11
|
+
- Event-driven policy enforcement.
|
|
12
|
+
- Handler and operation separation with typed operations.
|
|
13
|
+
- Feature definition pattern.
|
|
14
|
+
- `src/docs/` contains docblocks and documentation-facing exports.
|
|
13
15
|
|
|
14
|
-
##
|
|
16
|
+
## Running Locally
|
|
15
17
|
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
18
|
+
From `packages/examples/locale-jurisdiction-gate`:
|
|
19
|
+
- `bun run dev`
|
|
20
|
+
- `bun run build`
|
|
21
|
+
- `bun run test`
|
|
22
|
+
- `bun run typecheck`
|
|
20
23
|
|
|
21
|
-
##
|
|
24
|
+
## Usage
|
|
22
25
|
|
|
23
|
-
-
|
|
24
|
-
- `entities/models`: `LLMCallEnvelope`, `AssistantAnswerIR`, `RegulatoryContext`
|
|
25
|
-
- `policy/guard`: pure gate functions used by handlers and tests
|
|
26
|
-
- `handlers/demo.handlers`: deterministic demo handlers (no LLM)
|
|
27
|
-
|
|
28
|
-
## Running tests
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
bun test
|
|
32
|
-
```
|
|
26
|
+
Use `@contractspec/example.locale-jurisdiction-gate` as a reference implementation, or import its exported surfaces into a workspace that composes ContractSpec examples and bundles.
|
|
33
27
|
|
|
28
|
+
## Architecture
|
|
34
29
|
|
|
30
|
+
- `src/docs/` contains docblocks and documentation-facing exports.
|
|
31
|
+
- `src/entities/` contains domain entities and value objects.
|
|
32
|
+
- `src/events.ts` is package-level event definitions.
|
|
33
|
+
- `src/example.ts` is the runnable example entrypoint.
|
|
34
|
+
- `src/handlers/` contains handlers or demo adapters wired to contract surfaces.
|
|
35
|
+
- `src/index.ts` is the root public barrel and package entrypoint.
|
|
36
|
+
- `src/locale-jurisdiction-gate.feature.ts` defines a feature entrypoint.
|
|
35
37
|
|
|
38
|
+
## Public Entry Points
|
|
36
39
|
|
|
40
|
+
- Export `.` resolves through `./src/index.ts`.
|
|
41
|
+
- Export `./docs` resolves through `./src/docs/index.ts`.
|
|
42
|
+
- Export `./docs/locale-jurisdiction-gate.docblock` resolves through `./src/docs/locale-jurisdiction-gate.docblock.ts`.
|
|
43
|
+
- Export `./entities` resolves through `./src/entities/index.ts`.
|
|
44
|
+
- Export `./entities/models` resolves through `./src/entities/models.ts`.
|
|
45
|
+
- Export `./events` resolves through `./src/events.ts`.
|
|
46
|
+
- Export `./example` resolves through `./src/example.ts`.
|
|
47
|
+
- Export `./handlers` resolves through `./src/handlers/index.ts`.
|
|
48
|
+
- Export `./handlers/demo.handlers` resolves through `./src/handlers/demo.handlers.ts`.
|
|
49
|
+
- Export `./locale-jurisdiction-gate.feature` resolves through `./src/locale-jurisdiction-gate.feature.ts`.
|
|
50
|
+
- The package publishes 15 total export subpaths; keep docs aligned with `package.json`.
|
|
37
51
|
|
|
52
|
+
## Local Commands
|
|
38
53
|
|
|
54
|
+
- `bun run dev` — contractspec-bun-build dev
|
|
55
|
+
- `bun run build` — bun run prebuild && bun run build:bundle && bun run build:types
|
|
56
|
+
- `bun run test` — bun test
|
|
57
|
+
- `bun run lint` — bun lint:fix
|
|
58
|
+
- `bun run lint:check` — biome check .
|
|
59
|
+
- `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
|
|
60
|
+
- `bun run typecheck` — tsc --noEmit
|
|
61
|
+
- `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
|
|
62
|
+
- `bun run publish:pkg:canary` — bun publish:pkg --tag canary
|
|
63
|
+
- `bun run clean` — rimraf dist .turbo
|
|
64
|
+
- `bun run build:bundle` — contractspec-bun-build transpile
|
|
65
|
+
- `bun run build:types` — contractspec-bun-build types
|
|
66
|
+
- `bun run prebuild` — contractspec-bun-build prebuild
|
|
39
67
|
|
|
68
|
+
## Recent Updates
|
|
40
69
|
|
|
70
|
+
- Replace eslint+prettier by biomejs to optimize speed.
|
|
71
|
+
- Missing contract layers.
|
|
41
72
|
|
|
73
|
+
## Notes
|
|
42
74
|
|
|
75
|
+
- Works alongside `@contractspec/lib.contracts-spec`, `@contractspec/lib.schema`, `@contractspec/tool.bun`, `@contractspec/tool.typescript`.
|
package/dist/browser/events.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/events.ts
|
|
2
2
|
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
3
|
-
import {
|
|
3
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
4
4
|
var AssistantAnswerRequestedPayload = defineSchemaModel({
|
|
5
5
|
name: "AssistantAnswerRequestedPayload",
|
|
6
6
|
description: "Emitted when an assistant answer is requested (pre-gate).",
|
package/dist/browser/index.js
CHANGED
|
@@ -43,9 +43,9 @@ var docBlocks = [
|
|
|
43
43
|
registerDocBlocks(docBlocks);
|
|
44
44
|
// src/entities/models.ts
|
|
45
45
|
import {
|
|
46
|
-
ScalarTypeEnum,
|
|
47
46
|
defineEnum,
|
|
48
|
-
defineSchemaModel
|
|
47
|
+
defineSchemaModel,
|
|
48
|
+
ScalarTypeEnum
|
|
49
49
|
} from "@contractspec/lib.schema";
|
|
50
50
|
var AllowedScopeEnum = defineEnum("AllowedScope", [
|
|
51
51
|
"education_only",
|
|
@@ -144,7 +144,7 @@ var AssistantAnswerIRModel = defineSchemaModel({
|
|
|
144
144
|
});
|
|
145
145
|
// src/events.ts
|
|
146
146
|
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
147
|
-
import {
|
|
147
|
+
import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
|
|
148
148
|
var AssistantAnswerRequestedPayload = defineSchemaModel2({
|
|
149
149
|
name: "AssistantAnswerRequestedPayload",
|
|
150
150
|
description: "Emitted when an assistant answer is requested (pre-gate).",
|
|
@@ -393,9 +393,47 @@ function createDemoAssistantHandlers() {
|
|
|
393
393
|
}
|
|
394
394
|
return { answer, explainConcept };
|
|
395
395
|
}
|
|
396
|
+
// src/locale-jurisdiction-gate.feature.ts
|
|
397
|
+
import { defineFeature } from "@contractspec/lib.contracts-spec";
|
|
398
|
+
var LocaleJurisdictionGateFeature = defineFeature({
|
|
399
|
+
meta: {
|
|
400
|
+
key: "locale-jurisdiction-gate",
|
|
401
|
+
version: "1.0.0",
|
|
402
|
+
title: "Locale + Jurisdiction Gate",
|
|
403
|
+
description: "Fail-closed gating for assistant calls requiring locale/jurisdiction/snapshot/scope and citations.",
|
|
404
|
+
domain: "knowledge",
|
|
405
|
+
owners: ["@examples"],
|
|
406
|
+
tags: ["assistant", "policy", "locale", "jurisdiction", "knowledge"],
|
|
407
|
+
stability: "experimental"
|
|
408
|
+
},
|
|
409
|
+
operations: [
|
|
410
|
+
{ key: "assistant.answer", version: "1.0.0" },
|
|
411
|
+
{ key: "assistant.explainConcept", version: "1.0.0" }
|
|
412
|
+
],
|
|
413
|
+
events: [
|
|
414
|
+
{ key: "assistant.answer.requested", version: "1.0.0" },
|
|
415
|
+
{ key: "assistant.answer.blocked", version: "1.0.0" },
|
|
416
|
+
{ key: "assistant.answer.delivered", version: "1.0.0" }
|
|
417
|
+
],
|
|
418
|
+
presentations: [],
|
|
419
|
+
opToPresentation: [],
|
|
420
|
+
presentationsTargets: [],
|
|
421
|
+
capabilities: {
|
|
422
|
+
requires: [{ key: "knowledge", version: "1.0.0" }]
|
|
423
|
+
},
|
|
424
|
+
policies: [{ key: "locale-jurisdiction-gate.policy.gate", version: "1.0.0" }],
|
|
425
|
+
knowledge: [
|
|
426
|
+
{ key: "locale-jurisdiction-gate.knowledge.rules", version: "1.0.0" }
|
|
427
|
+
],
|
|
428
|
+
docs: [
|
|
429
|
+
"docs.examples.locale-jurisdiction-gate.goal",
|
|
430
|
+
"docs.examples.locale-jurisdiction-gate.reference"
|
|
431
|
+
]
|
|
432
|
+
});
|
|
433
|
+
|
|
396
434
|
// src/operations/assistant.ts
|
|
397
435
|
import { defineCommand } from "@contractspec/lib.contracts-spec";
|
|
398
|
-
import {
|
|
436
|
+
import { defineSchemaModel as defineSchemaModel3, ScalarTypeEnum as ScalarTypeEnum3 } from "@contractspec/lib.schema";
|
|
399
437
|
var AssistantQuestionInput = defineSchemaModel3({
|
|
400
438
|
name: "AssistantQuestionInput",
|
|
401
439
|
description: "Input for assistant calls with mandatory envelope.",
|
|
@@ -479,43 +517,6 @@ var AssistantExplainConceptContract = defineCommand({
|
|
|
479
517
|
},
|
|
480
518
|
policy: { auth: "user" }
|
|
481
519
|
});
|
|
482
|
-
// src/locale-jurisdiction-gate.feature.ts
|
|
483
|
-
import { defineFeature } from "@contractspec/lib.contracts-spec";
|
|
484
|
-
var LocaleJurisdictionGateFeature = defineFeature({
|
|
485
|
-
meta: {
|
|
486
|
-
key: "locale-jurisdiction-gate",
|
|
487
|
-
version: "1.0.0",
|
|
488
|
-
title: "Locale + Jurisdiction Gate",
|
|
489
|
-
description: "Fail-closed gating for assistant calls requiring locale/jurisdiction/snapshot/scope and citations.",
|
|
490
|
-
domain: "knowledge",
|
|
491
|
-
owners: ["@examples"],
|
|
492
|
-
tags: ["assistant", "policy", "locale", "jurisdiction", "knowledge"],
|
|
493
|
-
stability: "experimental"
|
|
494
|
-
},
|
|
495
|
-
operations: [
|
|
496
|
-
{ key: "assistant.answer", version: "1.0.0" },
|
|
497
|
-
{ key: "assistant.explainConcept", version: "1.0.0" }
|
|
498
|
-
],
|
|
499
|
-
events: [
|
|
500
|
-
{ key: "assistant.answer.requested", version: "1.0.0" },
|
|
501
|
-
{ key: "assistant.answer.blocked", version: "1.0.0" },
|
|
502
|
-
{ key: "assistant.answer.delivered", version: "1.0.0" }
|
|
503
|
-
],
|
|
504
|
-
presentations: [],
|
|
505
|
-
opToPresentation: [],
|
|
506
|
-
presentationsTargets: [],
|
|
507
|
-
capabilities: {
|
|
508
|
-
requires: [{ key: "knowledge", version: "1.0.0" }]
|
|
509
|
-
},
|
|
510
|
-
policies: [{ key: "locale-jurisdiction-gate.policy.gate", version: "1.0.0" }],
|
|
511
|
-
knowledge: [
|
|
512
|
-
{ key: "locale-jurisdiction-gate.knowledge.rules", version: "1.0.0" }
|
|
513
|
-
],
|
|
514
|
-
docs: [
|
|
515
|
-
"docs.examples.locale-jurisdiction-gate.goal",
|
|
516
|
-
"docs.examples.locale-jurisdiction-gate.reference"
|
|
517
|
-
]
|
|
518
|
-
});
|
|
519
520
|
export {
|
|
520
521
|
validateEnvelope,
|
|
521
522
|
example_default as example,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/entities/models.ts
|
|
2
2
|
import {
|
|
3
|
-
ScalarTypeEnum,
|
|
4
3
|
defineEnum,
|
|
5
|
-
defineSchemaModel
|
|
4
|
+
defineSchemaModel,
|
|
5
|
+
ScalarTypeEnum
|
|
6
6
|
} from "@contractspec/lib.schema";
|
|
7
7
|
var AllowedScopeEnum = defineEnum("AllowedScope", [
|
|
8
8
|
"education_only",
|
|
@@ -102,7 +102,7 @@ var AssistantAnswerIRModel = defineSchemaModel({
|
|
|
102
102
|
|
|
103
103
|
// src/operations/assistant.ts
|
|
104
104
|
import { defineCommand } from "@contractspec/lib.contracts-spec";
|
|
105
|
-
import {
|
|
105
|
+
import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
|
|
106
106
|
var AssistantQuestionInput = defineSchemaModel2({
|
|
107
107
|
name: "AssistantQuestionInput",
|
|
108
108
|
description: "Input for assistant calls with mandatory envelope.",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/entities/models.ts
|
|
2
2
|
import {
|
|
3
|
-
ScalarTypeEnum,
|
|
4
3
|
defineEnum,
|
|
5
|
-
defineSchemaModel
|
|
4
|
+
defineSchemaModel,
|
|
5
|
+
ScalarTypeEnum
|
|
6
6
|
} from "@contractspec/lib.schema";
|
|
7
7
|
var AllowedScopeEnum = defineEnum("AllowedScope", [
|
|
8
8
|
"education_only",
|
|
@@ -102,7 +102,7 @@ var AssistantAnswerIRModel = defineSchemaModel({
|
|
|
102
102
|
|
|
103
103
|
// src/operations/assistant.ts
|
|
104
104
|
import { defineCommand } from "@contractspec/lib.contracts-spec";
|
|
105
|
-
import {
|
|
105
|
+
import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
|
|
106
106
|
var AssistantQuestionInput = defineSchemaModel2({
|
|
107
107
|
name: "AssistantQuestionInput",
|
|
108
108
|
description: "Input for assistant calls with mandatory envelope.",
|
package/dist/entities/index.js
CHANGED
package/dist/entities/models.js
CHANGED
package/dist/events.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/events.ts
|
|
3
3
|
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
4
|
-
import {
|
|
4
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
5
5
|
var AssistantAnswerRequestedPayload = defineSchemaModel({
|
|
6
6
|
name: "AssistantAnswerRequestedPayload",
|
|
7
7
|
description: "Emitted when an assistant answer is requested (pre-gate).",
|
package/dist/index.d.ts
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* allowedScope must be explicit, and answers must cite a KB snapshot.
|
|
6
6
|
*/
|
|
7
7
|
export * from './entities';
|
|
8
|
-
export * from './operations';
|
|
9
8
|
export * from './events';
|
|
10
|
-
export
|
|
9
|
+
export { default as example } from './example';
|
|
11
10
|
export * from './handlers';
|
|
12
11
|
export * from './locale-jurisdiction-gate.feature';
|
|
13
|
-
export
|
|
12
|
+
export * from './operations';
|
|
13
|
+
export * from './policy';
|
|
14
14
|
import './docs';
|
package/dist/index.js
CHANGED
|
@@ -44,9 +44,9 @@ var docBlocks = [
|
|
|
44
44
|
registerDocBlocks(docBlocks);
|
|
45
45
|
// src/entities/models.ts
|
|
46
46
|
import {
|
|
47
|
-
ScalarTypeEnum,
|
|
48
47
|
defineEnum,
|
|
49
|
-
defineSchemaModel
|
|
48
|
+
defineSchemaModel,
|
|
49
|
+
ScalarTypeEnum
|
|
50
50
|
} from "@contractspec/lib.schema";
|
|
51
51
|
var AllowedScopeEnum = defineEnum("AllowedScope", [
|
|
52
52
|
"education_only",
|
|
@@ -145,7 +145,7 @@ var AssistantAnswerIRModel = defineSchemaModel({
|
|
|
145
145
|
});
|
|
146
146
|
// src/events.ts
|
|
147
147
|
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
148
|
-
import {
|
|
148
|
+
import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
|
|
149
149
|
var AssistantAnswerRequestedPayload = defineSchemaModel2({
|
|
150
150
|
name: "AssistantAnswerRequestedPayload",
|
|
151
151
|
description: "Emitted when an assistant answer is requested (pre-gate).",
|
|
@@ -394,9 +394,47 @@ function createDemoAssistantHandlers() {
|
|
|
394
394
|
}
|
|
395
395
|
return { answer, explainConcept };
|
|
396
396
|
}
|
|
397
|
+
// src/locale-jurisdiction-gate.feature.ts
|
|
398
|
+
import { defineFeature } from "@contractspec/lib.contracts-spec";
|
|
399
|
+
var LocaleJurisdictionGateFeature = defineFeature({
|
|
400
|
+
meta: {
|
|
401
|
+
key: "locale-jurisdiction-gate",
|
|
402
|
+
version: "1.0.0",
|
|
403
|
+
title: "Locale + Jurisdiction Gate",
|
|
404
|
+
description: "Fail-closed gating for assistant calls requiring locale/jurisdiction/snapshot/scope and citations.",
|
|
405
|
+
domain: "knowledge",
|
|
406
|
+
owners: ["@examples"],
|
|
407
|
+
tags: ["assistant", "policy", "locale", "jurisdiction", "knowledge"],
|
|
408
|
+
stability: "experimental"
|
|
409
|
+
},
|
|
410
|
+
operations: [
|
|
411
|
+
{ key: "assistant.answer", version: "1.0.0" },
|
|
412
|
+
{ key: "assistant.explainConcept", version: "1.0.0" }
|
|
413
|
+
],
|
|
414
|
+
events: [
|
|
415
|
+
{ key: "assistant.answer.requested", version: "1.0.0" },
|
|
416
|
+
{ key: "assistant.answer.blocked", version: "1.0.0" },
|
|
417
|
+
{ key: "assistant.answer.delivered", version: "1.0.0" }
|
|
418
|
+
],
|
|
419
|
+
presentations: [],
|
|
420
|
+
opToPresentation: [],
|
|
421
|
+
presentationsTargets: [],
|
|
422
|
+
capabilities: {
|
|
423
|
+
requires: [{ key: "knowledge", version: "1.0.0" }]
|
|
424
|
+
},
|
|
425
|
+
policies: [{ key: "locale-jurisdiction-gate.policy.gate", version: "1.0.0" }],
|
|
426
|
+
knowledge: [
|
|
427
|
+
{ key: "locale-jurisdiction-gate.knowledge.rules", version: "1.0.0" }
|
|
428
|
+
],
|
|
429
|
+
docs: [
|
|
430
|
+
"docs.examples.locale-jurisdiction-gate.goal",
|
|
431
|
+
"docs.examples.locale-jurisdiction-gate.reference"
|
|
432
|
+
]
|
|
433
|
+
});
|
|
434
|
+
|
|
397
435
|
// src/operations/assistant.ts
|
|
398
436
|
import { defineCommand } from "@contractspec/lib.contracts-spec";
|
|
399
|
-
import {
|
|
437
|
+
import { defineSchemaModel as defineSchemaModel3, ScalarTypeEnum as ScalarTypeEnum3 } from "@contractspec/lib.schema";
|
|
400
438
|
var AssistantQuestionInput = defineSchemaModel3({
|
|
401
439
|
name: "AssistantQuestionInput",
|
|
402
440
|
description: "Input for assistant calls with mandatory envelope.",
|
|
@@ -480,43 +518,6 @@ var AssistantExplainConceptContract = defineCommand({
|
|
|
480
518
|
},
|
|
481
519
|
policy: { auth: "user" }
|
|
482
520
|
});
|
|
483
|
-
// src/locale-jurisdiction-gate.feature.ts
|
|
484
|
-
import { defineFeature } from "@contractspec/lib.contracts-spec";
|
|
485
|
-
var LocaleJurisdictionGateFeature = defineFeature({
|
|
486
|
-
meta: {
|
|
487
|
-
key: "locale-jurisdiction-gate",
|
|
488
|
-
version: "1.0.0",
|
|
489
|
-
title: "Locale + Jurisdiction Gate",
|
|
490
|
-
description: "Fail-closed gating for assistant calls requiring locale/jurisdiction/snapshot/scope and citations.",
|
|
491
|
-
domain: "knowledge",
|
|
492
|
-
owners: ["@examples"],
|
|
493
|
-
tags: ["assistant", "policy", "locale", "jurisdiction", "knowledge"],
|
|
494
|
-
stability: "experimental"
|
|
495
|
-
},
|
|
496
|
-
operations: [
|
|
497
|
-
{ key: "assistant.answer", version: "1.0.0" },
|
|
498
|
-
{ key: "assistant.explainConcept", version: "1.0.0" }
|
|
499
|
-
],
|
|
500
|
-
events: [
|
|
501
|
-
{ key: "assistant.answer.requested", version: "1.0.0" },
|
|
502
|
-
{ key: "assistant.answer.blocked", version: "1.0.0" },
|
|
503
|
-
{ key: "assistant.answer.delivered", version: "1.0.0" }
|
|
504
|
-
],
|
|
505
|
-
presentations: [],
|
|
506
|
-
opToPresentation: [],
|
|
507
|
-
presentationsTargets: [],
|
|
508
|
-
capabilities: {
|
|
509
|
-
requires: [{ key: "knowledge", version: "1.0.0" }]
|
|
510
|
-
},
|
|
511
|
-
policies: [{ key: "locale-jurisdiction-gate.policy.gate", version: "1.0.0" }],
|
|
512
|
-
knowledge: [
|
|
513
|
-
{ key: "locale-jurisdiction-gate.knowledge.rules", version: "1.0.0" }
|
|
514
|
-
],
|
|
515
|
-
docs: [
|
|
516
|
-
"docs.examples.locale-jurisdiction-gate.goal",
|
|
517
|
-
"docs.examples.locale-jurisdiction-gate.reference"
|
|
518
|
-
]
|
|
519
|
-
});
|
|
520
521
|
export {
|
|
521
522
|
validateEnvelope,
|
|
522
523
|
example_default as example,
|
package/dist/node/events.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/events.ts
|
|
2
2
|
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
3
|
-
import {
|
|
3
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
4
4
|
var AssistantAnswerRequestedPayload = defineSchemaModel({
|
|
5
5
|
name: "AssistantAnswerRequestedPayload",
|
|
6
6
|
description: "Emitted when an assistant answer is requested (pre-gate).",
|