@jinn-network/client 0.1.3-canary.2d6b2676 → 0.1.3-canary.8e61ba74
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/dist/adapters/adapter.d.ts +15 -4
- package/dist/adapters/local/adapter.d.ts +9 -8
- package/dist/adapters/local/adapter.js +47 -74
- package/dist/adapters/local/adapter.js.map +1 -1
- package/dist/adapters/mech/adapter.d.ts +29 -13
- package/dist/adapters/mech/adapter.js +316 -311
- package/dist/adapters/mech/adapter.js.map +1 -1
- package/dist/adapters/mech/contracts.d.ts +62 -16
- package/dist/adapters/mech/contracts.js +226 -92
- package/dist/adapters/mech/contracts.js.map +1 -1
- package/dist/adapters/mech/safe-revert.js +0 -6
- package/dist/adapters/mech/safe-revert.js.map +1 -1
- package/dist/adapters/mech/types.d.ts +237 -84
- package/dist/adapters/mech/types.js +125 -50
- package/dist/adapters/mech/types.js.map +1 -1
- package/dist/agent/agent-ws.d.ts +1 -0
- package/dist/agent/agent-ws.js +13 -1
- package/dist/agent/agent-ws.js.map +1 -1
- package/dist/agent/operator-claude.js +4 -0
- package/dist/agent/operator-claude.js.map +1 -1
- package/dist/api/gather-status.d.ts +0 -1
- package/dist/api/gather-status.js +0 -1
- package/dist/api/gather-status.js.map +1 -1
- package/dist/api/setup-endpoints.d.ts +20 -0
- package/dist/api/setup-endpoints.js +110 -3
- package/dist/api/setup-endpoints.js.map +1 -1
- package/dist/build-info.json +4 -4
- package/dist/build-meta.json +1 -1
- package/dist/cli/commands/auth.js +6 -3
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/bootstrap.js +0 -1
- package/dist/cli/commands/bootstrap.js.map +1 -1
- package/dist/cli/commands/create.js +3 -3
- package/dist/cli/commands/doctor.js +4 -12
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/fleet-scale.js +0 -1
- package/dist/cli/commands/fleet-scale.js.map +1 -1
- package/dist/cli/commands/fund-requirements.js +0 -1
- package/dist/cli/commands/fund-requirements.js.map +1 -1
- package/dist/cli/commands/migrate-agent-id.js +0 -1
- package/dist/cli/commands/migrate-agent-id.js.map +1 -1
- package/dist/cli/commands/solver-nets.js +1 -1
- package/dist/cli/commands/solver-plugins.js +3 -1
- package/dist/cli/commands/solver-plugins.js.map +1 -1
- package/dist/cli/commands/tasks.js +20 -11
- package/dist/cli/commands/tasks.js.map +1 -1
- package/dist/cli/commands/version.js +0 -1
- package/dist/cli/commands/version.js.map +1 -1
- package/dist/cli/deployment-digest.js +0 -5
- package/dist/cli/deployment-digest.js.map +1 -1
- package/dist/cli/execution-context.js +0 -1
- package/dist/cli/execution-context.js.map +1 -1
- package/dist/cli/introspection-context.js +0 -1
- package/dist/cli/introspection-context.js.map +1 -1
- package/dist/config.d.ts +410 -22
- package/dist/config.js +41 -30
- package/dist/config.js.map +1 -1
- package/dist/daemon/creator.d.ts +3 -3
- package/dist/daemon/creator.js +3 -3
- package/dist/daemon/creator.js.map +1 -1
- package/dist/daemon/daemon.d.ts +3 -6
- package/dist/daemon/daemon.js +30 -9
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/daemon/jinn-claim-loop-canonical.d.ts +11 -11
- package/dist/daemon/jinn-claim-loop-canonical.js +17 -17
- package/dist/daemon/jinn-claim-loop-canonical.js.map +1 -1
- package/dist/daemon/jinn-claim-loop-mock.d.ts +4 -4
- package/dist/daemon/jinn-claim-loop-mock.js +7 -7
- package/dist/daemon/jinn-claim-loop-mock.js.map +1 -1
- package/dist/daemon/jinn-claim-loop.d.ts +4 -4
- package/dist/daemon/jinn-claim-loop.js +3 -3
- package/dist/dashboard/assets/{index-Bxlk5qpa.js → index-CaUOdCs6.js} +6 -6
- package/dist/dashboard/index.html +1 -1
- package/dist/earning/bootstrap.d.ts +0 -1
- package/dist/earning/bootstrap.js +0 -1
- package/dist/earning/bootstrap.js.map +1 -1
- package/dist/earning/contracts.d.ts +18 -20
- package/dist/earning/contracts.js +18 -29
- package/dist/earning/contracts.js.map +1 -1
- package/dist/earning/funding-plan.d.ts +0 -1
- package/dist/earning/funding-plan.js +0 -1
- package/dist/earning/funding-plan.js.map +1 -1
- package/dist/earning/migrate-agent-id.d.ts +0 -1
- package/dist/earning/migrate-agent-id.js +0 -1
- package/dist/earning/migrate-agent-id.js.map +1 -1
- package/dist/erc8004/reputation.d.ts +2 -2
- package/dist/erc8004/reputation.js +2 -2
- package/dist/events/types.d.ts +2 -2
- package/dist/harnesses/engine/delivery.d.ts +10 -6
- package/dist/harnesses/engine/delivery.js +10 -6
- package/dist/harnesses/engine/delivery.js.map +1 -1
- package/dist/harnesses/engine/engine.d.ts +16 -29
- package/dist/harnesses/engine/engine.js +67 -106
- package/dist/harnesses/engine/engine.js.map +1 -1
- package/dist/harnesses/engine/persistence.d.ts +5 -1
- package/dist/harnesses/engine/persistence.js +10 -2
- package/dist/harnesses/engine/persistence.js.map +1 -1
- package/dist/harnesses/external-impls/loader.d.ts +1 -1
- package/dist/harnesses/impls/claude-code-learner/types.d.ts +1 -1
- package/dist/harnesses/impls/claude-mcp-prediction/index.d.ts +1 -1
- package/dist/harnesses/impls/claude-mcp-prediction/index.js +6 -6
- package/dist/harnesses/impls/claude-mcp-prediction/types.d.ts +1 -1
- package/dist/harnesses/impls/claude-mcp-prediction/types.js +1 -1
- package/dist/harnesses/impls/index.js +5 -5
- package/dist/harnesses/impls/portfolio-v0-evaluator/index.js +1 -1
- package/dist/harnesses/impls/portfolio-v0-evaluator/index.js.map +1 -1
- package/dist/harnesses/impls/prediction-v0-baseline/index.d.ts +4 -4
- package/dist/harnesses/impls/prediction-v0-baseline/index.js +10 -10
- package/dist/harnesses/impls/prediction-v0-evaluator/canonical-metrics.d.ts +3 -3
- package/dist/harnesses/impls/prediction-v0-evaluator/checks/availability.d.ts +1 -1
- package/dist/harnesses/impls/prediction-v0-evaluator/index.d.ts +4 -4
- package/dist/harnesses/impls/prediction-v0-evaluator/index.js +11 -11
- package/dist/harnesses/impls/prediction-v1-baseline/index.d.ts +31 -0
- package/dist/harnesses/impls/prediction-v1-baseline/index.js +79 -0
- package/dist/harnesses/impls/prediction-v1-baseline/index.js.map +1 -0
- package/dist/harnesses/impls/prediction-v1-evaluator/index.d.ts +32 -0
- package/dist/harnesses/impls/prediction-v1-evaluator/index.js +198 -0
- package/dist/harnesses/impls/prediction-v1-evaluator/index.js.map +1 -0
- package/dist/harnesses/manifest/types.d.ts +1 -1
- package/dist/harnesses/manifest/types.js +1 -1
- package/dist/harnesses/types.d.ts +2 -1
- package/dist/harnesses/types.js.map +1 -1
- package/dist/main.js +2 -26
- package/dist/main.js.map +1 -1
- package/dist/mcp/operator-server.js +1 -1
- package/dist/mcp/operator-server.js.map +1 -1
- package/dist/mcp/server.js +2 -2
- package/dist/plugins/manifest.d.ts +1 -1
- package/dist/plugins/manifest.js +1 -1
- package/dist/plugins/manifest.js.map +1 -1
- package/dist/plugins/registry.js +1 -1
- package/dist/plugins/registry.js.map +1 -1
- package/dist/plugins/resolvers.js +2 -1
- package/dist/plugins/resolvers.js.map +1 -1
- package/dist/plugins/types.d.ts +4 -8
- package/dist/plugins/validator.js +5 -7
- package/dist/plugins/validator.js.map +1 -1
- package/dist/preflight/claude-auth.d.ts +3 -1
- package/dist/preflight/claude-auth.js +5 -5
- package/dist/preflight/claude-auth.js.map +1 -1
- package/dist/setup/claude-code-install.d.ts +19 -0
- package/dist/setup/claude-code-install.js +51 -0
- package/dist/setup/claude-code-install.js.map +1 -0
- package/dist/solver-nets/contracts.d.ts +2 -0
- package/dist/solver-nets/contracts.js +2 -0
- package/dist/solver-nets/contracts.js.map +1 -0
- package/dist/solver-nets/registry.d.ts +2 -0
- package/dist/solver-nets/registry.js +13 -5
- package/dist/solver-nets/registry.js.map +1 -1
- package/dist/solver-types/constants.d.ts +1 -1
- package/dist/solver-types/constants.js +1 -1
- package/dist/solver-types/index.d.ts +5 -5
- package/dist/solver-types/index.js +5 -5
- package/dist/solver-types/prediction-apy-v0-auto.js +12 -0
- package/dist/solver-types/prediction-apy-v0-auto.js.map +1 -1
- package/dist/solver-types/prediction-v0-auto.d.ts +4 -4
- package/dist/solver-types/prediction-v0-auto.js +22 -10
- package/dist/solver-types/prediction-v0-auto.js.map +1 -1
- package/dist/solver-types/prediction-v0-template.d.ts +10 -10
- package/dist/solver-types/prediction-v0-template.js +16 -16
- package/dist/solver-types/prediction-v0-template.js.map +1 -1
- package/dist/solver-types/prediction-v0.d.ts +2 -2
- package/dist/solver-types/prediction-v0.js +11 -11
- package/dist/solver-types/prediction-v1-auto.d.ts +22 -0
- package/dist/solver-types/prediction-v1-auto.js +211 -0
- package/dist/solver-types/prediction-v1-auto.js.map +1 -0
- package/dist/solver-types/prediction-v1.d.ts +3 -0
- package/dist/solver-types/prediction-v1.js +29 -0
- package/dist/solver-types/prediction-v1.js.map +1 -0
- package/dist/solver-types/solver-type.d.ts +5 -4
- package/dist/store/store.d.ts +4 -0
- package/dist/store/store.js +28 -4
- package/dist/store/store.js.map +1 -1
- package/dist/tasks/posting-service.d.ts +5 -2
- package/dist/tasks/posting-service.js +12 -6
- package/dist/tasks/posting-service.js.map +1 -1
- package/dist/tasks/sources.d.ts +2 -2
- package/dist/tasks/sources.js +10 -7
- package/dist/tasks/sources.js.map +1 -1
- package/dist/templates/harnesses/alternative-harness/package.json.tmpl +1 -1
- package/dist/templates/harnesses/alternative-harness/src/coordinator.ts.tmpl +1 -1
- package/dist/templates/harnesses/alternative-harness/src/index.ts.tmpl +1 -1
- package/dist/templates/harnesses/alternative-harness/src/mock-harness.ts.tmpl +1 -1
- package/dist/templates/harnesses/alternative-harness/src/phases/debrief.ts.tmpl +1 -1
- package/dist/templates/harnesses/alternative-harness/src/phases/execute.ts.tmpl +1 -1
- package/dist/templates/harnesses/alternative-harness/src/phases/improve.ts.tmpl +1 -1
- package/dist/templates/harnesses/alternative-harness/src/phases/memory.ts.tmpl +1 -1
- package/dist/templates/harnesses/alternative-harness/src/phases/orient.ts.tmpl +1 -1
- package/dist/templates/harnesses/alternative-harness/src/phases/plan.ts.tmpl +1 -1
- package/dist/templates/harnesses/alternative-harness/src/phases/strategize.ts.tmpl +1 -1
- package/dist/templates/harnesses/alternative-harness/test/coordinator.test.ts.tmpl +1 -1
- package/dist/templates/harnesses/alternative-harness/test/unit.test.ts.tmpl +1 -1
- package/dist/templates/harnesses/evaluator/package.json.tmpl +1 -1
- package/dist/templates/harnesses/evaluator/src/index.ts.tmpl +1 -1
- package/dist/templates/harnesses/evaluator/test/unit.test.ts.tmpl +1 -1
- package/dist/templates/harnesses/forecaster/package.json.tmpl +1 -1
- package/dist/templates/harnesses/forecaster/src/index.ts.tmpl +1 -1
- package/dist/templates/harnesses/forecaster/test/unit.test.ts.tmpl +1 -1
- package/dist/trajectory/schema.d.ts +10 -10
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/payloads/index.d.ts +1 -0
- package/dist/types/payloads/index.js +6 -0
- package/dist/types/payloads/index.js.map +1 -1
- package/dist/types/payloads/prediction-v1.d.ts +2 -0
- package/dist/types/payloads/prediction-v1.js +2 -0
- package/dist/types/payloads/prediction-v1.js.map +1 -0
- package/dist/types/prediction-v1.d.ts +2 -0
- package/dist/types/prediction-v1.js +2 -0
- package/dist/types/prediction-v1.js.map +1 -0
- package/dist/types/prediction.d.ts +559 -19
- package/dist/types/prediction.js +12 -9
- package/dist/types/prediction.js.map +1 -1
- package/dist/types/task-document.d.ts +389 -0
- package/dist/types/task-document.js +11 -0
- package/dist/types/task-document.js.map +1 -1
- package/dist/types/task.d.ts +285 -1
- package/dist/types/task.js +6 -1
- package/dist/types/task.js.map +1 -1
- package/dist/vendor/@jinn-network/sdk/README.md +61 -0
- package/dist/vendor/@jinn-network/sdk/dist/capabilities.d.ts +52 -0
- package/dist/vendor/@jinn-network/sdk/dist/capabilities.js +1 -0
- package/dist/vendor/@jinn-network/sdk/dist/contracts.d.ts +105 -0
- package/dist/vendor/@jinn-network/sdk/dist/contracts.js +147 -0
- package/dist/vendor/@jinn-network/sdk/dist/harness.d.ts +69 -0
- package/dist/vendor/@jinn-network/sdk/dist/harness.js +1 -0
- package/dist/vendor/@jinn-network/sdk/dist/index.d.ts +2 -0
- package/dist/vendor/@jinn-network/sdk/dist/index.js +5 -0
- package/dist/vendor/@jinn-network/sdk/dist/manifest.d.ts +69 -0
- package/dist/vendor/@jinn-network/sdk/dist/manifest.js +3 -0
- package/dist/vendor/@jinn-network/sdk/dist/payloads/prediction-v1.d.ts +223 -0
- package/dist/vendor/@jinn-network/sdk/dist/payloads/prediction-v1.js +64 -0
- package/dist/vendor/@jinn-network/sdk/dist/plugins.d.ts +36 -0
- package/dist/vendor/@jinn-network/sdk/dist/plugins.js +54 -0
- package/dist/vendor/@jinn-network/sdk/dist/prediction-v1.d.ts +870 -0
- package/dist/vendor/@jinn-network/sdk/dist/prediction-v1.js +80 -0
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/index.d.ts +2 -0
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/index.js +1 -0
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/prediction-v1.d.ts +6 -0
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/prediction-v1.js +3 -0
- package/dist/vendor/@jinn-network/sdk/dist/types.d.ts +116 -0
- package/dist/vendor/@jinn-network/sdk/dist/types.js +21 -0
- package/dist/vendor/@jinn-network/sdk/package.json +34 -0
- package/dist/venues/polymarket/client.d.ts +77 -0
- package/dist/venues/polymarket/client.js +309 -0
- package/dist/venues/polymarket/client.js.map +1 -0
- package/dist/withdraw/run-withdraw-plan.js +0 -2
- package/dist/withdraw/run-withdraw-plan.js.map +1 -1
- package/package.json +8 -6
- package/plugins/jinn-prediction-plugin/.claude-plugin/plugin.json +13 -86
- package/plugins/jinn-prediction-plugin/.mcp.json +8 -0
- package/plugins/jinn-prediction-plugin/GEMINI.md +3 -0
- package/plugins/jinn-prediction-plugin/gemini-extension.json +13 -0
- package/plugins/jinn-prediction-plugin/jinn.plugin.json +23 -0
- package/plugins/jinn-prediction-plugin/schemas/prediction-v1-solution.schema.json +34 -0
- package/plugins/jinn-prediction-plugin/schemas/prediction-v1-task.schema.json +118 -0
- package/plugins/jinn-prediction-plugin/schemas/prediction-v1-verdict.schema.json +84 -0
- package/templates/harnesses/alternative-harness/package.json.tmpl +1 -1
- package/templates/harnesses/alternative-harness/src/coordinator.ts.tmpl +1 -1
- package/templates/harnesses/alternative-harness/src/index.ts.tmpl +1 -1
- package/templates/harnesses/alternative-harness/src/mock-harness.ts.tmpl +1 -1
- package/templates/harnesses/alternative-harness/src/phases/debrief.ts.tmpl +1 -1
- package/templates/harnesses/alternative-harness/src/phases/execute.ts.tmpl +1 -1
- package/templates/harnesses/alternative-harness/src/phases/improve.ts.tmpl +1 -1
- package/templates/harnesses/alternative-harness/src/phases/memory.ts.tmpl +1 -1
- package/templates/harnesses/alternative-harness/src/phases/orient.ts.tmpl +1 -1
- package/templates/harnesses/alternative-harness/src/phases/plan.ts.tmpl +1 -1
- package/templates/harnesses/alternative-harness/src/phases/strategize.ts.tmpl +1 -1
- package/templates/harnesses/alternative-harness/test/coordinator.test.ts.tmpl +1 -1
- package/templates/harnesses/alternative-harness/test/unit.test.ts.tmpl +1 -1
- package/templates/harnesses/evaluator/package.json.tmpl +1 -1
- package/templates/harnesses/evaluator/src/index.ts.tmpl +1 -1
- package/templates/harnesses/evaluator/test/unit.test.ts.tmpl +1 -1
- package/templates/harnesses/forecaster/package.json.tmpl +1 -1
- package/templates/harnesses/forecaster/src/index.ts.tmpl +1 -1
- package/templates/harnesses/forecaster/test/unit.test.ts.tmpl +1 -1
- package/dist/adapters/claim-registry/abi.d.ts +0 -127
- package/dist/adapters/claim-registry/abi.js +0 -93
- package/dist/adapters/claim-registry/abi.js.map +0 -1
- package/dist/adapters/claim-registry/client.d.ts +0 -98
- package/dist/adapters/claim-registry/client.js +0 -225
- package/dist/adapters/claim-registry/client.js.map +0 -1
- package/dist/adapters/mech/claim-policy.d.ts +0 -40
- package/dist/adapters/mech/claim-policy.js +0 -104
- package/dist/adapters/mech/claim-policy.js.map +0 -1
- package/dist/harnesses/engine/claim.d.ts +0 -69
- package/dist/harnesses/engine/claim.js +0 -111
- package/dist/harnesses/engine/claim.js.map +0 -1
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { PredictionV1TaskSchema } from './prediction-v1.js';
|
|
2
|
+
import { PredictionV1RestorationPayloadSchema, PredictionV1VerdictPayloadSchema, } from './payloads/prediction-v1.js';
|
|
3
|
+
export const PREDICTION_V1_SOLVER_NET_CONTRACT = {
|
|
4
|
+
name: 'Prediction',
|
|
5
|
+
solverType: 'prediction.v1',
|
|
6
|
+
schemas: {
|
|
7
|
+
task: PredictionV1TaskSchema,
|
|
8
|
+
solution: PredictionV1RestorationPayloadSchema,
|
|
9
|
+
verdict: PredictionV1VerdictPayloadSchema,
|
|
10
|
+
},
|
|
11
|
+
claimPolicyDefaults: {
|
|
12
|
+
mode: 'parallel',
|
|
13
|
+
maxClaims: 25,
|
|
14
|
+
maxClaimsPerOperator: 1,
|
|
15
|
+
claimLeaseTtlSeconds: 30 * 60,
|
|
16
|
+
},
|
|
17
|
+
credentialRequirements: {
|
|
18
|
+
creator: [
|
|
19
|
+
{
|
|
20
|
+
id: 'polymarket.public.market-data.read',
|
|
21
|
+
kind: 'public-api',
|
|
22
|
+
required: true,
|
|
23
|
+
description: 'Read public Polymarket market metadata and orderbook snapshots for Task creation.',
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
solver: [],
|
|
27
|
+
evaluator: [
|
|
28
|
+
{
|
|
29
|
+
id: 'polymarket.public.resolution.read',
|
|
30
|
+
kind: 'public-api',
|
|
31
|
+
required: true,
|
|
32
|
+
description: 'Read public Polymarket/UMA final market state for resolution mapping.',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
evaluationFunction: {
|
|
37
|
+
id: 'prediction.brier-loss.v1',
|
|
38
|
+
deterministic: true,
|
|
39
|
+
inputs: ['prediction.v1 Task', 'prediction.v1 Solution', 'Polymarket/UMA resolution'],
|
|
40
|
+
output: 'prediction.v1 Verdict',
|
|
41
|
+
implementation: 'client/src/harnesses/impls/prediction-v1-evaluator',
|
|
42
|
+
},
|
|
43
|
+
aggregationFunction: {
|
|
44
|
+
id: 'prediction.trailing-mean-brier-spread.v1',
|
|
45
|
+
deterministic: true,
|
|
46
|
+
inputs: ['SCORED prediction.v1 Verdicts'],
|
|
47
|
+
output: 'trailing mean brierSpread',
|
|
48
|
+
windowDays: 84,
|
|
49
|
+
},
|
|
50
|
+
referencePlugins: ['bundled:jinn-prediction-plugin'],
|
|
51
|
+
};
|
|
52
|
+
export const SOLVER_NET_CONTRACTS = {
|
|
53
|
+
'prediction.v1': PREDICTION_V1_SOLVER_NET_CONTRACT,
|
|
54
|
+
};
|
|
55
|
+
export function getSolverNetContract(solverType) {
|
|
56
|
+
return SOLVER_NET_CONTRACTS[solverType];
|
|
57
|
+
}
|
|
58
|
+
export class PayloadValidationException extends Error {
|
|
59
|
+
code;
|
|
60
|
+
issues;
|
|
61
|
+
constructor(code, message, issues = []) {
|
|
62
|
+
super(message);
|
|
63
|
+
this.name = 'PayloadValidationException';
|
|
64
|
+
this.code = code;
|
|
65
|
+
this.issues = issues;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function issuesFrom(error) {
|
|
69
|
+
return error.issues.map((issue) => ({
|
|
70
|
+
path: issue.path.length > 0 ? issue.path.join('.') : '<root>',
|
|
71
|
+
message: issue.message,
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
function getSchema(solverType, kind) {
|
|
75
|
+
return getSolverNetContract(solverType)?.schemas[kind];
|
|
76
|
+
}
|
|
77
|
+
function validateWithSchema(solverType, kind, value) {
|
|
78
|
+
const schema = getSchema(solverType, kind);
|
|
79
|
+
if (!schema) {
|
|
80
|
+
return {
|
|
81
|
+
ok: false,
|
|
82
|
+
error: {
|
|
83
|
+
code: 'unsupported_solver_type',
|
|
84
|
+
message: `Unsupported SolverType for ${kind} validation: ${solverType}`,
|
|
85
|
+
issues: [],
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
const parsed = schema.safeParse(value);
|
|
90
|
+
if (!parsed.success) {
|
|
91
|
+
const issues = issuesFrom(parsed.error);
|
|
92
|
+
return {
|
|
93
|
+
ok: false,
|
|
94
|
+
error: {
|
|
95
|
+
code: 'invalid_payload',
|
|
96
|
+
message: `${solverType} ${kind} failed validation: ${issues.map((issue) => `${issue.path}: ${issue.message}`).join('; ')}`,
|
|
97
|
+
issues,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return { ok: true, value: parsed.data };
|
|
102
|
+
}
|
|
103
|
+
function assertValid(result) {
|
|
104
|
+
if (result.ok)
|
|
105
|
+
return result.value;
|
|
106
|
+
throw new PayloadValidationException(result.error.code, result.error.message, result.error.issues);
|
|
107
|
+
}
|
|
108
|
+
export function validateTask(solverType, task) {
|
|
109
|
+
return validateWithSchema(solverType, 'task', task);
|
|
110
|
+
}
|
|
111
|
+
export function assertTask(solverType, task) {
|
|
112
|
+
return assertValid(validateTask(solverType, task));
|
|
113
|
+
}
|
|
114
|
+
export function validateSolutionPayload(solverType, payload) {
|
|
115
|
+
return validateWithSchema(solverType, 'solution', payload);
|
|
116
|
+
}
|
|
117
|
+
export function assertSolutionPayload(solverType, payload) {
|
|
118
|
+
return assertValid(validateSolutionPayload(solverType, payload));
|
|
119
|
+
}
|
|
120
|
+
export function validateVerdictPayload(solverType, payload) {
|
|
121
|
+
return validateWithSchema(solverType, 'verdict', payload);
|
|
122
|
+
}
|
|
123
|
+
export function assertVerdictPayload(solverType, payload) {
|
|
124
|
+
return assertValid(validateVerdictPayload(solverType, payload));
|
|
125
|
+
}
|
|
126
|
+
export function buildSolutionOutput(args) {
|
|
127
|
+
const payload = assertSolutionPayload(args.solverType, args.payload);
|
|
128
|
+
return {
|
|
129
|
+
venueRef: { name: args.venueName },
|
|
130
|
+
gating: args.gating ?? {},
|
|
131
|
+
...(args.informational ? { informational: args.informational } : {}),
|
|
132
|
+
solutionPayload: payload,
|
|
133
|
+
...(args.artifacts ? { artifacts: args.artifacts } : {}),
|
|
134
|
+
...(args.rationale ? { rationale: args.rationale } : {}),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
export function buildVerdictOutput(args) {
|
|
138
|
+
const payload = assertVerdictPayload(args.solverType, args.payload);
|
|
139
|
+
return {
|
|
140
|
+
venueRef: { name: args.venueName ?? 'jinn-evaluator' },
|
|
141
|
+
gating: args.gating ?? {},
|
|
142
|
+
...(args.informational ? { informational: args.informational } : {}),
|
|
143
|
+
verdictPayload: payload,
|
|
144
|
+
...(args.artifacts ? { artifacts: args.artifacts } : {}),
|
|
145
|
+
...(args.rationale ? { rationale: args.rationale } : {}),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export type { Address, Hex, IntentWindow, Task, OutputArtifact, RationaleEntry, Solution, TrajectoryCollector, TrajectorySpanInput, ReadyStatus, EnableArgDef, IntentEnableMetadata, EnableResult, } from './types.js';
|
|
2
|
+
export { REQUIRES_LIVE_DAEMON_READINESS, SkippableError } from './types.js';
|
|
3
|
+
export type { SignTypedDataArgs, SendAllowedCallArgs, ScopedSigner, ScopedRpc, ScopedSecrets, } from './capabilities.js';
|
|
4
|
+
export type { CapabilityAllowEntry, ManifestRpcAllow, ManifestSecretSpec, TypedDataAllowEntry, JinnManifest, } from './manifest.js';
|
|
5
|
+
import type { Task, Solution, TrajectoryCollector, ReadyStatus, IntentEnableMetadata, EnableResult } from './types.js';
|
|
6
|
+
import type { ScopedSigner, ScopedRpc, ScopedSecrets } from './capabilities.js';
|
|
7
|
+
export interface HarnessContext {
|
|
8
|
+
task: Task;
|
|
9
|
+
taskCid?: string;
|
|
10
|
+
implStateDir: string;
|
|
11
|
+
workingDir: string;
|
|
12
|
+
log: (event: {
|
|
13
|
+
level: 'info' | 'warn' | 'error';
|
|
14
|
+
msg: string;
|
|
15
|
+
data?: unknown;
|
|
16
|
+
}) => void;
|
|
17
|
+
abort: AbortSignal;
|
|
18
|
+
msUntilEndTs: () => number;
|
|
19
|
+
trajectory: TrajectoryCollector;
|
|
20
|
+
signer?: ScopedSigner;
|
|
21
|
+
rpc?: ScopedRpc;
|
|
22
|
+
secrets?: ScopedSecrets;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Construction-time environment passed to the impl factory.
|
|
26
|
+
* Per-attempt Task inputs are provided through HarnessContext.
|
|
27
|
+
*/
|
|
28
|
+
export interface ExternalHarnessEnv {
|
|
29
|
+
readonly implName: string;
|
|
30
|
+
readonly implVersion: string;
|
|
31
|
+
readonly network: string;
|
|
32
|
+
readonly implStateDir: string;
|
|
33
|
+
readonly secrets: ScopedSecrets;
|
|
34
|
+
readonly log: HarnessContext['log'];
|
|
35
|
+
/** True for CLI introspection; impls should report stub readiness. */
|
|
36
|
+
readonly stub: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface Harness {
|
|
39
|
+
name: string;
|
|
40
|
+
version: string;
|
|
41
|
+
supports(ctx: {
|
|
42
|
+
solverType: string;
|
|
43
|
+
role?: 'restoration' | 'evaluation';
|
|
44
|
+
}): boolean;
|
|
45
|
+
canAttempt?(task: Task): Promise<{
|
|
46
|
+
ok: true;
|
|
47
|
+
} | {
|
|
48
|
+
ok: false;
|
|
49
|
+
reason: string;
|
|
50
|
+
}>;
|
|
51
|
+
run(ctx: HarnessContext): Promise<Solution>;
|
|
52
|
+
isReady?(spec?: {
|
|
53
|
+
solverType: string;
|
|
54
|
+
role?: 'restoration' | 'evaluation';
|
|
55
|
+
}): Promise<ReadyStatus>;
|
|
56
|
+
enableMetadata?(): IntentEnableMetadata;
|
|
57
|
+
onEnable?(args: Record<string, string | undefined>, spec?: {
|
|
58
|
+
solverType: string;
|
|
59
|
+
role?: 'restoration' | 'evaluation';
|
|
60
|
+
}): Promise<EnableResult>;
|
|
61
|
+
onDisable?(spec?: {
|
|
62
|
+
solverType: string;
|
|
63
|
+
role?: 'restoration' | 'evaluation';
|
|
64
|
+
}): Promise<void>;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* External-impl factory: default-export shape for external Harness packages.
|
|
68
|
+
*/
|
|
69
|
+
export type ExternalHarnessFactory = (env: ExternalHarnessEnv) => Harness;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { REQUIRES_LIVE_DAEMON_READINESS, SkippableError } from './types.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export type { Address, Hex, IntentWindow, Task, OutputArtifact, RationaleEntry, Solution, TrajectoryCollector, TrajectorySpanInput, ReadyStatus, EnableArgDef, IntentEnableMetadata, EnableResult, } from './types.js';
|
|
2
|
+
export { REQUIRES_LIVE_DAEMON_READINESS, SkippableError } from './types.js';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export interface CapabilityAllowEntry {
|
|
2
|
+
chainId: number;
|
|
3
|
+
to: `0x${string}`;
|
|
4
|
+
selector: `0x${string}`;
|
|
5
|
+
description?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* EIP-712 typed-data domain allow-list entry.
|
|
9
|
+
*
|
|
10
|
+
* The daemon's scoped signer refuses any `signTypedData` call whose
|
|
11
|
+
* domain does not match one of these entries:
|
|
12
|
+
* - `chainId` MUST match exactly.
|
|
13
|
+
* - `verifyingContract` / `name` / `version` match only when set on
|
|
14
|
+
* the entry; an unset field on the entry means "any value".
|
|
15
|
+
* - An empty / omitted `typedDataDomains` array means default-deny:
|
|
16
|
+
* every `signTypedData` call throws.
|
|
17
|
+
*/
|
|
18
|
+
export interface TypedDataAllowEntry {
|
|
19
|
+
chainId: number;
|
|
20
|
+
name?: string;
|
|
21
|
+
version?: string;
|
|
22
|
+
verifyingContract?: `0x${string}`;
|
|
23
|
+
}
|
|
24
|
+
export interface ManifestRpcAllow {
|
|
25
|
+
chainId: number;
|
|
26
|
+
methods: ReadonlyArray<'eth_call' | 'eth_getBlockByNumber' | 'eth_getLogs' | 'eth_getTransactionReceipt' | 'eth_chainId' | 'eth_blockNumber' | 'eth_getBalance' | 'eth_getCode'>;
|
|
27
|
+
rateLimit?: {
|
|
28
|
+
perSec: number;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface ManifestSecretSpec {
|
|
32
|
+
name: string;
|
|
33
|
+
description: string;
|
|
34
|
+
required: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface JinnManifest {
|
|
37
|
+
schemaVersion: '1.0.0';
|
|
38
|
+
name: string;
|
|
39
|
+
version: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
/** Each entry follows `<domain>.v<major>(>=<semver>)` from spec/2026-05-schema-versioning.md. */
|
|
42
|
+
supportedSolverTypes: readonly string[];
|
|
43
|
+
/** Path to the entrypoint module, relative to the package root. */
|
|
44
|
+
entry: string;
|
|
45
|
+
/** Tarball CID + sha256 (set at publish time). */
|
|
46
|
+
package: {
|
|
47
|
+
cid: string;
|
|
48
|
+
hash: `sha256:${string}`;
|
|
49
|
+
};
|
|
50
|
+
capabilities: {
|
|
51
|
+
signer?: {
|
|
52
|
+
selectors: ReadonlyArray<CapabilityAllowEntry>;
|
|
53
|
+
typedDataDomains?: ReadonlyArray<TypedDataAllowEntry>;
|
|
54
|
+
};
|
|
55
|
+
rpc?: ReadonlyArray<ManifestRpcAllow>;
|
|
56
|
+
secrets?: ReadonlyArray<ManifestSecretSpec>;
|
|
57
|
+
};
|
|
58
|
+
/** Detached signature object — not part of the canonicalised manifest. */
|
|
59
|
+
signature: {
|
|
60
|
+
alg: 'ed25519';
|
|
61
|
+
publicKey: string;
|
|
62
|
+
sig: string;
|
|
63
|
+
};
|
|
64
|
+
author?: {
|
|
65
|
+
name: string;
|
|
66
|
+
url?: string;
|
|
67
|
+
};
|
|
68
|
+
license?: string;
|
|
69
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const PredictionV1RestorationPayloadSchema: z.ZodObject<{
|
|
3
|
+
probabilityYes: z.ZodString;
|
|
4
|
+
submittedAt: z.ZodString;
|
|
5
|
+
format: z.ZodLiteral<"decimal">;
|
|
6
|
+
modelId: z.ZodString;
|
|
7
|
+
confidence: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
8
|
+
methodology: z.ZodOptional<z.ZodString>;
|
|
9
|
+
evidenceCids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
10
|
+
reasoningCid: z.ZodOptional<z.ZodString>;
|
|
11
|
+
sourceRefs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
12
|
+
title: z.ZodString;
|
|
13
|
+
url: z.ZodString;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
url: string;
|
|
16
|
+
title: string;
|
|
17
|
+
}, {
|
|
18
|
+
url: string;
|
|
19
|
+
title: string;
|
|
20
|
+
}>, "many">>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
probabilityYes: string;
|
|
23
|
+
submittedAt: string;
|
|
24
|
+
format: "decimal";
|
|
25
|
+
modelId: string;
|
|
26
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
27
|
+
methodology?: string | undefined;
|
|
28
|
+
evidenceCids?: string[] | undefined;
|
|
29
|
+
reasoningCid?: string | undefined;
|
|
30
|
+
sourceRefs?: {
|
|
31
|
+
url: string;
|
|
32
|
+
title: string;
|
|
33
|
+
}[] | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
probabilityYes: string;
|
|
36
|
+
submittedAt: string;
|
|
37
|
+
format: "decimal";
|
|
38
|
+
modelId: string;
|
|
39
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
40
|
+
methodology?: string | undefined;
|
|
41
|
+
evidenceCids?: string[] | undefined;
|
|
42
|
+
reasoningCid?: string | undefined;
|
|
43
|
+
sourceRefs?: {
|
|
44
|
+
url: string;
|
|
45
|
+
title: string;
|
|
46
|
+
}[] | undefined;
|
|
47
|
+
}>;
|
|
48
|
+
export type PredictionV1RestorationPayload = z.infer<typeof PredictionV1RestorationPayloadSchema>;
|
|
49
|
+
export declare const PredictionV1VerdictPayloadSchema: z.ZodObject<{
|
|
50
|
+
verdict: z.ZodEnum<["SCORED", "REJECTED", "INVALID", "INDETERMINATE"]>;
|
|
51
|
+
outcome: z.ZodOptional<z.ZodEnum<["YES", "NO", "INVALID"]>>;
|
|
52
|
+
resolvedAt: z.ZodOptional<z.ZodString>;
|
|
53
|
+
resolutionSource: z.ZodObject<{
|
|
54
|
+
venue: z.ZodLiteral<"polymarket">;
|
|
55
|
+
url: z.ZodString;
|
|
56
|
+
marketId: z.ZodString;
|
|
57
|
+
conditionId: z.ZodString;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
venue: "polymarket";
|
|
60
|
+
url: string;
|
|
61
|
+
marketId: string;
|
|
62
|
+
conditionId: string;
|
|
63
|
+
}, {
|
|
64
|
+
venue: "polymarket";
|
|
65
|
+
url: string;
|
|
66
|
+
marketId: string;
|
|
67
|
+
conditionId: string;
|
|
68
|
+
}>;
|
|
69
|
+
task: z.ZodObject<{
|
|
70
|
+
cid: z.ZodString;
|
|
71
|
+
id: z.ZodString;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
cid: string;
|
|
74
|
+
id: string;
|
|
75
|
+
}, {
|
|
76
|
+
cid: string;
|
|
77
|
+
id: string;
|
|
78
|
+
}>;
|
|
79
|
+
solutionEnvelope: z.ZodObject<{
|
|
80
|
+
cid: z.ZodString;
|
|
81
|
+
sha256: z.ZodString;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
cid: string;
|
|
84
|
+
sha256: string;
|
|
85
|
+
}, {
|
|
86
|
+
cid: string;
|
|
87
|
+
sha256: string;
|
|
88
|
+
}>;
|
|
89
|
+
claimed: z.ZodOptional<z.ZodObject<{
|
|
90
|
+
probabilityYes: z.ZodString;
|
|
91
|
+
submittedAt: z.ZodString;
|
|
92
|
+
modelId: z.ZodString;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
probabilityYes: string;
|
|
95
|
+
submittedAt: string;
|
|
96
|
+
modelId: string;
|
|
97
|
+
}, {
|
|
98
|
+
probabilityYes: string;
|
|
99
|
+
submittedAt: string;
|
|
100
|
+
modelId: string;
|
|
101
|
+
}>>;
|
|
102
|
+
benchmark: z.ZodObject<{
|
|
103
|
+
probabilityYes: z.ZodString;
|
|
104
|
+
sampledAt: z.ZodString;
|
|
105
|
+
method: z.ZodLiteral<"best-bid-ask-midpoint">;
|
|
106
|
+
}, "strip", z.ZodTypeAny, {
|
|
107
|
+
sampledAt: string;
|
|
108
|
+
probabilityYes: string;
|
|
109
|
+
method: "best-bid-ask-midpoint";
|
|
110
|
+
}, {
|
|
111
|
+
sampledAt: string;
|
|
112
|
+
probabilityYes: string;
|
|
113
|
+
method: "best-bid-ask-midpoint";
|
|
114
|
+
}>;
|
|
115
|
+
scores: z.ZodOptional<z.ZodObject<{
|
|
116
|
+
scoreBasis: z.ZodLiteral<"brier-loss.v1">;
|
|
117
|
+
solverBrier: z.ZodString;
|
|
118
|
+
consensusBrier: z.ZodString;
|
|
119
|
+
brierSpread: z.ZodString;
|
|
120
|
+
}, "strip", z.ZodTypeAny, {
|
|
121
|
+
scoreBasis: "brier-loss.v1";
|
|
122
|
+
solverBrier: string;
|
|
123
|
+
consensusBrier: string;
|
|
124
|
+
brierSpread: string;
|
|
125
|
+
}, {
|
|
126
|
+
scoreBasis: "brier-loss.v1";
|
|
127
|
+
solverBrier: string;
|
|
128
|
+
consensusBrier: string;
|
|
129
|
+
brierSpread: string;
|
|
130
|
+
}>>;
|
|
131
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
132
|
+
name: z.ZodString;
|
|
133
|
+
status: z.ZodEnum<["PASS", "FAIL", "SKIP", "INDETERMINATE"]>;
|
|
134
|
+
detail: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
135
|
+
}, "strip", z.ZodTypeAny, {
|
|
136
|
+
status: "PASS" | "FAIL" | "SKIP" | "INDETERMINATE";
|
|
137
|
+
name: string;
|
|
138
|
+
detail?: string | Record<string, unknown> | undefined;
|
|
139
|
+
}, {
|
|
140
|
+
status: "PASS" | "FAIL" | "SKIP" | "INDETERMINATE";
|
|
141
|
+
name: string;
|
|
142
|
+
detail?: string | Record<string, unknown> | undefined;
|
|
143
|
+
}>, "many">;
|
|
144
|
+
}, "strip", z.ZodTypeAny, {
|
|
145
|
+
verdict: "INDETERMINATE" | "SCORED" | "REJECTED" | "INVALID";
|
|
146
|
+
resolutionSource: {
|
|
147
|
+
venue: "polymarket";
|
|
148
|
+
url: string;
|
|
149
|
+
marketId: string;
|
|
150
|
+
conditionId: string;
|
|
151
|
+
};
|
|
152
|
+
task: {
|
|
153
|
+
cid: string;
|
|
154
|
+
id: string;
|
|
155
|
+
};
|
|
156
|
+
solutionEnvelope: {
|
|
157
|
+
cid: string;
|
|
158
|
+
sha256: string;
|
|
159
|
+
};
|
|
160
|
+
benchmark: {
|
|
161
|
+
sampledAt: string;
|
|
162
|
+
probabilityYes: string;
|
|
163
|
+
method: "best-bid-ask-midpoint";
|
|
164
|
+
};
|
|
165
|
+
checks: {
|
|
166
|
+
status: "PASS" | "FAIL" | "SKIP" | "INDETERMINATE";
|
|
167
|
+
name: string;
|
|
168
|
+
detail?: string | Record<string, unknown> | undefined;
|
|
169
|
+
}[];
|
|
170
|
+
outcome?: "YES" | "NO" | "INVALID" | undefined;
|
|
171
|
+
resolvedAt?: string | undefined;
|
|
172
|
+
claimed?: {
|
|
173
|
+
probabilityYes: string;
|
|
174
|
+
submittedAt: string;
|
|
175
|
+
modelId: string;
|
|
176
|
+
} | undefined;
|
|
177
|
+
scores?: {
|
|
178
|
+
scoreBasis: "brier-loss.v1";
|
|
179
|
+
solverBrier: string;
|
|
180
|
+
consensusBrier: string;
|
|
181
|
+
brierSpread: string;
|
|
182
|
+
} | undefined;
|
|
183
|
+
}, {
|
|
184
|
+
verdict: "INDETERMINATE" | "SCORED" | "REJECTED" | "INVALID";
|
|
185
|
+
resolutionSource: {
|
|
186
|
+
venue: "polymarket";
|
|
187
|
+
url: string;
|
|
188
|
+
marketId: string;
|
|
189
|
+
conditionId: string;
|
|
190
|
+
};
|
|
191
|
+
task: {
|
|
192
|
+
cid: string;
|
|
193
|
+
id: string;
|
|
194
|
+
};
|
|
195
|
+
solutionEnvelope: {
|
|
196
|
+
cid: string;
|
|
197
|
+
sha256: string;
|
|
198
|
+
};
|
|
199
|
+
benchmark: {
|
|
200
|
+
sampledAt: string;
|
|
201
|
+
probabilityYes: string;
|
|
202
|
+
method: "best-bid-ask-midpoint";
|
|
203
|
+
};
|
|
204
|
+
checks: {
|
|
205
|
+
status: "PASS" | "FAIL" | "SKIP" | "INDETERMINATE";
|
|
206
|
+
name: string;
|
|
207
|
+
detail?: string | Record<string, unknown> | undefined;
|
|
208
|
+
}[];
|
|
209
|
+
outcome?: "YES" | "NO" | "INVALID" | undefined;
|
|
210
|
+
resolvedAt?: string | undefined;
|
|
211
|
+
claimed?: {
|
|
212
|
+
probabilityYes: string;
|
|
213
|
+
submittedAt: string;
|
|
214
|
+
modelId: string;
|
|
215
|
+
} | undefined;
|
|
216
|
+
scores?: {
|
|
217
|
+
scoreBasis: "brier-loss.v1";
|
|
218
|
+
solverBrier: string;
|
|
219
|
+
consensusBrier: string;
|
|
220
|
+
brierSpread: string;
|
|
221
|
+
} | undefined;
|
|
222
|
+
}>;
|
|
223
|
+
export type PredictionV1VerdictPayload = z.infer<typeof PredictionV1VerdictPayloadSchema>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DecimalProbabilitySchema, IsoDateTimeSchema } from '../prediction-v1.js';
|
|
3
|
+
const Sha256Schema = z.string().regex(/^[0-9a-f]{64}$/);
|
|
4
|
+
const CheckSchema = z.object({
|
|
5
|
+
name: z.string().min(1),
|
|
6
|
+
status: z.enum(['PASS', 'FAIL', 'SKIP', 'INDETERMINATE']),
|
|
7
|
+
detail: z.union([z.string(), z.record(z.unknown())]).optional(),
|
|
8
|
+
});
|
|
9
|
+
export const PredictionV1RestorationPayloadSchema = z.object({
|
|
10
|
+
probabilityYes: DecimalProbabilitySchema,
|
|
11
|
+
submittedAt: IsoDateTimeSchema,
|
|
12
|
+
format: z.literal('decimal'),
|
|
13
|
+
modelId: z.string().min(1),
|
|
14
|
+
confidence: z.enum(['low', 'medium', 'high']).optional(),
|
|
15
|
+
methodology: z.string().optional(),
|
|
16
|
+
evidenceCids: z.array(z.string().min(1)).optional(),
|
|
17
|
+
reasoningCid: z.string().min(1).optional(),
|
|
18
|
+
sourceRefs: z
|
|
19
|
+
.array(z.object({
|
|
20
|
+
title: z.string().min(1),
|
|
21
|
+
url: z.string().url(),
|
|
22
|
+
}))
|
|
23
|
+
.optional(),
|
|
24
|
+
});
|
|
25
|
+
export const PredictionV1VerdictPayloadSchema = z.object({
|
|
26
|
+
verdict: z.enum(['SCORED', 'REJECTED', 'INVALID', 'INDETERMINATE']),
|
|
27
|
+
outcome: z.enum(['YES', 'NO', 'INVALID']).optional(),
|
|
28
|
+
resolvedAt: IsoDateTimeSchema.optional(),
|
|
29
|
+
resolutionSource: z.object({
|
|
30
|
+
venue: z.literal('polymarket'),
|
|
31
|
+
url: z.string().url(),
|
|
32
|
+
marketId: z.string().min(1),
|
|
33
|
+
conditionId: z.string().min(1),
|
|
34
|
+
}),
|
|
35
|
+
task: z.object({
|
|
36
|
+
cid: z.string(),
|
|
37
|
+
id: z.string().min(1),
|
|
38
|
+
}),
|
|
39
|
+
solutionEnvelope: z.object({
|
|
40
|
+
cid: z.string(),
|
|
41
|
+
sha256: Sha256Schema,
|
|
42
|
+
}),
|
|
43
|
+
claimed: z
|
|
44
|
+
.object({
|
|
45
|
+
probabilityYes: DecimalProbabilitySchema,
|
|
46
|
+
submittedAt: IsoDateTimeSchema,
|
|
47
|
+
modelId: z.string().min(1),
|
|
48
|
+
})
|
|
49
|
+
.optional(),
|
|
50
|
+
benchmark: z.object({
|
|
51
|
+
probabilityYes: DecimalProbabilitySchema,
|
|
52
|
+
sampledAt: IsoDateTimeSchema,
|
|
53
|
+
method: z.literal('best-bid-ask-midpoint'),
|
|
54
|
+
}),
|
|
55
|
+
scores: z
|
|
56
|
+
.object({
|
|
57
|
+
scoreBasis: z.literal('brier-loss.v1'),
|
|
58
|
+
solverBrier: z.string(),
|
|
59
|
+
consensusBrier: z.string(),
|
|
60
|
+
brierSpread: z.string(),
|
|
61
|
+
})
|
|
62
|
+
.optional(),
|
|
63
|
+
checks: z.array(CheckSchema),
|
|
64
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type SolverPluginSourceKind = 'bundled' | 'local' | 'npm' | 'git' | 'github' | 'claude';
|
|
2
|
+
export type SolverPluginEntry = string | {
|
|
3
|
+
name?: string;
|
|
4
|
+
source: string;
|
|
5
|
+
version?: string;
|
|
6
|
+
};
|
|
7
|
+
export interface SolverPluginManifest {
|
|
8
|
+
name: string;
|
|
9
|
+
version: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
jinn?: {
|
|
12
|
+
supports?: string[];
|
|
13
|
+
capabilities?: Record<string, unknown>;
|
|
14
|
+
mcpServers?: Record<string, unknown>;
|
|
15
|
+
skills?: string[];
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
};
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
export interface LoadedSolverPlugin {
|
|
21
|
+
name: string;
|
|
22
|
+
version: string;
|
|
23
|
+
supports: string[];
|
|
24
|
+
source: string;
|
|
25
|
+
sourceKind: SolverPluginSourceKind;
|
|
26
|
+
root: string;
|
|
27
|
+
manifestPath: string;
|
|
28
|
+
manifest: SolverPluginManifest;
|
|
29
|
+
sha256: string;
|
|
30
|
+
cid?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface ResolveSolverPluginOptions {
|
|
33
|
+
bundledRoot?: string;
|
|
34
|
+
vendorRoot?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare function validateSolverPluginManifest(input: unknown): SolverPluginManifest;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
function assertRecord(value, label) {
|
|
2
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
3
|
+
throw new Error(`${label} must be an object`);
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
export function validateSolverPluginManifest(input) {
|
|
7
|
+
assertRecord(input, 'manifest');
|
|
8
|
+
for (const key of Object.keys(input)) {
|
|
9
|
+
if (key.startsWith('jinn.')) {
|
|
10
|
+
throw new Error(`unknown top-level jinn extension key: ${key}; use manifest.jinn`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
if (typeof input['name'] !== 'string' || input['name'].length === 0) {
|
|
14
|
+
throw new Error('manifest.name is required');
|
|
15
|
+
}
|
|
16
|
+
if (typeof input['version'] !== 'string' || input['version'].length === 0) {
|
|
17
|
+
throw new Error('manifest.version is required');
|
|
18
|
+
}
|
|
19
|
+
const jinn = input['jinn'];
|
|
20
|
+
if (jinn !== undefined) {
|
|
21
|
+
assertRecord(jinn, 'manifest.jinn');
|
|
22
|
+
if ('solverType' in jinn) {
|
|
23
|
+
throw new Error('manifest.jinn.solverType is no longer supported; SolverNet contracts define solverType authority');
|
|
24
|
+
}
|
|
25
|
+
if ('schemas' in jinn) {
|
|
26
|
+
throw new Error('manifest.jinn.schemas is no longer supported; SolverNet contracts define canonical schemas');
|
|
27
|
+
}
|
|
28
|
+
const supports = jinn['supports'];
|
|
29
|
+
if (supports !== undefined) {
|
|
30
|
+
if (!Array.isArray(supports))
|
|
31
|
+
throw new Error('manifest.jinn.supports must be an array');
|
|
32
|
+
for (const [idx, value] of supports.entries()) {
|
|
33
|
+
if (typeof value !== 'string' || value.length === 0) {
|
|
34
|
+
throw new Error(`manifest.jinn.supports[${idx}] must be a non-empty string`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (jinn['capabilities'] !== undefined)
|
|
39
|
+
assertRecord(jinn['capabilities'], 'manifest.jinn.capabilities');
|
|
40
|
+
if (jinn['mcpServers'] !== undefined)
|
|
41
|
+
assertRecord(jinn['mcpServers'], 'manifest.jinn.mcpServers');
|
|
42
|
+
const skills = jinn['skills'];
|
|
43
|
+
if (skills !== undefined) {
|
|
44
|
+
if (!Array.isArray(skills))
|
|
45
|
+
throw new Error('manifest.jinn.skills must be an array');
|
|
46
|
+
for (const [idx, value] of skills.entries()) {
|
|
47
|
+
if (typeof value !== 'string' || value.length === 0) {
|
|
48
|
+
throw new Error(`manifest.jinn.skills[${idx}] must be a non-empty string`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return input;
|
|
54
|
+
}
|