@gmickel/gno 2.4.0 → 2.5.1

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.
Files changed (58) hide show
  1. package/README.md +10 -2
  2. package/assets/skill/SKILL.md +23 -0
  3. package/assets/skill/cli-reference.md +17 -0
  4. package/assets/skill/examples.md +15 -0
  5. package/assets/skill/mcp-reference.md +10 -0
  6. package/assets/spa-production.json.gz +0 -0
  7. package/browser-extension/artifacts/{gno-browser-clipper-v2.4.0.zip → gno-browser-clipper-v2.5.1.zip} +0 -0
  8. package/browser-extension/artifacts/gno-browser-clipper-v2.5.1.zip.sha256 +1 -0
  9. package/browser-extension/dist/manifest.json +1 -1
  10. package/package.json +1 -1
  11. package/spec/cli.md +11 -0
  12. package/spec/compiled-context.md +68 -0
  13. package/spec/mcp.md +25 -0
  14. package/spec/output-schemas/compiled-context-check.schema.json +44 -0
  15. package/spec/output-schemas/compiled-context-file.schema.json +165 -0
  16. package/spec/output-schemas/compiled-context-preview.schema.json +142 -0
  17. package/src/app/compiled-context-files.ts +361 -0
  18. package/src/app/compiled-context.ts +240 -0
  19. package/src/app/context-surface.ts +7 -2
  20. package/src/cli/commands/audit.ts +4 -0
  21. package/src/cli/commands/context-compiled.ts +136 -0
  22. package/src/cli/errors.ts +10 -3
  23. package/src/cli/program.ts +70 -0
  24. package/src/core/compiled-context.ts +254 -0
  25. package/src/core/context-budget.ts +2 -10
  26. package/src/core/file-lock.ts +22 -5
  27. package/src/core/folder-setup-planning.ts +2 -1
  28. package/src/core/network-boundary-inventory.ts +8 -0
  29. package/src/core/setup-receipt.ts +27 -20
  30. package/src/core/typed-metadata.ts +4 -0
  31. package/src/core/validation.ts +9 -2
  32. package/src/core/windows-private-path.ts +96 -0
  33. package/src/index.ts +2 -2
  34. package/src/ingestion/compiled-context.ts +15 -0
  35. package/src/ingestion/sync.ts +40 -8
  36. package/src/ingestion/walker.ts +5 -4
  37. package/src/llm/nodeLlamaCpp/simulator-install.ts +6 -2
  38. package/src/mcp/http-egress.ts +11 -3
  39. package/src/mcp/retrieval-warnings.ts +24 -0
  40. package/src/mcp/tools/ask.ts +14 -1
  41. package/src/mcp/tools/context.ts +46 -2
  42. package/src/mcp/tools/index.ts +53 -7
  43. package/src/mcp/tools/query.ts +3 -1
  44. package/src/mcp/tools/search.ts +3 -1
  45. package/src/mcp/tools/vsearch.ts +3 -1
  46. package/src/sdk/client.ts +72 -5
  47. package/src/sdk/index.ts +7 -0
  48. package/src/sdk/types.ts +28 -1
  49. package/src/serve/compiled-context.ts +84 -0
  50. package/src/serve/public/app.tsx +11 -0
  51. package/src/serve/public/globals.built.css +1 -1
  52. package/src/serve/public/lib/workspace-tabs.ts +2 -0
  53. package/src/serve/public/pages/CompiledContext.tsx +364 -0
  54. package/src/serve/public/pages/Dashboard.tsx +7 -0
  55. package/src/serve/server.ts +43 -2
  56. package/src/serve/spa-production-build.ts +6 -5
  57. package/src/store/sqlite/adapter.ts +14 -1
  58. package/browser-extension/artifacts/gno-browser-clipper-v2.4.0.zip.sha256 +0 -1
package/src/sdk/client.ts CHANGED
@@ -1,13 +1,16 @@
1
+ import { mkdir } from "node:fs/promises";
2
+ import { dirname } from "node:path";
3
+
4
+ import type { Config } from "../config/types";
1
5
  /**
2
6
  * GNO SDK client.
3
7
  *
4
8
  * @module src/sdk/client
5
9
  */
6
-
7
- import { mkdir } from "node:fs/promises";
8
- import { dirname } from "node:path";
9
-
10
- import type { Config } from "../config/types";
10
+ import type {
11
+ CompiledContextPreviewInput,
12
+ CompiledContextCheckInput,
13
+ } from "../core/compiled-context";
11
14
  import type { DownloadPolicy } from "../llm/policy";
12
15
  import type { EmbeddingPort, GenerationPort, RerankPort } from "../llm/types";
13
16
  import type { AskResult, SearchResults } from "../pipeline/types";
@@ -59,6 +62,15 @@ import type {
59
62
  SectionTargetV1,
60
63
  } from "./types";
61
64
 
65
+ import {
66
+ previewCompiledContext,
67
+ checkCompiledContext,
68
+ } from "../app/compiled-context";
69
+ import {
70
+ compileContextFile,
71
+ checkContextFile,
72
+ refreshContextFile,
73
+ } from "../app/compiled-context-files";
62
74
  import {
63
75
  decorateUriForIndex,
64
76
  DEFAULT_INDEX_NAME,
@@ -1255,6 +1267,61 @@ class GnoClientImpl implements GnoClient {
1255
1267
  }
1256
1268
  }
1257
1269
 
1270
+ compiledContextPreview(
1271
+ input: CompiledContextPreviewInput
1272
+ ): ReturnType<typeof previewCompiledContext> {
1273
+ this.assertOpen();
1274
+ return previewCompiledContext(input, {
1275
+ store: this.store,
1276
+ config: this.config,
1277
+ indexName: this.indexName,
1278
+ });
1279
+ }
1280
+
1281
+ compiledContextCheck(
1282
+ input: CompiledContextCheckInput
1283
+ ): ReturnType<typeof checkCompiledContext> {
1284
+ this.assertOpen();
1285
+ return checkCompiledContext(input, {
1286
+ store: this.store,
1287
+ config: this.config,
1288
+ indexName: this.indexName,
1289
+ });
1290
+ }
1291
+
1292
+ compileContextFile(
1293
+ input: Parameters<typeof compileContextFile>[0]
1294
+ ): ReturnType<typeof compileContextFile> {
1295
+ this.assertOpen();
1296
+ return compileContextFile(input, {
1297
+ store: this.store,
1298
+ config: this.config,
1299
+ indexName: this.indexName,
1300
+ });
1301
+ }
1302
+
1303
+ checkContextFile(
1304
+ input: Parameters<typeof checkContextFile>[0]
1305
+ ): ReturnType<typeof checkContextFile> {
1306
+ this.assertOpen();
1307
+ return checkContextFile(input, {
1308
+ store: this.store,
1309
+ config: this.config,
1310
+ indexName: this.indexName,
1311
+ });
1312
+ }
1313
+
1314
+ refreshContextFile(
1315
+ input: Parameters<typeof refreshContextFile>[0]
1316
+ ): ReturnType<typeof refreshContextFile> {
1317
+ this.assertOpen();
1318
+ return refreshContextFile(
1319
+ input,
1320
+ { store: this.store, config: this.config, indexName: this.indexName },
1321
+ (request) => this.context(request)
1322
+ );
1323
+ }
1324
+
1258
1325
  async verifyContext(
1259
1326
  capsule: GnoContextResult
1260
1327
  ): Promise<GnoContextVerificationResult> {
package/src/sdk/index.ts CHANGED
@@ -128,3 +128,10 @@ export type {
128
128
  RetrievalTracePurgeResult,
129
129
  RetrievalTraceSummary,
130
130
  } from "../core/retrieval-trace-management";
131
+
132
+ export type {
133
+ CompiledContextPreviewInput,
134
+ CompiledContextCheckInput,
135
+ CompiledContextPreview,
136
+ CompiledContextCheck,
137
+ } from "../core/compiled-context";
package/src/sdk/types.ts CHANGED
@@ -1,9 +1,17 @@
1
+ import type {
2
+ previewCompiledContext,
3
+ checkCompiledContext,
4
+ } from "../app/compiled-context";
5
+ import type {
6
+ compileContextFile,
7
+ checkContextFile,
8
+ refreshContextFile,
9
+ } from "../app/compiled-context-files";
1
10
  /**
2
11
  * Public SDK types.
3
12
  *
4
13
  * @module src/sdk/types
5
14
  */
6
-
7
15
  import type {
8
16
  ContextCapsuleBuildInput,
9
17
  ContextRuntimeErrorCode,
@@ -18,6 +26,10 @@ import type {
18
26
  CollectionEgressPolicyState,
19
27
  EgressRelaxationConfirmation,
20
28
  } from "../core/collection-egress-policy-service";
29
+ import type {
30
+ CompiledContextPreviewInput,
31
+ CompiledContextCheckInput,
32
+ } from "../core/compiled-context";
21
33
  import type {
22
34
  ContextCapsuleErrorCode,
23
35
  ContextCapsuleV1,
@@ -328,6 +340,21 @@ export interface GnoClient {
328
340
  query(query: string, options?: GnoQueryOptions): Promise<SearchResults>;
329
341
  ask(query: string, options?: GnoAskOptions): Promise<AskResult>;
330
342
  context(input: GnoContextInput): Promise<GnoContextResult>;
343
+ compiledContextPreview(
344
+ input: CompiledContextPreviewInput
345
+ ): ReturnType<typeof previewCompiledContext>;
346
+ compiledContextCheck(
347
+ input: CompiledContextCheckInput
348
+ ): ReturnType<typeof checkCompiledContext>;
349
+ compileContextFile(
350
+ input: Parameters<typeof compileContextFile>[0]
351
+ ): ReturnType<typeof compileContextFile>;
352
+ checkContextFile(
353
+ input: Parameters<typeof checkContextFile>[0]
354
+ ): ReturnType<typeof checkContextFile>;
355
+ refreshContextFile(
356
+ input: Parameters<typeof refreshContextFile>[0]
357
+ ): ReturnType<typeof refreshContextFile>;
331
358
  verifyContext(
332
359
  capsule: ContextCapsuleV1
333
360
  ): Promise<GnoContextVerificationResult>;
@@ -0,0 +1,84 @@
1
+ import type { ServerContext } from "./context";
2
+
3
+ /** Read-only compiled context adapters; caller authority comes from the socket. */
4
+ import {
5
+ previewCompiledContext,
6
+ checkCompiledContext,
7
+ } from "../app/compiled-context";
8
+ import {
9
+ compiledContextPreviewInputSchema,
10
+ compiledContextCheckInputSchema,
11
+ } from "../core/compiled-context";
12
+ import {
13
+ isLocalClientRequest,
14
+ type RequestPeerServer,
15
+ } from "./request-locality";
16
+
17
+ export async function handleCompiledContext(
18
+ context: ServerContext,
19
+ request: Request,
20
+ server: RequestPeerServer | undefined,
21
+ operation: "preview" | "check"
22
+ ): Promise<Response> {
23
+ try {
24
+ // Bound bytes before JSON parsing, even when Content-Length is absent.
25
+ const reader = request.body?.getReader();
26
+ if (!reader)
27
+ return Response.json(
28
+ { error: { code: "invalid_input", message: "JSON body required" } },
29
+ { status: 400 }
30
+ );
31
+ const chunks: Uint8Array[] = [];
32
+ let size = 0;
33
+ while (true) {
34
+ const part = await reader.read();
35
+ if (part.done) break;
36
+ size += part.value.byteLength;
37
+ if (size > 8 * 1024 * 1024 + 65536) {
38
+ await reader.cancel();
39
+ return Response.json(
40
+ {
41
+ error: {
42
+ code: "invalid_input",
43
+ message: "Compiled context request exceeds byte limit",
44
+ },
45
+ },
46
+ { status: 413 }
47
+ );
48
+ }
49
+ chunks.push(part.value);
50
+ }
51
+ const raw: unknown = JSON.parse(
52
+ await new Blob(chunks.map((chunk) => new Uint8Array(chunk))).text()
53
+ );
54
+ const input =
55
+ operation === "preview"
56
+ ? compiledContextPreviewInputSchema.parse(raw)
57
+ : compiledContextCheckInputSchema.parse(raw);
58
+ const local = isLocalClientRequest(request, server);
59
+ const deps = {
60
+ store: context.store,
61
+ config: context.config,
62
+ indexName: context.indexName,
63
+ destinationZone: local ? ("local_process" as const) : ("remote" as const),
64
+ caller: { authenticated: local, operationAuthorized: true },
65
+ };
66
+ const result =
67
+ operation === "preview"
68
+ ? await previewCompiledContext(input, deps)
69
+ : await checkCompiledContext(input, deps);
70
+ return Response.json(result);
71
+ } catch {
72
+ // Supplied Capsules may contain private metadata; errors never echo inputs.
73
+ return Response.json(
74
+ {
75
+ error: {
76
+ code: "compiled_context_unavailable",
77
+ message:
78
+ "Compiled context is invalid, stale, or unavailable for this caller",
79
+ },
80
+ },
81
+ { status: 400 }
82
+ );
83
+ }
84
+ }
@@ -47,6 +47,7 @@ const Collections = lazy(() => import("./pages/Collections"));
47
47
  const Connectors = lazy(() => import("./pages/Connectors"));
48
48
  const Ask = lazy(() => import("./pages/Ask"));
49
49
  const GraphView = lazy(() => import("./pages/GraphView"));
50
+ const CompiledContext = lazy(() => import("./pages/CompiledContext"));
50
51
  const TraceHistory = lazy(() => import("./pages/TraceHistory"));
51
52
 
52
53
  type Route =
@@ -59,6 +60,7 @@ type Route =
59
60
  | "/collections"
60
61
  | "/graph"
61
62
  | "/connectors"
63
+ | "/context/compiled"
62
64
  | "/traces";
63
65
  type Navigate = (to: string | number) => void;
64
66
 
@@ -78,6 +80,7 @@ const routes: Record<Route, React.ComponentType<RoutePageProps>> = {
78
80
  "/ask": Ask,
79
81
  "/graph": GraphView,
80
82
  "/traces": TraceHistory,
83
+ "/context/compiled": CompiledContext,
81
84
  };
82
85
 
83
86
  interface AppContentProps {
@@ -196,6 +199,14 @@ function AppContent({
196
199
  Trace history
197
200
  </button>
198
201
  <span className="text-border/30">—</span>
202
+ <button
203
+ className="transition-colors duration-300 hover:text-primary"
204
+ onClick={() => navigate("/context/compiled")}
205
+ type="button"
206
+ >
207
+ Compiled context
208
+ </button>
209
+ <span className="text-border/30">—</span>
199
210
  <a
200
211
  className="transition-colors duration-300 hover:text-primary"
201
212
  href="https://github.com/gmickel/gno"