@gmickel/gno 1.19.0 → 1.21.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/README.md +28 -8
- package/assets/skill/SKILL.md +73 -27
- package/assets/skill/mcp-reference.md +7 -2
- package/assets/skill/recipes/citation-and-provenance.md +32 -9
- package/package.json +1 -1
- package/spec/cli.md +142 -17
- package/spec/db/schema.sql +170 -0
- package/spec/evals-agentic.md +87 -5
- package/spec/mcp.md +75 -3
- package/spec/output-schemas/ask.schema.json +198 -0
- package/spec/output-schemas/capsule-reverified-event.schema.json +47 -0
- package/spec/output-schemas/changes.schema.json +280 -0
- package/spec/output-schemas/claim-verification.schema.json +291 -0
- package/spec/output-schemas/context-capsule-v1.schema.json +36 -1
- package/spec/output-schemas/document-diff.schema.json +185 -0
- package/spec/output-schemas/impact.schema.json +122 -0
- package/spec/output-schemas/saved-capsule-list.schema.json +16 -0
- package/spec/output-schemas/saved-capsule-registration.schema.json +172 -0
- package/spec/output-schemas/saved-capsule-reverification.schema.json +59 -0
- package/spec/output-schemas/saved-capsule-unwatch.schema.json +16 -0
- package/spec/output-schemas/saved-capsule-watch.schema.json +17 -0
- package/src/app/context-runtime-contract.ts +10 -5
- package/src/app/context-runtime-input.ts +29 -1
- package/src/app/context-runtime-types.ts +4 -0
- package/src/app/context-runtime.ts +5 -1
- package/src/app/context-surface.ts +4 -0
- package/src/app/verified-ask.ts +291 -0
- package/src/cli/commands/ask-format.ts +255 -0
- package/src/cli/commands/ask.ts +40 -149
- package/src/cli/commands/changes.ts +160 -0
- package/src/cli/commands/context-saved.ts +189 -0
- package/src/cli/options.ts +8 -0
- package/src/cli/program.ts +227 -1
- package/src/core/capsule-registry.ts +279 -0
- package/src/core/capsule-reverification-scheduler.ts +218 -0
- package/src/core/capsule-reverification.ts +289 -0
- package/src/core/change-diff.ts +182 -0
- package/src/core/change-journal.ts +228 -0
- package/src/core/context-budget.ts +6 -0
- package/src/core/context-capsule-retrieval-schema.ts +4 -0
- package/src/core/context-capsule-schema.ts +17 -0
- package/src/core/context-capsule-validation.ts +3 -2
- package/src/core/context-capsule.ts +18 -0
- package/src/core/context-compiler.ts +33 -21
- package/src/core/context-evidence.ts +6 -0
- package/src/core/knowledge-delta.ts +395 -0
- package/src/core/knowledge-impact.ts +202 -0
- package/src/core/retrieval-trace-evidence-origin.ts +3 -0
- package/src/core/retrieval-trace-session.ts +15 -2
- package/src/ingestion/sync.ts +214 -165
- package/src/llm/errors.ts +10 -1
- package/src/llm/httpGeneration.ts +11 -1
- package/src/llm/nodeLlamaCpp/generation.ts +54 -10
- package/src/llm/types.ts +6 -0
- package/src/mcp/tools/ask.ts +228 -0
- package/src/mcp/tools/changes.ts +80 -0
- package/src/mcp/tools/context.ts +28 -7
- package/src/mcp/tools/index.ts +38 -0
- package/src/pipeline/claim-verification-schema.ts +235 -0
- package/src/pipeline/claim-verification.ts +487 -0
- package/src/pipeline/claim-verifier.ts +474 -0
- package/src/pipeline/types.ts +25 -0
- package/src/sdk/client.ts +77 -2
- package/src/sdk/index.ts +7 -0
- package/src/sdk/types.ts +22 -0
- package/src/serve/doc-events.ts +12 -1
- package/src/serve/public/components/AskVerificationPanel.tsx +189 -0
- package/src/serve/public/globals.built.css +1 -1
- package/src/serve/public/pages/Ask.tsx +42 -4
- package/src/serve/resident-runtime.ts +22 -0
- package/src/serve/routes/api.ts +162 -3
- package/src/serve/routes/changes.ts +102 -0
- package/src/serve/server.ts +34 -0
- package/src/serve/watch-service.ts +9 -0
- package/src/store/index.ts +21 -0
- package/src/store/migrations/015-document-change-journal.ts +85 -0
- package/src/store/migrations/016-saved-capsules.ts +131 -0
- package/src/store/migrations/017-document-change-retention-counters.ts +33 -0
- package/src/store/migrations/018-saved-capsule-registration-epoch.ts +24 -0
- package/src/store/migrations/019-saved-capsule-registration-generation.ts +53 -0
- package/src/store/migrations/index.ts +10 -0
- package/src/store/sqlite/adapter.ts +291 -7
- package/src/store/sqlite/capsule-registry-store.ts +534 -0
- package/src/store/sqlite/change-journal-store.ts +473 -0
- package/src/store/types.ts +262 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "gno://schemas/document-diff@1.0",
|
|
4
|
+
"title": "GNO Document Structural Diff",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": [
|
|
7
|
+
"schemaVersion",
|
|
8
|
+
"status",
|
|
9
|
+
"document",
|
|
10
|
+
"change",
|
|
11
|
+
"content",
|
|
12
|
+
"history",
|
|
13
|
+
"warnings"
|
|
14
|
+
],
|
|
15
|
+
"properties": {
|
|
16
|
+
"schemaVersion": { "type": "string", "const": "1.0" },
|
|
17
|
+
"status": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"enum": ["available", "expired", "unavailable"]
|
|
20
|
+
},
|
|
21
|
+
"document": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"required": ["id", "uri", "title", "collection", "relPath", "active"],
|
|
24
|
+
"properties": {
|
|
25
|
+
"id": { "type": "string", "pattern": "^#[a-f0-9]{6,}$" },
|
|
26
|
+
"uri": { "type": "string", "pattern": "^gno://.+" },
|
|
27
|
+
"title": { "type": ["string", "null"] },
|
|
28
|
+
"collection": { "type": "string" },
|
|
29
|
+
"relPath": { "type": "string" },
|
|
30
|
+
"active": { "type": "boolean" }
|
|
31
|
+
},
|
|
32
|
+
"additionalProperties": false
|
|
33
|
+
},
|
|
34
|
+
"change": {
|
|
35
|
+
"anyOf": [
|
|
36
|
+
{ "$ref": "gno://schemas/changes@1.0#/definitions/change" },
|
|
37
|
+
{ "type": "null" }
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"content": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"required": ["status", "reason"],
|
|
43
|
+
"properties": {
|
|
44
|
+
"status": { "type": "string", "const": "not_retained" },
|
|
45
|
+
"reason": { "type": "string", "const": "journal_metadata_only" }
|
|
46
|
+
},
|
|
47
|
+
"additionalProperties": false
|
|
48
|
+
},
|
|
49
|
+
"history": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"required": ["status", "reason"],
|
|
52
|
+
"properties": {
|
|
53
|
+
"status": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"enum": ["available", "partial", "unavailable"]
|
|
56
|
+
},
|
|
57
|
+
"reason": {
|
|
58
|
+
"type": ["string", "null"],
|
|
59
|
+
"enum": [
|
|
60
|
+
null,
|
|
61
|
+
"structure_delta_truncated",
|
|
62
|
+
"change_expired",
|
|
63
|
+
"no_retained_change",
|
|
64
|
+
"change_not_found"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"additionalProperties": false
|
|
69
|
+
},
|
|
70
|
+
"warnings": { "type": "array", "items": { "type": "string" } }
|
|
71
|
+
},
|
|
72
|
+
"additionalProperties": false,
|
|
73
|
+
"allOf": [
|
|
74
|
+
{
|
|
75
|
+
"if": {
|
|
76
|
+
"properties": { "status": { "const": "available" } },
|
|
77
|
+
"required": ["status"]
|
|
78
|
+
},
|
|
79
|
+
"then": {
|
|
80
|
+
"properties": {
|
|
81
|
+
"change": {
|
|
82
|
+
"$ref": "gno://schemas/changes@1.0#/definitions/change"
|
|
83
|
+
},
|
|
84
|
+
"history": {
|
|
85
|
+
"type": "object",
|
|
86
|
+
"properties": {
|
|
87
|
+
"status": { "enum": ["available", "partial"] }
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"if": {
|
|
95
|
+
"properties": { "status": { "const": "expired" } },
|
|
96
|
+
"required": ["status"]
|
|
97
|
+
},
|
|
98
|
+
"then": {
|
|
99
|
+
"properties": {
|
|
100
|
+
"change": { "type": "null" },
|
|
101
|
+
"history": {
|
|
102
|
+
"type": "object",
|
|
103
|
+
"properties": {
|
|
104
|
+
"status": { "const": "unavailable" },
|
|
105
|
+
"reason": { "const": "change_expired" }
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"if": {
|
|
113
|
+
"properties": { "status": { "const": "unavailable" } },
|
|
114
|
+
"required": ["status"]
|
|
115
|
+
},
|
|
116
|
+
"then": {
|
|
117
|
+
"properties": {
|
|
118
|
+
"change": { "type": "null" },
|
|
119
|
+
"history": {
|
|
120
|
+
"type": "object",
|
|
121
|
+
"properties": {
|
|
122
|
+
"status": { "const": "unavailable" },
|
|
123
|
+
"reason": {
|
|
124
|
+
"enum": ["no_retained_change", "change_not_found"]
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"if": {
|
|
133
|
+
"properties": {
|
|
134
|
+
"history": {
|
|
135
|
+
"type": "object",
|
|
136
|
+
"properties": { "status": { "const": "available" } },
|
|
137
|
+
"required": ["status"]
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"required": ["history"]
|
|
141
|
+
},
|
|
142
|
+
"then": {
|
|
143
|
+
"properties": {
|
|
144
|
+
"history": {
|
|
145
|
+
"type": "object",
|
|
146
|
+
"properties": { "reason": { "type": "null" } }
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"if": {
|
|
153
|
+
"properties": {
|
|
154
|
+
"history": {
|
|
155
|
+
"type": "object",
|
|
156
|
+
"properties": { "status": { "const": "partial" } },
|
|
157
|
+
"required": ["status"]
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
"required": ["history"]
|
|
161
|
+
},
|
|
162
|
+
"then": {
|
|
163
|
+
"properties": {
|
|
164
|
+
"change": {
|
|
165
|
+
"type": "object",
|
|
166
|
+
"properties": {
|
|
167
|
+
"structureDelta": {
|
|
168
|
+
"type": "object",
|
|
169
|
+
"properties": { "truncated": { "const": true } },
|
|
170
|
+
"required": ["truncated"]
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"required": ["structureDelta"]
|
|
174
|
+
},
|
|
175
|
+
"history": {
|
|
176
|
+
"type": "object",
|
|
177
|
+
"properties": {
|
|
178
|
+
"reason": { "const": "structure_delta_truncated" }
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "gno://schemas/impact@1.0",
|
|
4
|
+
"title": "GNO Knowledge Impact",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["schemaVersion", "root", "impacted", "meta"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"schemaVersion": { "type": "string", "const": "1.0" },
|
|
9
|
+
"root": { "$ref": "#/definitions/node" },
|
|
10
|
+
"impacted": {
|
|
11
|
+
"type": "array",
|
|
12
|
+
"maxItems": 999,
|
|
13
|
+
"items": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"required": ["document", "depth", "evidencePath"],
|
|
16
|
+
"properties": {
|
|
17
|
+
"document": { "$ref": "#/definitions/node" },
|
|
18
|
+
"depth": { "type": "integer", "minimum": 1, "maximum": 6 },
|
|
19
|
+
"evidencePath": {
|
|
20
|
+
"type": "array",
|
|
21
|
+
"minItems": 1,
|
|
22
|
+
"maxItems": 6,
|
|
23
|
+
"items": { "$ref": "#/definitions/step" }
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"additionalProperties": false
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"meta": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"required": [
|
|
32
|
+
"maxDepth",
|
|
33
|
+
"maxNodes",
|
|
34
|
+
"maxEdges",
|
|
35
|
+
"frontierLimit",
|
|
36
|
+
"visitedLimit",
|
|
37
|
+
"returnedNodes",
|
|
38
|
+
"returnedEdges",
|
|
39
|
+
"truncated",
|
|
40
|
+
"warnings"
|
|
41
|
+
],
|
|
42
|
+
"properties": {
|
|
43
|
+
"maxDepth": { "type": "integer", "minimum": 1, "maximum": 6 },
|
|
44
|
+
"maxNodes": { "type": "integer", "minimum": 1, "maximum": 1000 },
|
|
45
|
+
"maxEdges": { "type": "integer", "minimum": 1, "maximum": 5000 },
|
|
46
|
+
"frontierLimit": {
|
|
47
|
+
"type": "integer",
|
|
48
|
+
"minimum": 1,
|
|
49
|
+
"maximum": 1000
|
|
50
|
+
},
|
|
51
|
+
"visitedLimit": {
|
|
52
|
+
"type": "integer",
|
|
53
|
+
"minimum": 1,
|
|
54
|
+
"maximum": 5000
|
|
55
|
+
},
|
|
56
|
+
"returnedNodes": {
|
|
57
|
+
"type": "integer",
|
|
58
|
+
"minimum": 1,
|
|
59
|
+
"maximum": 1000
|
|
60
|
+
},
|
|
61
|
+
"returnedEdges": {
|
|
62
|
+
"type": "integer",
|
|
63
|
+
"minimum": 0,
|
|
64
|
+
"maximum": 5000
|
|
65
|
+
},
|
|
66
|
+
"truncated": { "type": "boolean" },
|
|
67
|
+
"warnings": { "type": "array", "items": { "type": "string" } }
|
|
68
|
+
},
|
|
69
|
+
"additionalProperties": false
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"additionalProperties": false,
|
|
73
|
+
"definitions": {
|
|
74
|
+
"node": {
|
|
75
|
+
"type": "object",
|
|
76
|
+
"required": ["id", "uri", "title", "collection", "relPath"],
|
|
77
|
+
"properties": {
|
|
78
|
+
"id": { "type": "string", "pattern": "^#[a-f0-9]{6,}$" },
|
|
79
|
+
"uri": { "type": "string", "pattern": "^gno://.+" },
|
|
80
|
+
"title": { "type": ["string", "null"] },
|
|
81
|
+
"collection": { "type": "string" },
|
|
82
|
+
"relPath": { "type": "string" }
|
|
83
|
+
},
|
|
84
|
+
"additionalProperties": false
|
|
85
|
+
},
|
|
86
|
+
"endpoint": {
|
|
87
|
+
"type": "object",
|
|
88
|
+
"required": ["id", "uri"],
|
|
89
|
+
"properties": {
|
|
90
|
+
"id": { "type": "string", "pattern": "^#[a-f0-9]{6,}$" },
|
|
91
|
+
"uri": { "type": "string", "pattern": "^gno://.+" }
|
|
92
|
+
},
|
|
93
|
+
"additionalProperties": false
|
|
94
|
+
},
|
|
95
|
+
"step": {
|
|
96
|
+
"type": "object",
|
|
97
|
+
"required": [
|
|
98
|
+
"source",
|
|
99
|
+
"target",
|
|
100
|
+
"edgeType",
|
|
101
|
+
"relationType",
|
|
102
|
+
"confidence",
|
|
103
|
+
"edgeSource"
|
|
104
|
+
],
|
|
105
|
+
"properties": {
|
|
106
|
+
"source": { "$ref": "#/definitions/endpoint" },
|
|
107
|
+
"target": { "$ref": "#/definitions/endpoint" },
|
|
108
|
+
"edgeType": { "type": "string", "minLength": 1 },
|
|
109
|
+
"relationType": { "type": "string", "minLength": 1 },
|
|
110
|
+
"confidence": {
|
|
111
|
+
"type": "string",
|
|
112
|
+
"enum": ["parsed", "configured", "manual", "inferred"]
|
|
113
|
+
},
|
|
114
|
+
"edgeSource": {
|
|
115
|
+
"type": "string",
|
|
116
|
+
"enum": ["wikilink", "markdown-link", "frontmatter-relation"]
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"additionalProperties": false
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "gno://schemas/saved-capsule-list@1.0",
|
|
4
|
+
"title": "GNO Saved Context Capsule List",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schemaVersion", "registrations"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schemaVersion": { "const": "1.0" },
|
|
10
|
+
"registrations": {
|
|
11
|
+
"type": "array",
|
|
12
|
+
"maxItems": 10000,
|
|
13
|
+
"items": { "$ref": "gno://schemas/saved-capsule-registration@1.0" }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "gno://schemas/saved-capsule-registration@1.0",
|
|
4
|
+
"title": "GNO Saved Context Capsule Registration",
|
|
5
|
+
"description": "Metadata-only registration for one caller-owned Context Capsule file. Capsule and passage bytes are never embedded in this payload.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"registrationId",
|
|
10
|
+
"filePath",
|
|
11
|
+
"fileHash",
|
|
12
|
+
"capsuleId",
|
|
13
|
+
"indexName",
|
|
14
|
+
"question",
|
|
15
|
+
"label",
|
|
16
|
+
"notificationPreference",
|
|
17
|
+
"registeredAtMs",
|
|
18
|
+
"updatedAtMs",
|
|
19
|
+
"lastAttemptedSequence",
|
|
20
|
+
"evidence",
|
|
21
|
+
"verification"
|
|
22
|
+
],
|
|
23
|
+
"properties": {
|
|
24
|
+
"registrationId": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"pattern": "^capsule-[a-f0-9]{40}$"
|
|
27
|
+
},
|
|
28
|
+
"filePath": { "type": "string", "minLength": 1, "maxLength": 8192 },
|
|
29
|
+
"fileHash": { "$ref": "#/definitions/sha256" },
|
|
30
|
+
"capsuleId": { "$ref": "#/definitions/sha256" },
|
|
31
|
+
"indexName": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
32
|
+
"question": {
|
|
33
|
+
"type": ["string", "null"],
|
|
34
|
+
"minLength": 1,
|
|
35
|
+
"maxLength": 8192
|
|
36
|
+
},
|
|
37
|
+
"label": {
|
|
38
|
+
"type": ["string", "null"],
|
|
39
|
+
"minLength": 1,
|
|
40
|
+
"maxLength": 512
|
|
41
|
+
},
|
|
42
|
+
"notificationPreference": { "enum": ["none", "local"] },
|
|
43
|
+
"registeredAtMs": { "type": "integer", "minimum": 0 },
|
|
44
|
+
"updatedAtMs": { "type": "integer", "minimum": 0 },
|
|
45
|
+
"lastAttemptedSequence": { "type": "integer", "minimum": 0 },
|
|
46
|
+
"evidence": {
|
|
47
|
+
"type": "array",
|
|
48
|
+
"maxItems": 10000,
|
|
49
|
+
"items": { "$ref": "#/definitions/evidenceReference" }
|
|
50
|
+
},
|
|
51
|
+
"verification": {
|
|
52
|
+
"anyOf": [{ "$ref": "#/definitions/verification" }, { "type": "null" }]
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"definitions": {
|
|
56
|
+
"sha256": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"pattern": "^[a-f0-9]{64}$"
|
|
59
|
+
},
|
|
60
|
+
"evidenceReference": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"additionalProperties": false,
|
|
63
|
+
"required": [
|
|
64
|
+
"evidenceId",
|
|
65
|
+
"canonicalUri",
|
|
66
|
+
"collection",
|
|
67
|
+
"sourceHash",
|
|
68
|
+
"mirrorHash",
|
|
69
|
+
"passageHash"
|
|
70
|
+
],
|
|
71
|
+
"properties": {
|
|
72
|
+
"evidenceId": { "$ref": "#/definitions/sha256" },
|
|
73
|
+
"canonicalUri": { "type": "string", "pattern": "^gno://.+" },
|
|
74
|
+
"collection": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
75
|
+
"sourceHash": { "$ref": "#/definitions/sha256" },
|
|
76
|
+
"mirrorHash": { "$ref": "#/definitions/sha256" },
|
|
77
|
+
"passageHash": { "$ref": "#/definitions/sha256" }
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"verification": {
|
|
81
|
+
"type": "object",
|
|
82
|
+
"additionalProperties": false,
|
|
83
|
+
"required": [
|
|
84
|
+
"registrationId",
|
|
85
|
+
"triggerKind",
|
|
86
|
+
"fromSequence",
|
|
87
|
+
"throughSequence",
|
|
88
|
+
"operationStatus",
|
|
89
|
+
"affectedQuestionState",
|
|
90
|
+
"affectedReasons",
|
|
91
|
+
"receiptJson",
|
|
92
|
+
"receiptHash",
|
|
93
|
+
"errorCode",
|
|
94
|
+
"errorMessage",
|
|
95
|
+
"verifiedAtMs"
|
|
96
|
+
],
|
|
97
|
+
"properties": {
|
|
98
|
+
"registrationId": {
|
|
99
|
+
"type": "string",
|
|
100
|
+
"pattern": "^capsule-[a-f0-9]{40}$"
|
|
101
|
+
},
|
|
102
|
+
"triggerKind": { "enum": ["manual", "journal"] },
|
|
103
|
+
"fromSequence": { "type": "integer", "minimum": 0 },
|
|
104
|
+
"throughSequence": { "type": "integer", "minimum": 0 },
|
|
105
|
+
"operationStatus": { "enum": ["completed", "failed"] },
|
|
106
|
+
"affectedQuestionState": {
|
|
107
|
+
"enum": ["unaffected", "affected", "unknown"]
|
|
108
|
+
},
|
|
109
|
+
"affectedReasons": {
|
|
110
|
+
"type": "array",
|
|
111
|
+
"maxItems": 4,
|
|
112
|
+
"uniqueItems": true,
|
|
113
|
+
"items": {
|
|
114
|
+
"enum": [
|
|
115
|
+
"content_stale",
|
|
116
|
+
"content_missing",
|
|
117
|
+
"ranking_changed",
|
|
118
|
+
"fingerprint_changed"
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"receiptJson": {
|
|
123
|
+
"type": ["string", "null"],
|
|
124
|
+
"maxLength": 16777216
|
|
125
|
+
},
|
|
126
|
+
"receiptHash": {
|
|
127
|
+
"anyOf": [{ "$ref": "#/definitions/sha256" }, { "type": "null" }]
|
|
128
|
+
},
|
|
129
|
+
"errorCode": {
|
|
130
|
+
"type": ["string", "null"],
|
|
131
|
+
"minLength": 1,
|
|
132
|
+
"maxLength": 256
|
|
133
|
+
},
|
|
134
|
+
"errorMessage": {
|
|
135
|
+
"type": ["string", "null"],
|
|
136
|
+
"minLength": 1,
|
|
137
|
+
"maxLength": 4096
|
|
138
|
+
},
|
|
139
|
+
"verifiedAtMs": { "type": "integer", "minimum": 0 }
|
|
140
|
+
},
|
|
141
|
+
"allOf": [
|
|
142
|
+
{
|
|
143
|
+
"if": {
|
|
144
|
+
"properties": { "operationStatus": { "const": "completed" } },
|
|
145
|
+
"required": ["operationStatus"]
|
|
146
|
+
},
|
|
147
|
+
"then": {
|
|
148
|
+
"properties": {
|
|
149
|
+
"affectedQuestionState": {
|
|
150
|
+
"enum": ["unaffected", "affected"]
|
|
151
|
+
},
|
|
152
|
+
"receiptJson": { "type": "string", "minLength": 1 },
|
|
153
|
+
"receiptHash": { "$ref": "#/definitions/sha256" },
|
|
154
|
+
"errorCode": { "type": "null" },
|
|
155
|
+
"errorMessage": { "type": "null" }
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"else": {
|
|
159
|
+
"properties": {
|
|
160
|
+
"affectedQuestionState": { "const": "unknown" },
|
|
161
|
+
"affectedReasons": { "type": "array", "maxItems": 0 },
|
|
162
|
+
"receiptJson": { "type": "null" },
|
|
163
|
+
"receiptHash": { "type": "null" },
|
|
164
|
+
"errorCode": { "type": "string", "minLength": 1 },
|
|
165
|
+
"errorMessage": { "type": "string", "minLength": 1 }
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "gno://schemas/saved-capsule-reverification@1.0",
|
|
4
|
+
"title": "GNO Saved Context Capsule Reverification Result",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schemaVersion", "registration", "verification", "receipt"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schemaVersion": { "const": "1.0" },
|
|
10
|
+
"registration": {
|
|
11
|
+
"$ref": "gno://schemas/saved-capsule-registration@1.0"
|
|
12
|
+
},
|
|
13
|
+
"verification": {
|
|
14
|
+
"$ref": "gno://schemas/saved-capsule-registration@1.0#/definitions/verification"
|
|
15
|
+
},
|
|
16
|
+
"receipt": {
|
|
17
|
+
"anyOf": [
|
|
18
|
+
{ "$ref": "gno://schemas/context-capsule-verification@1.0" },
|
|
19
|
+
{ "type": "null" }
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"allOf": [
|
|
24
|
+
{
|
|
25
|
+
"if": {
|
|
26
|
+
"properties": {
|
|
27
|
+
"verification": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"properties": { "operationStatus": { "const": "completed" } },
|
|
30
|
+
"required": ["operationStatus"]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"required": ["verification"]
|
|
34
|
+
},
|
|
35
|
+
"then": {
|
|
36
|
+
"properties": {
|
|
37
|
+
"verification": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"properties": { "triggerKind": { "const": "manual" } },
|
|
40
|
+
"required": ["triggerKind"]
|
|
41
|
+
},
|
|
42
|
+
"receipt": {
|
|
43
|
+
"$ref": "gno://schemas/context-capsule-verification@1.0"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"else": {
|
|
48
|
+
"properties": {
|
|
49
|
+
"verification": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"properties": { "triggerKind": { "const": "manual" } },
|
|
52
|
+
"required": ["triggerKind"]
|
|
53
|
+
},
|
|
54
|
+
"receipt": { "type": "null" }
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "gno://schemas/saved-capsule-unwatch@1.0",
|
|
4
|
+
"title": "GNO Saved Context Capsule Unwatch Receipt",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schemaVersion", "registrationId", "removed"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schemaVersion": { "const": "1.0" },
|
|
10
|
+
"registrationId": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"pattern": "^capsule-[a-f0-9]{40}$"
|
|
13
|
+
},
|
|
14
|
+
"removed": { "const": true }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "gno://schemas/saved-capsule-watch@1.0",
|
|
4
|
+
"title": "GNO Saved Context Capsule Watch Result",
|
|
5
|
+
"allOf": [
|
|
6
|
+
{
|
|
7
|
+
"$ref": "gno://schemas/saved-capsule-registration@1.0"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"type": "object",
|
|
11
|
+
"properties": {
|
|
12
|
+
"verification": { "type": "null" }
|
|
13
|
+
},
|
|
14
|
+
"required": ["verification"]
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -24,8 +24,9 @@ import { resolveModelUri } from "../llm/registry";
|
|
|
24
24
|
const fingerprint = (value: unknown): string =>
|
|
25
25
|
sha256Text(canonicalVerifierJson(value));
|
|
26
26
|
|
|
27
|
-
const
|
|
28
|
-
|
|
27
|
+
export const contextRuntimeConfigFingerprint = (
|
|
28
|
+
deps: Pick<ContextCapsuleRuntimeDeps, "config">
|
|
29
|
+
): string => fingerprint(deps.config);
|
|
29
30
|
|
|
30
31
|
const configuredContextFingerprint = (
|
|
31
32
|
deps: ContextCapsuleRuntimeDeps
|
|
@@ -75,7 +76,7 @@ const capsuleCapabilityStates = (
|
|
|
75
76
|
["embedding_unavailable"]
|
|
76
77
|
),
|
|
77
78
|
reranking: capabilityState(
|
|
78
|
-
input.depthPolicy !== "fast",
|
|
79
|
+
input.depthPolicy !== "fast" && !input.noRerank,
|
|
79
80
|
draft.retrieval.reranked,
|
|
80
81
|
["reranking_unavailable"]
|
|
81
82
|
),
|
|
@@ -191,10 +192,14 @@ export const projectContextCapsule = (
|
|
|
191
192
|
request: {
|
|
192
193
|
author: input.author,
|
|
193
194
|
lang: input.lang,
|
|
195
|
+
intent: input.intent,
|
|
196
|
+
exclude: input.exclude,
|
|
197
|
+
minScore: input.minScore,
|
|
194
198
|
queryModes: input.queryModes,
|
|
195
199
|
limit: input.limit,
|
|
196
200
|
candidateLimit: input.candidateLimit,
|
|
197
201
|
graphRequested: input.graph,
|
|
202
|
+
rerankRequested: input.depthPolicy !== "fast" && !input.noRerank,
|
|
198
203
|
},
|
|
199
204
|
capabilityStates,
|
|
200
205
|
indexSnapshot: {
|
|
@@ -221,7 +226,7 @@ export const projectContextCapsule = (
|
|
|
221
226
|
: null,
|
|
222
227
|
},
|
|
223
228
|
fingerprints: {
|
|
224
|
-
config:
|
|
229
|
+
config: contextRuntimeConfigFingerprint(deps),
|
|
225
230
|
retrieval: retrievalFingerprint(base, snapshots.contextFingerprint),
|
|
226
231
|
embeddingModel: capabilities.semanticSearch
|
|
227
232
|
? sha256Text(deps.embedPort?.modelUri ?? "")
|
|
@@ -292,7 +297,7 @@ export const currentContextFingerprints = (
|
|
|
292
297
|
capsule: ContextCapsuleV1,
|
|
293
298
|
deps: ContextCapsuleRuntimeDeps
|
|
294
299
|
) => ({
|
|
295
|
-
config:
|
|
300
|
+
config: contextRuntimeConfigFingerprint(deps),
|
|
296
301
|
retrieval: retrievalFingerprint(capsule, configuredContextFingerprint(deps)),
|
|
297
302
|
embeddingModel: capsule.capabilities.semanticSearch
|
|
298
303
|
? sha256Text(
|