@jinn-network/jinn-layer 0.1.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.
Files changed (131) hide show
  1. package/dist/adapters/contribution-adapter.d.ts +18 -0
  2. package/dist/adapters/contribution-adapter.js +134 -0
  3. package/dist/adapters/corpus-adapter.d.ts +12 -0
  4. package/dist/adapters/corpus-adapter.js +212 -0
  5. package/dist/adapters/index.d.ts +17 -0
  6. package/dist/adapters/index.js +17 -0
  7. package/dist/adapters/json-map-store.d.ts +4 -0
  8. package/dist/adapters/json-map-store.js +31 -0
  9. package/dist/adapters/local-learning-adapter.d.ts +25 -0
  10. package/dist/adapters/local-learning-adapter.js +49 -0
  11. package/dist/adapters/skills-adapter.d.ts +8 -0
  12. package/dist/adapters/skills-adapter.js +55 -0
  13. package/dist/admission-policy.d.ts +38 -0
  14. package/dist/admission-policy.js +17 -0
  15. package/dist/bin/jinn-distill-mcp.d.ts +2 -0
  16. package/dist/bin/jinn-distill-mcp.js +10 -0
  17. package/dist/bin/jinn-layer.d.ts +7 -0
  18. package/dist/bin/jinn-layer.js +15 -0
  19. package/dist/bridge-fetch-evidence.d.ts +102 -0
  20. package/dist/bridge-fetch-evidence.js +677 -0
  21. package/dist/bridge-verdict-source.d.ts +47 -0
  22. package/dist/bridge-verdict-source.js +216 -0
  23. package/dist/bridge.d.ts +247 -0
  24. package/dist/bridge.js +439 -0
  25. package/dist/capture.d.ts +98 -0
  26. package/dist/capture.js +617 -0
  27. package/dist/cli.d.ts +148 -0
  28. package/dist/cli.js +2221 -0
  29. package/dist/cluster-selection.d.ts +34 -0
  30. package/dist/cluster-selection.js +135 -0
  31. package/dist/cluster.d.ts +89 -0
  32. package/dist/cluster.js +142 -0
  33. package/dist/consume.d.ts +139 -0
  34. package/dist/consume.js +280 -0
  35. package/dist/corpus-probes.d.ts +61 -0
  36. package/dist/corpus-probes.js +120 -0
  37. package/dist/corpus-store.d.ts +16 -0
  38. package/dist/corpus-store.js +101 -0
  39. package/dist/distill-captures.d.ts +56 -0
  40. package/dist/distill-captures.js +283 -0
  41. package/dist/distill-feedback.d.ts +20 -0
  42. package/dist/distill-feedback.js +30 -0
  43. package/dist/distill-llm.d.ts +138 -0
  44. package/dist/distill-llm.js +438 -0
  45. package/dist/distill-mcp-server.d.ts +30 -0
  46. package/dist/distill-mcp-server.js +281 -0
  47. package/dist/distill-mode.d.ts +62 -0
  48. package/dist/distill-mode.js +107 -0
  49. package/dist/distill-progress.d.ts +78 -0
  50. package/dist/distill-progress.js +69 -0
  51. package/dist/distill-prompt.d.ts +34 -0
  52. package/dist/distill-prompt.js +85 -0
  53. package/dist/distill-render.d.ts +123 -0
  54. package/dist/distill-render.js +303 -0
  55. package/dist/distill-runs.d.ts +28 -0
  56. package/dist/distill-runs.js +39 -0
  57. package/dist/distill-traces.d.ts +67 -0
  58. package/dist/distill-traces.js +211 -0
  59. package/dist/distill.d.ts +180 -0
  60. package/dist/distill.js +337 -0
  61. package/dist/distiller.d.ts +118 -0
  62. package/dist/distiller.js +142 -0
  63. package/dist/envelope.d.ts +9 -0
  64. package/dist/envelope.js +9 -0
  65. package/dist/eval-prep.d.ts +129 -0
  66. package/dist/eval-prep.js +523 -0
  67. package/dist/execution-publish.d.ts +62 -0
  68. package/dist/execution-publish.js +72 -0
  69. package/dist/gate.d.ts +39 -0
  70. package/dist/gate.js +106 -0
  71. package/dist/index.d.ts +49 -0
  72. package/dist/index.js +50 -0
  73. package/dist/ipfs-cid.d.ts +18 -0
  74. package/dist/ipfs-cid.js +149 -0
  75. package/dist/layer-default.d.ts +3 -0
  76. package/dist/layer-default.js +10 -0
  77. package/dist/ledger.d.ts +62 -0
  78. package/dist/ledger.js +104 -0
  79. package/dist/measurement.d.ts +90 -0
  80. package/dist/measurement.js +134 -0
  81. package/dist/path-safety.d.ts +19 -0
  82. package/dist/path-safety.js +303 -0
  83. package/dist/pipeline.d.ts +94 -0
  84. package/dist/pipeline.js +124 -0
  85. package/dist/plugin-wiring.d.ts +4 -0
  86. package/dist/plugin-wiring.js +54 -0
  87. package/dist/preview.d.ts +31 -0
  88. package/dist/preview.js +28 -0
  89. package/dist/process-contract.d.ts +303 -0
  90. package/dist/process-contract.js +118 -0
  91. package/dist/publish-skill.d.ts +86 -0
  92. package/dist/publish-skill.js +116 -0
  93. package/dist/publish.d.ts +294 -0
  94. package/dist/publish.js +1090 -0
  95. package/dist/scripts/scan-skills-registry.d.ts +24 -0
  96. package/dist/scripts/scan-skills-registry.js +207 -0
  97. package/dist/seed-import/curated-batch.d.ts +36 -0
  98. package/dist/seed-import/curated-batch.js +103 -0
  99. package/dist/seed-import/episode-execute.d.ts +50 -0
  100. package/dist/seed-import/episode-execute.js +235 -0
  101. package/dist/seed-import/episode-fetch.d.ts +119 -0
  102. package/dist/seed-import/episode-fetch.js +137 -0
  103. package/dist/seed-import/episode-plan.d.ts +11 -0
  104. package/dist/seed-import/episode-plan.js +27 -0
  105. package/dist/seed-import/episode-report.d.ts +39 -0
  106. package/dist/seed-import/episode-report.js +36 -0
  107. package/dist/seed-import/execute.d.ts +61 -0
  108. package/dist/seed-import/execute.js +245 -0
  109. package/dist/seed-import/fetch.d.ts +62 -0
  110. package/dist/seed-import/fetch.js +82 -0
  111. package/dist/seed-import/licence.d.ts +17 -0
  112. package/dist/seed-import/licence.js +36 -0
  113. package/dist/seed-import/plan.d.ts +10 -0
  114. package/dist/seed-import/plan.js +21 -0
  115. package/dist/seed-import/report.d.ts +34 -0
  116. package/dist/seed-import/report.js +31 -0
  117. package/dist/seed-import/state.d.ts +72 -0
  118. package/dist/seed-import/state.js +120 -0
  119. package/dist/signal.d.ts +36 -0
  120. package/dist/signal.js +48 -0
  121. package/dist/signing.d.ts +8 -0
  122. package/dist/signing.js +21 -0
  123. package/dist/skill-package.d.ts +70 -0
  124. package/dist/skill-package.js +141 -0
  125. package/dist/skill.d.ts +21 -0
  126. package/dist/skill.js +77 -0
  127. package/dist/snapshot-transcript.d.ts +54 -0
  128. package/dist/snapshot-transcript.js +117 -0
  129. package/dist/three-arm-run.d.ts +27 -0
  130. package/dist/three-arm-run.js +41 -0
  131. package/package.json +60 -0
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * jinn-layer CLI entry. Delegates to cli.ts.
4
+ *
5
+ * Run from an installed package: `jinn-layer corpus search "<query>"`.
6
+ */
7
+ export {};
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * jinn-layer CLI entry. Delegates to cli.ts.
4
+ *
5
+ * Run from an installed package: `jinn-layer corpus search "<query>"`.
6
+ */
7
+ import { runJinnLayerCli } from '../cli.js';
8
+ runJinnLayerCli(process.argv.slice(2))
9
+ .then((code) => {
10
+ process.exitCode = code;
11
+ })
12
+ .catch((err) => {
13
+ console.error(`[jinn-layer] ${err instanceof Error ? err.message : String(err)}`);
14
+ process.exitCode = 1;
15
+ });
@@ -0,0 +1,102 @@
1
+ /**
2
+ * The bridge's `fetchEvidence` adapter (spec/2026-07-06-distillation-v1.md §8, D5).
3
+ *
4
+ * Implements the VERIFIED verdict→solution join that reaches
5
+ * the SOLVER's coding patch — the reference implementation is `fetchEvidence` in
6
+ * client/scripts/distill-run-live.ts:
7
+ *
8
+ * verdict(ref.requestId, ref.chainId) → authoritative (taskId, attemptIndex, evaluator)
9
+ * + bounded verdictEnvelopeMeta candidates → historical publisher,
10
+ * participant, signed-hash, request, and polarity binding
11
+ * → authenticated evaluation wrapper → signed original task CID
12
+ * → TaskCreated task-CID / creator / manifest commitments
13
+ * → authenticated original task (description + verifier facts)
14
+ * → attempt(taskId, attemptIndex, chainId) → the SOLVE request
15
+ * → bounded attemptEnvelopeMeta candidates → publisher + signed-hash binding
16
+ * → authenticated solution envelope (IPFS) → .payload.patch (the coding diff)
17
+ * problem statement = authenticated original task description
18
+ * typed history (hop 4, best-effort, #1472/#1473) = the solution's system_snapshot
19
+ * artifact → donation unwrap → gunzip+untar → the harness stdout
20
+ * transcript → canonical core stream parser → typed trajectory spans
21
+ *
22
+ * The predecessor selected the solution with the task document's mutable
23
+ * `restorationRequestId`. That allowed an otherwise-valid signed task to be
24
+ * relabelled onto another solution. The selection path now comes exclusively
25
+ * from chain-indexed verdict + attempt rows. Any outer task copy is only a
26
+ * consistency assertion and can never select the patch.
27
+ *
28
+ * All I/O and authentication boundaries are injected ports so this stays
29
+ * unit-testable. Production uses the Autonolas gateway, Ponder GraphQL,
30
+ * canonical envelope verification, and an IdentityRegistry wallet read; tests
31
+ * inject fakes. The returned function is directly usable as
32
+ * `BridgeDeps.fetchEvidence`.
33
+ */
34
+ import { type AttemptRef, type BridgeEvidence } from './bridge.js';
35
+ export interface AuthenticatedExecutionEnvelope {
36
+ solverType: string;
37
+ role: 'solution' | 'verdict' | 'capture' | 'restoration';
38
+ task?: unknown;
39
+ participant: {
40
+ safeAddress: string;
41
+ agentEoa: string;
42
+ };
43
+ signature: {
44
+ hash: string;
45
+ signer: string;
46
+ sig: string;
47
+ algo: string;
48
+ };
49
+ payload: Record<string, unknown>;
50
+ executor?: unknown;
51
+ artifacts?: unknown[];
52
+ distributionClass?: 'open' | 'restricted-tos' | 'unknown';
53
+ }
54
+ export type ExecutionEnvelopeAuthenticator = (value: unknown, sourceName: string) => Promise<AuthenticatedExecutionEnvelope>;
55
+ export type PublisherSafeResolver = (chainId: number, publisherAgentId: string, publishedAtBlock: bigint) => Promise<string>;
56
+ export interface AuthenticatedTaskProvenance {
57
+ solverType: string;
58
+ instanceId: string;
59
+ repo: string;
60
+ baseCommit: string;
61
+ createdAt: number;
62
+ originalTaskCid: string;
63
+ creatorSafe: string;
64
+ manifestDigest: string;
65
+ description: string;
66
+ }
67
+ export interface AuthoritativeTaskBinding {
68
+ taskId: string;
69
+ chainId: number;
70
+ taskCidDigest: string;
71
+ manifestDigest: string;
72
+ creatorSafe: string;
73
+ evaluatorSafe: string;
74
+ }
75
+ export interface VerifierFacts {
76
+ failToPass: string[];
77
+ passToPass: string[];
78
+ evalSemanticsVersion: string;
79
+ task: AuthenticatedTaskProvenance;
80
+ }
81
+ export type VerifierFactsResolver = (taskDoc: unknown, expectedInstanceId: string, authority: AuthoritativeTaskBinding) => Promise<unknown>;
82
+ export interface EvidenceFetcherPorts {
83
+ /**
84
+ * Fetch + JSON-parse an IPFS object by CID (autonolas gateway in production).
85
+ * Callers that authenticate smaller artifacts may request a tighter ceiling.
86
+ */
87
+ ipfs: (cid: string, maxBytes?: number) => Promise<any>;
88
+ /** Run a GraphQL query against the Ponder indexer, returning `data`. */
89
+ gql: (query: string, variables?: Record<string, unknown>) => Promise<any>;
90
+ /** Parse and cryptographically authenticate one raw execution envelope. */
91
+ authenticateEnvelope: ExecutionEnvelopeAuthenticator;
92
+ /** Resolve the Safe owned by an ERC-8004 publisher agent at the event block. */
93
+ resolvePublisherSafe: PublisherSafeResolver;
94
+ /** Resolve one atomic, authenticated verifier proof for an identified SWE task. */
95
+ resolveVerifierFacts?: VerifierFactsResolver;
96
+ }
97
+ /**
98
+ * Build the bridge's `fetchEvidence`. Consumes injected `ipfs` / `gql` ports
99
+ * (fakes in tests; a gateway + indexer in production). Throws a clear error at
100
+ * each missing hop so a per-instance miss is diagnosable and skipped, not silent.
101
+ */
102
+ export declare function createEvidenceFetcher(ports: EvidenceFetcherPorts): (ref: AttemptRef) => Promise<BridgeEvidence>;