@basou/core 0.5.0 → 0.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basou/core",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Core primitives for Basou: sessions, events, approvals, git capability",
@@ -12,7 +12,8 @@
12
12
  "audit",
13
13
  "provenance",
14
14
  "git",
15
- "claude-code"
15
+ "claude-code",
16
+ "json-schema"
16
17
  ],
17
18
  "repository": {
18
19
  "type": "git",
@@ -35,10 +36,12 @@
35
36
  ".": {
36
37
  "types": "./dist/index.d.ts",
37
38
  "import": "./dist/index.js"
38
- }
39
+ },
40
+ "./schemas/*": "./schemas/*"
39
41
  },
40
42
  "files": [
41
- "dist"
43
+ "dist",
44
+ "schemas"
42
45
  ],
43
46
  "engines": {
44
47
  "node": ">=20.10.0"
@@ -49,9 +52,14 @@
49
52
  "yaml": "^2.9.0",
50
53
  "zod": "^4.4.3"
51
54
  },
55
+ "devDependencies": {
56
+ "ajv": "^8.17.1",
57
+ "ajv-formats": "^3.0.1"
58
+ },
52
59
  "scripts": {
53
60
  "build": "tsup",
54
61
  "dev": "tsup --watch",
62
+ "gen:schemas": "pnpm build && node scripts/gen-schemas.mjs",
55
63
  "typecheck": "tsc --noEmit",
56
64
  "test": "vitest run",
57
65
  "test:watch": "vitest",
@@ -0,0 +1,130 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://basou.dev/schemas/0.1.0/approval.schema.json",
4
+ "title": "Basou Approval",
5
+ "description": "A `.basou/approvals/{pending,resolved}/<id>.yaml` approval record.",
6
+ "type": "object",
7
+ "properties": {
8
+ "schema_version": {
9
+ "type": "string",
10
+ "const": "0.1.0"
11
+ },
12
+ "id": {
13
+ "type": "string",
14
+ "pattern": "^appr_[0-7][0-9A-HJKMNP-TV-Z]{25}$",
15
+ "description": "Basou appr id: `appr_` followed by a 26-character Crockford Base32 ULID."
16
+ },
17
+ "session_id": {
18
+ "type": "string",
19
+ "pattern": "^ses_[0-7][0-9A-HJKMNP-TV-Z]{25}$",
20
+ "description": "Basou ses id: `ses_` followed by a 26-character Crockford Base32 ULID."
21
+ },
22
+ "created_at": {
23
+ "type": "string",
24
+ "format": "date-time",
25
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
26
+ },
27
+ "status": {
28
+ "type": "string",
29
+ "enum": [
30
+ "pending",
31
+ "approved",
32
+ "rejected",
33
+ "expired"
34
+ ]
35
+ },
36
+ "risk_level": {
37
+ "type": "string",
38
+ "enum": [
39
+ "low",
40
+ "medium",
41
+ "high",
42
+ "critical"
43
+ ]
44
+ },
45
+ "action": {
46
+ "type": "object",
47
+ "properties": {
48
+ "kind": {
49
+ "type": "string"
50
+ }
51
+ },
52
+ "required": [
53
+ "kind"
54
+ ],
55
+ "additionalProperties": {}
56
+ },
57
+ "reason": {
58
+ "type": "string"
59
+ },
60
+ "expires_at": {
61
+ "default": null,
62
+ "anyOf": [
63
+ {
64
+ "type": "string",
65
+ "format": "date-time",
66
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
67
+ },
68
+ {
69
+ "type": "null"
70
+ }
71
+ ]
72
+ },
73
+ "resolver": {
74
+ "default": null,
75
+ "anyOf": [
76
+ {
77
+ "type": "string"
78
+ },
79
+ {
80
+ "type": "null"
81
+ }
82
+ ]
83
+ },
84
+ "resolved_at": {
85
+ "default": null,
86
+ "anyOf": [
87
+ {
88
+ "type": "string",
89
+ "format": "date-time",
90
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
91
+ },
92
+ {
93
+ "type": "null"
94
+ }
95
+ ]
96
+ },
97
+ "note": {
98
+ "default": null,
99
+ "anyOf": [
100
+ {
101
+ "type": "string"
102
+ },
103
+ {
104
+ "type": "null"
105
+ }
106
+ ]
107
+ },
108
+ "rejection_reason": {
109
+ "default": null,
110
+ "anyOf": [
111
+ {
112
+ "type": "string"
113
+ },
114
+ {
115
+ "type": "null"
116
+ }
117
+ ]
118
+ }
119
+ },
120
+ "required": [
121
+ "schema_version",
122
+ "id",
123
+ "session_id",
124
+ "created_at",
125
+ "status",
126
+ "risk_level",
127
+ "action",
128
+ "reason"
129
+ ]
130
+ }