@jinn-network/client 0.1.1 → 0.1.2-canary.d6e72dfd
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/CHANGELOG.md +14 -0
- package/CONTRIBUTING.md +123 -0
- package/README.md +210 -37
- package/deployments/deployment-claim-registry-baseSepolia.json +13 -0
- package/deployments/deployment-jinn-testnet-faucet-baseSepolia-fast.json +15 -0
- package/dist/adapters/claim-registry/abi.d.ts +127 -0
- package/dist/adapters/claim-registry/abi.js +93 -0
- package/dist/adapters/claim-registry/abi.js.map +1 -0
- package/dist/adapters/claim-registry/client.d.ts +89 -0
- package/dist/adapters/claim-registry/client.js +205 -0
- package/dist/adapters/claim-registry/client.js.map +1 -0
- package/dist/adapters/mech/adapter.d.ts +1 -0
- package/dist/adapters/mech/adapter.js +75 -41
- package/dist/adapters/mech/adapter.js.map +1 -1
- package/dist/adapters/mech/contracts.d.ts +2 -0
- package/dist/adapters/mech/contracts.js +57 -7
- package/dist/adapters/mech/contracts.js.map +1 -1
- package/dist/adapters/mech/ipfs.d.ts +8 -0
- package/dist/adapters/mech/ipfs.js +12 -0
- package/dist/adapters/mech/ipfs.js.map +1 -1
- package/dist/adapters/mech/types.d.ts +20 -46
- package/dist/adapters/mech/types.js +16 -35
- package/dist/adapters/mech/types.js.map +1 -1
- package/dist/api/gather-status.d.ts +1 -0
- package/dist/api/gather-status.js +33 -1
- package/dist/api/gather-status.js.map +1 -1
- package/dist/api/portfolio-v0-build.d.ts +81 -0
- package/dist/api/portfolio-v0-build.js +141 -0
- package/dist/api/portfolio-v0-build.js.map +1 -0
- package/dist/api/portfolio-v0-doctor.d.ts +37 -0
- package/dist/api/portfolio-v0-doctor.js +123 -0
- package/dist/api/portfolio-v0-doctor.js.map +1 -0
- package/dist/api/rewards-build.js +1 -1
- package/dist/api/rewards-build.js.map +1 -1
- package/dist/api/status-build.d.ts +7 -0
- package/dist/api/status-build.js +1 -0
- package/dist/api/status-build.js.map +1 -1
- package/dist/bin/jinn-mcp.d.ts +0 -12
- package/dist/bin/jinn-mcp.js +5 -14
- package/dist/bin/jinn-mcp.js.map +1 -1
- package/dist/build-meta.json +1 -1
- package/dist/cli/commands/auth.js +115 -25
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/bootstrap.js +1 -0
- package/dist/cli/commands/bootstrap.js.map +1 -1
- package/dist/cli/commands/doctor.js +130 -14
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/fleet-scale.js +1 -0
- package/dist/cli/commands/fleet-scale.js.map +1 -1
- package/dist/cli/commands/fund-requirements.js +2 -0
- package/dist/cli/commands/fund-requirements.js.map +1 -1
- package/dist/cli/commands/intents.d.ts +17 -0
- package/dist/cli/commands/intents.js +489 -0
- package/dist/cli/commands/intents.js.map +1 -0
- package/dist/cli/commands/keys-backup.js +13 -11
- package/dist/cli/commands/keys-backup.js.map +1 -1
- package/dist/cli/commands/mcp.d.ts +3 -0
- package/dist/cli/commands/mcp.js +19 -0
- package/dist/cli/commands/mcp.js.map +1 -0
- package/dist/cli/commands/plugin-install.js +8 -4
- package/dist/cli/commands/plugin-install.js.map +1 -1
- package/dist/cli/commands/quickstart.js +60 -4
- package/dist/cli/commands/quickstart.js.map +1 -1
- package/dist/cli/commands/rewards.js +27 -1
- package/dist/cli/commands/rewards.js.map +1 -1
- package/dist/cli/commands/submit-intent.js +108 -5
- package/dist/cli/commands/submit-intent.js.map +1 -1
- package/dist/cli/commands/version.js +1 -0
- package/dist/cli/commands/version.js.map +1 -1
- package/dist/cli/deployment-digest.js +5 -0
- package/dist/cli/deployment-digest.js.map +1 -1
- package/dist/cli/execution-context.js +1 -0
- package/dist/cli/execution-context.js.map +1 -1
- package/dist/cli/index.js +4 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/intent-registry-access.d.ts +64 -0
- package/dist/cli/intent-registry-access.js +187 -0
- package/dist/cli/intent-registry-access.js.map +1 -0
- package/dist/cli/introspection-context.js +1 -0
- package/dist/cli/introspection-context.js.map +1 -1
- package/dist/cli/password.d.ts +21 -9
- package/dist/cli/password.js +45 -24
- package/dist/cli/password.js.map +1 -1
- package/dist/config.d.ts +110 -8
- package/dist/config.js +41 -12
- package/dist/config.js.map +1 -1
- package/dist/daemon/creator.d.ts +7 -1
- package/dist/daemon/creator.js +38 -3
- package/dist/daemon/creator.js.map +1 -1
- package/dist/daemon/daemon.d.ts +43 -0
- package/dist/daemon/daemon.js +87 -2
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/earning/bootstrap.d.ts +2 -1
- package/dist/earning/bootstrap.js +72 -4
- package/dist/earning/bootstrap.js.map +1 -1
- package/dist/earning/contracts.d.ts +10 -0
- package/dist/earning/contracts.js +24 -0
- package/dist/earning/contracts.js.map +1 -1
- package/dist/earning/jinn-rewards.d.ts +9 -0
- package/dist/earning/jinn-rewards.js +7 -0
- package/dist/earning/jinn-rewards.js.map +1 -1
- package/dist/intents/prediction-apy-v0-auto.d.ts +11 -0
- package/dist/intents/prediction-apy-v0-auto.js +46 -0
- package/dist/intents/prediction-apy-v0-auto.js.map +1 -0
- package/dist/intents/prediction-apy-v0-template.d.ts +8 -0
- package/dist/intents/prediction-apy-v0-template.js +22 -0
- package/dist/intents/prediction-apy-v0-template.js.map +1 -0
- package/dist/intents/prediction-v0-auto.d.ts +53 -0
- package/dist/intents/prediction-v0-auto.js +84 -0
- package/dist/intents/prediction-v0-auto.js.map +1 -0
- package/dist/intents/prediction-v0-template.d.ts +65 -0
- package/dist/intents/prediction-v0-template.js +125 -0
- package/dist/intents/prediction-v0-template.js.map +1 -0
- package/dist/main.js +149 -1
- package/dist/main.js.map +1 -1
- package/dist/mcp/operator-server.d.ts +1 -1
- package/dist/mcp/operator-server.js +1 -1
- package/dist/preflight/claude-auth.d.ts +12 -1
- package/dist/preflight/claude-auth.js +21 -3
- package/dist/preflight/claude-auth.js.map +1 -1
- package/dist/restorer/engine/canonical-json.d.ts +18 -0
- package/dist/restorer/engine/canonical-json.js +59 -0
- package/dist/restorer/engine/canonical-json.js.map +1 -0
- package/dist/restorer/engine/claim.d.ts +69 -0
- package/dist/restorer/engine/claim.js +104 -0
- package/dist/restorer/engine/claim.js.map +1 -0
- package/dist/restorer/engine/delivery.d.ts +52 -0
- package/dist/restorer/engine/delivery.js +63 -0
- package/dist/restorer/engine/delivery.js.map +1 -0
- package/dist/restorer/engine/engine.d.ts +203 -0
- package/dist/restorer/engine/engine.js +753 -0
- package/dist/restorer/engine/engine.js.map +1 -0
- package/dist/restorer/engine/manifest-assembly.d.ts +67 -0
- package/dist/restorer/engine/manifest-assembly.js +79 -0
- package/dist/restorer/engine/manifest-assembly.js.map +1 -0
- package/dist/restorer/engine/packaging.d.ts +87 -0
- package/dist/restorer/engine/packaging.js +350 -0
- package/dist/restorer/engine/packaging.js.map +1 -0
- package/dist/restorer/engine/persistence.d.ts +170 -0
- package/dist/restorer/engine/persistence.js +381 -0
- package/dist/restorer/engine/persistence.js.map +1 -0
- package/dist/restorer/engine/recovery.d.ts +22 -0
- package/dist/restorer/engine/recovery.js +24 -0
- package/dist/restorer/engine/recovery.js.map +1 -0
- package/dist/restorer/engine/registry.d.ts +62 -0
- package/dist/restorer/engine/registry.js +73 -0
- package/dist/restorer/engine/registry.js.map +1 -0
- package/dist/restorer/engine/signing.d.ts +30 -0
- package/dist/restorer/engine/signing.js +39 -0
- package/dist/restorer/engine/signing.js.map +1 -0
- package/dist/restorer/engine/state.d.ts +42 -0
- package/dist/restorer/engine/state.js +87 -0
- package/dist/restorer/engine/state.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/api-wallet.d.ts +64 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/api-wallet.js +96 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/api-wallet.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/index.d.ts +101 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/index.js +710 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/index.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/mcp-tools.d.ts +137 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/mcp-tools.js +865 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/mcp-tools.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/safety-rails.d.ts +74 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/safety-rails.js +74 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/safety-rails.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/session-orchestrator.d.ts +97 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/session-orchestrator.js +226 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/session-orchestrator.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-prediction/index.d.ts +43 -0
- package/dist/restorer/impls/claude-mcp-prediction/index.js +230 -0
- package/dist/restorer/impls/claude-mcp-prediction/index.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-prediction/mcp-tools.d.ts +38 -0
- package/dist/restorer/impls/claude-mcp-prediction/mcp-tools.js +135 -0
- package/dist/restorer/impls/claude-mcp-prediction/mcp-tools.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-prediction/prompt.d.ts +8 -0
- package/dist/restorer/impls/claude-mcp-prediction/prompt.js +54 -0
- package/dist/restorer/impls/claude-mcp-prediction/prompt.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-prediction/session-orchestrator.d.ts +36 -0
- package/dist/restorer/impls/claude-mcp-prediction/session-orchestrator.js +137 -0
- package/dist/restorer/impls/claude-mcp-prediction/session-orchestrator.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-prediction/types.d.ts +82 -0
- package/dist/restorer/impls/claude-mcp-prediction/types.js +6 -0
- package/dist/restorer/impls/claude-mcp-prediction/types.js.map +1 -0
- package/dist/restorer/impls/legacy-claude/index.d.ts +45 -0
- package/dist/restorer/impls/legacy-claude/index.js +71 -0
- package/dist/restorer/impls/legacy-claude/index.js.map +1 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/canonical-metrics.d.ts +68 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/canonical-metrics.js +117 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/canonical-metrics.js.map +1 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/availability.d.ts +49 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/availability.js +91 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/availability.js.map +1 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/consistency.d.ts +78 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/consistency.js +274 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/consistency.js.map +1 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/eligibility.d.ts +23 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/eligibility.js +49 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/eligibility.js.map +1 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/integrity.d.ts +25 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/integrity.js +44 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/integrity.js.map +1 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/spec.d.ts +17 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/spec.js +43 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/spec.js.map +1 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/index.d.ts +43 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/index.js +431 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/index.js.map +1 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/score.d.ts +21 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/score.js +32 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/score.js.map +1 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/types.d.ts +32 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/types.js +8 -0
- package/dist/restorer/impls/portfolio-v0-evaluator/types.js.map +1 -0
- package/dist/restorer/impls/prediction-apy-v0-baseline/index.d.ts +39 -0
- package/dist/restorer/impls/prediction-apy-v0-baseline/index.js +98 -0
- package/dist/restorer/impls/prediction-apy-v0-baseline/index.js.map +1 -0
- package/dist/restorer/impls/prediction-apy-v0-baseline/strategy.d.ts +2 -0
- package/dist/restorer/impls/prediction-apy-v0-baseline/strategy.js +7 -0
- package/dist/restorer/impls/prediction-apy-v0-baseline/strategy.js.map +1 -0
- package/dist/restorer/impls/prediction-apy-v0-baseline/types.d.ts +4 -0
- package/dist/restorer/impls/prediction-apy-v0-baseline/types.js +2 -0
- package/dist/restorer/impls/prediction-apy-v0-baseline/types.js.map +1 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/canonical-metrics.d.ts +2 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/canonical-metrics.js +7 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/canonical-metrics.js.map +1 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/index.d.ts +39 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/index.js +186 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/index.js.map +1 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/score.d.ts +9 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/score.js +20 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/score.js.map +1 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/types.d.ts +7 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/types.js +2 -0
- package/dist/restorer/impls/prediction-apy-v0-evaluator/types.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-baseline/index.d.ts +29 -0
- package/dist/restorer/impls/prediction-v0-baseline/index.js +94 -0
- package/dist/restorer/impls/prediction-v0-baseline/index.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-baseline/strategy.d.ts +8 -0
- package/dist/restorer/impls/prediction-v0-baseline/strategy.js +41 -0
- package/dist/restorer/impls/prediction-v0-baseline/strategy.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-baseline/types.d.ts +7 -0
- package/dist/restorer/impls/prediction-v0-baseline/types.js +2 -0
- package/dist/restorer/impls/prediction-v0-baseline/types.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-evaluator/canonical-metrics.d.ts +20 -0
- package/dist/restorer/impls/prediction-v0-evaluator/canonical-metrics.js +66 -0
- package/dist/restorer/impls/prediction-v0-evaluator/canonical-metrics.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/availability.d.ts +9 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/availability.js +23 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/availability.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/eligibility.d.ts +3 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/eligibility.js +13 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/eligibility.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/integrity.d.ts +7 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/integrity.js +93 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/integrity.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/spec.d.ts +5 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/spec.js +20 -0
- package/dist/restorer/impls/prediction-v0-evaluator/checks/spec.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-evaluator/index.d.ts +33 -0
- package/dist/restorer/impls/prediction-v0-evaluator/index.js +208 -0
- package/dist/restorer/impls/prediction-v0-evaluator/index.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-evaluator/score.d.ts +8 -0
- package/dist/restorer/impls/prediction-v0-evaluator/score.js +15 -0
- package/dist/restorer/impls/prediction-v0-evaluator/score.js.map +1 -0
- package/dist/restorer/impls/prediction-v0-evaluator/types.d.ts +7 -0
- package/dist/restorer/impls/prediction-v0-evaluator/types.js +2 -0
- package/dist/restorer/impls/prediction-v0-evaluator/types.js.map +1 -0
- package/dist/restorer/types.d.ts +177 -0
- package/dist/restorer/types.js +7 -0
- package/dist/restorer/types.js.map +1 -0
- package/dist/store/store.d.ts +3 -1
- package/dist/store/store.js +3 -0
- package/dist/store/store.js.map +1 -1
- package/dist/types/desired-state.d.ts +53 -0
- package/dist/types/desired-state.js +20 -0
- package/dist/types/desired-state.js.map +1 -1
- package/dist/types/index.d.ts +4 -1
- package/dist/types/index.js +4 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/portfolio.d.ts +1000 -0
- package/dist/types/portfolio.js +168 -0
- package/dist/types/portfolio.js.map +1 -0
- package/dist/types/prediction-apy.d.ts +919 -0
- package/dist/types/prediction-apy.js +121 -0
- package/dist/types/prediction-apy.js.map +1 -0
- package/dist/types/prediction.d.ts +925 -0
- package/dist/types/prediction.js +140 -0
- package/dist/types/prediction.js.map +1 -0
- package/dist/venues/aave-v3/addresses.d.ts +6 -0
- package/dist/venues/aave-v3/addresses.js +19 -0
- package/dist/venues/aave-v3/addresses.js.map +1 -0
- package/dist/venues/aave-v3/client.d.ts +81 -0
- package/dist/venues/aave-v3/client.js +97 -0
- package/dist/venues/aave-v3/client.js.map +1 -0
- package/dist/venues/chainlink/client.d.ts +99 -0
- package/dist/venues/chainlink/client.js +130 -0
- package/dist/venues/chainlink/client.js.map +1 -0
- package/dist/venues/chainlink/feeds.d.ts +8 -0
- package/dist/venues/chainlink/feeds.js +9 -0
- package/dist/venues/chainlink/feeds.js.map +1 -0
- package/dist/venues/hyperliquid/account-value.d.ts +30 -0
- package/dist/venues/hyperliquid/account-value.js +30 -0
- package/dist/venues/hyperliquid/account-value.js.map +1 -0
- package/dist/venues/hyperliquid/client.d.ts +63 -0
- package/dist/venues/hyperliquid/client.js +135 -0
- package/dist/venues/hyperliquid/client.js.map +1 -0
- package/dist/venues/hyperliquid/grid.d.ts +36 -0
- package/dist/venues/hyperliquid/grid.js +61 -0
- package/dist/venues/hyperliquid/grid.js.map +1 -0
- package/dist/venues/hyperliquid/types.d.ts +81 -0
- package/dist/venues/hyperliquid/types.js +8 -0
- package/dist/venues/hyperliquid/types.js.map +1 -0
- package/dist/withdraw/run-withdraw-plan.js +2 -0
- package/dist/withdraw/run-withdraw-plan.js.map +1 -1
- package/docker-compose.yml +44 -0
- package/package.json +12 -1
- package/skills/jinn-operator/SKILL.md +85 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { brierScore } from './canonical-metrics.js';
|
|
2
|
+
export const SCORE_BASIS = 'brier.v1';
|
|
3
|
+
export const SCORE_VERSION = '1';
|
|
4
|
+
export function computeScore(verdict, probability, groundTruth) {
|
|
5
|
+
if (verdict !== 'PASS') {
|
|
6
|
+
return { score: '0', scoreBasis: SCORE_BASIS, scoreVersion: SCORE_VERSION };
|
|
7
|
+
}
|
|
8
|
+
const outcome = groundTruth === 'YES' ? 1 : 0;
|
|
9
|
+
return {
|
|
10
|
+
score: brierScore(probability, outcome),
|
|
11
|
+
scoreBasis: SCORE_BASIS,
|
|
12
|
+
scoreVersion: SCORE_VERSION,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=score.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score.js","sourceRoot":"","sources":["../../../../src/restorer/impls/prediction-v0-evaluator/score.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,MAAM,CAAC,MAAM,WAAW,GAAG,UAAmB,CAAC;AAC/C,MAAM,CAAC,MAAM,aAAa,GAAG,GAAY,CAAC;AAI1C,MAAM,UAAU,YAAY,CAC1B,OAAgB,EAChB,WAAmB,EACnB,WAAyB;IAEzB,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QACvB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC;IAC9E,CAAC;IACD,MAAM,OAAO,GAAG,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,OAAO;QACL,KAAK,EAAE,UAAU,CAAC,WAAW,EAAE,OAAO,CAAC;QACvC,UAAU,EAAE,WAAW;QACvB,YAAY,EAAE,aAAa;KAC5B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/restorer/impls/prediction-v0-evaluator/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Restorer-impl interface — §6.7 of the portfolio.v0 design spec.
|
|
3
|
+
*
|
|
4
|
+
* Pure type definitions; no runtime side effects.
|
|
5
|
+
*/
|
|
6
|
+
import type { DesiredState } from '../types/desired-state.js';
|
|
7
|
+
import type { OutputArtifact, RationaleEntry, Snapshot } from '../types/portfolio.js';
|
|
8
|
+
export interface RestorationContext {
|
|
9
|
+
intent: DesiredState;
|
|
10
|
+
/** Persistent directory for impl-specific state. */
|
|
11
|
+
implStateDir: string;
|
|
12
|
+
/** Ephemeral working directory (cleared between attempts). */
|
|
13
|
+
workingDir: string;
|
|
14
|
+
log: (event: {
|
|
15
|
+
level: 'info' | 'warn' | 'error';
|
|
16
|
+
msg: string;
|
|
17
|
+
data?: unknown;
|
|
18
|
+
}) => void;
|
|
19
|
+
/** Fires at window.endTs. */
|
|
20
|
+
abort: AbortSignal;
|
|
21
|
+
msUntilEndTs: () => number;
|
|
22
|
+
}
|
|
23
|
+
export interface RestorationOutput {
|
|
24
|
+
venueRef: {
|
|
25
|
+
name: string;
|
|
26
|
+
};
|
|
27
|
+
/** Optional — evaluator impls that do not operate on a venue leave these undefined. */
|
|
28
|
+
preSnapshot?: Snapshot;
|
|
29
|
+
postSnapshot?: Snapshot;
|
|
30
|
+
fills?: unknown[];
|
|
31
|
+
/** Shape is per spec.kind convention. */
|
|
32
|
+
gating: Record<string, unknown>;
|
|
33
|
+
informational?: Record<string, unknown>;
|
|
34
|
+
artifacts?: OutputArtifact[];
|
|
35
|
+
rationale?: RationaleEntry[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Context-free readiness probe. "Are this impl's external dependencies
|
|
39
|
+
* satisfied right now, regardless of any specific intent?" Used by
|
|
40
|
+
* `jinn intents list|status` and by the claim-policy gate that refuses
|
|
41
|
+
* to spend gas claiming an intent whose impl cannot execute.
|
|
42
|
+
*/
|
|
43
|
+
export interface ReadyStatus {
|
|
44
|
+
ready: boolean;
|
|
45
|
+
reason?: string;
|
|
46
|
+
/** Optional hint for the operator/agent on how to become ready. */
|
|
47
|
+
nextStep?: {
|
|
48
|
+
description: string;
|
|
49
|
+
cli?: string;
|
|
50
|
+
url?: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Argument a kind-specific enable flow wants from the operator, surfaced
|
|
55
|
+
* via `enableMetadata()`. The generic `jinn intents enable <kind>` verb
|
|
56
|
+
* parses these from `--key=value` flags without caring what they mean.
|
|
57
|
+
*/
|
|
58
|
+
export interface EnableArgDef {
|
|
59
|
+
name: string;
|
|
60
|
+
description: string;
|
|
61
|
+
required: boolean;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Metadata that `jinn intents list` uses to teach the operator (or agent)
|
|
65
|
+
* what's needed to enable a kind. Returned without running the flow.
|
|
66
|
+
*/
|
|
67
|
+
export interface IntentEnableMetadata {
|
|
68
|
+
/** Human-readable summary of what opting in to this kind entails. */
|
|
69
|
+
description: string;
|
|
70
|
+
requiredArgs?: EnableArgDef[];
|
|
71
|
+
/** External URLs the operator/agent will need (e.g. exchange UI). */
|
|
72
|
+
externalResources?: Array<{
|
|
73
|
+
name: string;
|
|
74
|
+
url: string;
|
|
75
|
+
}>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Outcome of a single `jinn intents enable <kind>` invocation.
|
|
79
|
+
*
|
|
80
|
+
* The flow is idempotent: the agent reruns the same command until
|
|
81
|
+
* `status === 'ready'`. Each intermediate state carries enough info for
|
|
82
|
+
* the agent to know what to do next (show a URL, collect more args,
|
|
83
|
+
* surface an error).
|
|
84
|
+
*/
|
|
85
|
+
export type EnableResult = {
|
|
86
|
+
status: 'ready';
|
|
87
|
+
/** Anything the impl wants to surface (e.g. master address, wallet address). */
|
|
88
|
+
details?: Record<string, unknown>;
|
|
89
|
+
} | {
|
|
90
|
+
status: 'waiting_for_external_action';
|
|
91
|
+
/** What the operator has to do out-of-band (e.g. approve an api-wallet). */
|
|
92
|
+
action: {
|
|
93
|
+
description: string;
|
|
94
|
+
url?: string;
|
|
95
|
+
};
|
|
96
|
+
details?: Record<string, unknown>;
|
|
97
|
+
/** The exact CLI the agent should re-run once the action is done. */
|
|
98
|
+
nextInvocation: {
|
|
99
|
+
cli: string;
|
|
100
|
+
purpose: string;
|
|
101
|
+
};
|
|
102
|
+
} | {
|
|
103
|
+
status: 'missing_args';
|
|
104
|
+
required: EnableArgDef[];
|
|
105
|
+
example: {
|
|
106
|
+
cli: string;
|
|
107
|
+
};
|
|
108
|
+
} | {
|
|
109
|
+
status: 'error';
|
|
110
|
+
message: string;
|
|
111
|
+
details?: Record<string, unknown>;
|
|
112
|
+
};
|
|
113
|
+
export interface RestorerImpl {
|
|
114
|
+
name: string;
|
|
115
|
+
/** semver */
|
|
116
|
+
version: string;
|
|
117
|
+
/**
|
|
118
|
+
* Return true if this impl should handle the given (kind, type) pair.
|
|
119
|
+
*
|
|
120
|
+
* `type` reflects DesiredState.type:
|
|
121
|
+
* - 'restoration' (or undefined — legacy default): the impl runs a restoration attempt
|
|
122
|
+
* - 'evaluation': the impl runs as an evaluator producing a verdict
|
|
123
|
+
*
|
|
124
|
+
* A restorer impl for kind=X should return true for type !== 'evaluation'.
|
|
125
|
+
* An evaluator impl for kind=X should return true for type === 'evaluation'.
|
|
126
|
+
*/
|
|
127
|
+
supports(ctx: {
|
|
128
|
+
kind: string;
|
|
129
|
+
type?: 'restoration' | 'evaluation';
|
|
130
|
+
}): boolean;
|
|
131
|
+
canAttempt?(intent: DesiredState): Promise<{
|
|
132
|
+
ok: true;
|
|
133
|
+
} | {
|
|
134
|
+
ok: false;
|
|
135
|
+
reason: string;
|
|
136
|
+
}>;
|
|
137
|
+
run(ctx: RestorationContext): Promise<RestorationOutput>;
|
|
138
|
+
/**
|
|
139
|
+
* Context-free readiness probe. Zero-dep impls can omit this (treated
|
|
140
|
+
* as `{ ready: true }`). Impls with external deps (credentials, files,
|
|
141
|
+
* exchange approvals) report current readiness plus a `nextStep` hint.
|
|
142
|
+
*/
|
|
143
|
+
isReady?(): Promise<ReadyStatus>;
|
|
144
|
+
/**
|
|
145
|
+
* Describes what `onEnable` wants from the caller. Consumed by
|
|
146
|
+
* `jinn intents list` so the agent can tell the operator what a
|
|
147
|
+
* specific kind's enable flow needs without triggering it first.
|
|
148
|
+
*/
|
|
149
|
+
enableMetadata?(): IntentEnableMetadata;
|
|
150
|
+
/**
|
|
151
|
+
* Idempotent enable-state machine. Called by `jinn intents enable <kind>`.
|
|
152
|
+
*
|
|
153
|
+
* Contract:
|
|
154
|
+
* - Zero-dep impls return `{ status: 'ready' }` on every call.
|
|
155
|
+
* - Impls with external deps advance as far as they can without
|
|
156
|
+
* blocking, then return a `waiting_for_external_action` envelope
|
|
157
|
+
* the agent surfaces to the operator.
|
|
158
|
+
* - Subsequent invocations pick up where the previous left off.
|
|
159
|
+
* - Calling after already-enabled is a no-op that returns `ready`.
|
|
160
|
+
*
|
|
161
|
+
* `args` is the raw `--key=value` map parsed from the CLI. Impls
|
|
162
|
+
* validate and coerce as needed; missing required args should return
|
|
163
|
+
* `{ status: 'missing_args', required: [...], example: {...} }`.
|
|
164
|
+
*
|
|
165
|
+
* Impls that omit this method cannot be enabled by the generic CLI;
|
|
166
|
+
* they are either always-on (zero-dep) or require manual config.
|
|
167
|
+
*/
|
|
168
|
+
onEnable?(args: Record<string, string | undefined>): Promise<EnableResult>;
|
|
169
|
+
/**
|
|
170
|
+
* Optional inverse of `onEnable`. Invoked when the operator runs
|
|
171
|
+
* `jinn intents disable <kind>`. Should NOT destroy unrecoverable
|
|
172
|
+
* state (generated key material, on-chain registrations); reserve
|
|
173
|
+
* that for explicit `jinn intents purge` or similar (out of scope
|
|
174
|
+
* for this interface).
|
|
175
|
+
*/
|
|
176
|
+
onDisable?(): Promise<void>;
|
|
177
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/restorer/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/dist/store/store.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import Database from 'better-sqlite3';
|
|
1
2
|
export declare class Store {
|
|
2
|
-
|
|
3
|
+
/** Exposed for engine persistence layer — treat as package-internal. */
|
|
4
|
+
readonly db: Database.Database;
|
|
3
5
|
readonly path: string;
|
|
4
6
|
constructor(dbPath: string);
|
|
5
7
|
recordOwnActivity(requestId: string, role: 'created' | 'claimed' | 'delivered' | 'evaluated'): void;
|
package/dist/store/store.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Database from 'better-sqlite3';
|
|
2
2
|
import { mkdirSync } from 'node:fs';
|
|
3
3
|
import { dirname } from 'node:path';
|
|
4
|
+
import { RESTORATION_INTENTS_SCHEMA } from '../restorer/engine/persistence.js';
|
|
4
5
|
const SCHEMA = `
|
|
5
6
|
CREATE TABLE IF NOT EXISTS own_activity (
|
|
6
7
|
request_id TEXT PRIMARY KEY,
|
|
@@ -33,6 +34,7 @@ CREATE INDEX IF NOT EXISTS idx_artifacts_remote ON artifacts (remote);
|
|
|
33
34
|
|
|
34
35
|
`;
|
|
35
36
|
export class Store {
|
|
37
|
+
/** Exposed for engine persistence layer — treat as package-internal. */
|
|
36
38
|
db;
|
|
37
39
|
path;
|
|
38
40
|
constructor(dbPath) {
|
|
@@ -43,6 +45,7 @@ export class Store {
|
|
|
43
45
|
this.db = new Database(dbPath);
|
|
44
46
|
this.db.pragma('journal_mode = WAL');
|
|
45
47
|
this.db.exec(SCHEMA);
|
|
48
|
+
this.db.exec(RESTORATION_INTENTS_SCHEMA);
|
|
46
49
|
}
|
|
47
50
|
recordOwnActivity(requestId, role) {
|
|
48
51
|
this.db.prepare(`INSERT OR REPLACE INTO own_activity (request_id, role) VALUES (?, ?)`).run(requestId, role);
|
package/dist/store/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/store/store.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/store/store.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAE/E,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8Bd,CAAC;AAEF,MAAM,OAAO,KAAK;IAChB,wEAAwE;IAC/D,EAAE,CAAoB;IACtB,IAAI,CAAS;IAEtB,YAAY,MAAc;QACxB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC;QACnB,IAAI,MAAM,KAAK,UAAU,EAAE,CAAC;YAC1B,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE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AAC,GAAG,CAAC,EAAE,CAA2C,CAAC;QAC5H,OAAO,GAAG,EAAE,OAAO,IAAI,IAAI,CAAC;IAC9B,CAAC;IAED,qBAAqB,CAAC,EAAU;QAC9B,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CACzB,kFAAkF,CACnF,CAAC,GAAG,CAAC,EAAE,CAAkF,CAAC;QAC3F,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC;QACtB,OAAO;YACL,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,YAAY,EAAE,GAAG,CAAC,aAAa;YAC/B,KAAK,EAAE,GAAG,CAAC,KAAK,IAAI,SAAS;SAC9B,CAAC;IACJ,CAAC;IAED,sBAAsB,CAAC,SAAiB,EAAE,GAAW;QACnD,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CACzB,+HAA+H,CAChI,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,GAAG,GAAG,CAA8F,CAAC;QAC1H,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC;QACtB,OAAO,EAAE,GAAG,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAa,EAAE,CAAC;IAC5D,CAAC;IAED,kBAAkB,CAAC,EAAU,EAAE,OAAe;QAC5C,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,+CAA+C,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACpF,CAAC;IAED,KAAK;QACH,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -1,17 +1,62 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export type RequestId = string;
|
|
3
|
+
export declare const WindowSchema: z.ZodObject<{
|
|
4
|
+
startTs: z.ZodNumber;
|
|
5
|
+
endTs: z.ZodNumber;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
startTs: number;
|
|
8
|
+
endTs: number;
|
|
9
|
+
}, {
|
|
10
|
+
startTs: number;
|
|
11
|
+
endTs: number;
|
|
12
|
+
}>;
|
|
13
|
+
export type Window = z.infer<typeof WindowSchema>;
|
|
3
14
|
export declare const DesiredStateSchema: z.ZodObject<{
|
|
4
15
|
id: z.ZodOptional<z.ZodString>;
|
|
5
16
|
description: z.ZodString;
|
|
6
17
|
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
18
|
+
window: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
startTs: z.ZodNumber;
|
|
20
|
+
endTs: z.ZodNumber;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
startTs: number;
|
|
23
|
+
endTs: number;
|
|
24
|
+
}, {
|
|
25
|
+
startTs: number;
|
|
26
|
+
endTs: number;
|
|
27
|
+
}>>;
|
|
28
|
+
spec: z.ZodOptional<z.ZodIntersection<z.ZodObject<{
|
|
29
|
+
kind: z.ZodString;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
kind: string;
|
|
32
|
+
}, {
|
|
33
|
+
kind: string;
|
|
34
|
+
}>, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
35
|
+
eligibility: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
7
36
|
}, "strip", z.ZodTypeAny, {
|
|
8
37
|
description: string;
|
|
9
38
|
id?: string | undefined;
|
|
10
39
|
context?: Record<string, unknown> | undefined;
|
|
40
|
+
window?: {
|
|
41
|
+
startTs: number;
|
|
42
|
+
endTs: number;
|
|
43
|
+
} | undefined;
|
|
44
|
+
spec?: ({
|
|
45
|
+
kind: string;
|
|
46
|
+
} & Record<string, unknown>) | undefined;
|
|
47
|
+
eligibility?: Record<string, unknown> | undefined;
|
|
11
48
|
}, {
|
|
12
49
|
description: string;
|
|
13
50
|
id?: string | undefined;
|
|
14
51
|
context?: Record<string, unknown> | undefined;
|
|
52
|
+
window?: {
|
|
53
|
+
startTs: number;
|
|
54
|
+
endTs: number;
|
|
55
|
+
} | undefined;
|
|
56
|
+
spec?: ({
|
|
57
|
+
kind: string;
|
|
58
|
+
} & Record<string, unknown>) | undefined;
|
|
59
|
+
eligibility?: Record<string, unknown> | undefined;
|
|
15
60
|
}>;
|
|
16
61
|
export interface DesiredState {
|
|
17
62
|
id: string;
|
|
@@ -21,6 +66,11 @@ export interface DesiredState {
|
|
|
21
66
|
attemptId?: string;
|
|
22
67
|
attemptNumber?: number;
|
|
23
68
|
restorationRequestId?: string;
|
|
69
|
+
window?: Window;
|
|
70
|
+
spec?: {
|
|
71
|
+
kind: string;
|
|
72
|
+
} & Record<string, unknown>;
|
|
73
|
+
eligibility?: Record<string, unknown>;
|
|
24
74
|
}
|
|
25
75
|
export declare function parseDesiredState(input: unknown): DesiredState;
|
|
26
76
|
export interface RestorationRequest {
|
|
@@ -28,6 +78,9 @@ export interface RestorationRequest {
|
|
|
28
78
|
desiredState: DesiredState;
|
|
29
79
|
payment?: string;
|
|
30
80
|
timeout?: number;
|
|
81
|
+
intentCid?: string;
|
|
82
|
+
onchainCreationTx?: `0x${string}`;
|
|
83
|
+
onchainCreationBlock?: number;
|
|
31
84
|
}
|
|
32
85
|
export interface RestorationResult {
|
|
33
86
|
data: string;
|
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
// ── Window ───────────────────────────────────────────────────────────────────
|
|
4
|
+
export const WindowSchema = z.object({
|
|
5
|
+
startTs: z.number().int(),
|
|
6
|
+
endTs: z.number().int(),
|
|
7
|
+
});
|
|
8
|
+
// ── DesiredState schema ───────────────────────────────────────────────────────
|
|
3
9
|
export const DesiredStateSchema = z.object({
|
|
4
10
|
id: z.string().optional(),
|
|
5
11
|
description: z.string().min(1),
|
|
6
12
|
context: z.record(z.unknown()).optional(),
|
|
13
|
+
// §3 — optional lifecycle window
|
|
14
|
+
window: WindowSchema.optional(),
|
|
15
|
+
// §3 — typed intent specification; dispatcher on `kind`
|
|
16
|
+
spec: z
|
|
17
|
+
.object({
|
|
18
|
+
kind: z.string(),
|
|
19
|
+
})
|
|
20
|
+
.and(z.record(z.unknown()))
|
|
21
|
+
.optional(),
|
|
22
|
+
// §3 — pre-claim and post-hoc qualifying rules; shape governed by spec.kind
|
|
23
|
+
eligibility: z.record(z.unknown()).optional(),
|
|
7
24
|
});
|
|
8
25
|
export function parseDesiredState(input) {
|
|
9
26
|
const parsed = DesiredStateSchema.parse(input);
|
|
@@ -11,6 +28,9 @@ export function parseDesiredState(input) {
|
|
|
11
28
|
id: parsed.id ?? randomUUID(),
|
|
12
29
|
description: parsed.description,
|
|
13
30
|
context: parsed.context,
|
|
31
|
+
window: parsed.window,
|
|
32
|
+
spec: parsed.spec,
|
|
33
|
+
eligibility: parsed.eligibility,
|
|
14
34
|
};
|
|
15
35
|
}
|
|
16
36
|
//# sourceMappingURL=desired-state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"desired-state.js","sourceRoot":"","sources":["../../src/types/desired-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;
|
|
1
|
+
{"version":3,"file":"desired-state.js","sourceRoot":"","sources":["../../src/types/desired-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,a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M,EAAE,MAAM,CAAC,MAAM;QACrB,IAAI,EAAE,MAAM,CAAC,IAA4B;QACzC,WAAW,EAAE,MAAM,CAAC,WAAW;KAChC,CAAC;AACJ,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export { type DesiredState, type RequestId, type RestorationRequest, type RestorationResult, type DeliveredResult, parseDesiredState, } from './desired-state.js';
|
|
1
|
+
export { type DesiredState, type RequestId, type RestorationRequest, type RestorationResult, type DeliveredResult, type Window, parseDesiredState, WindowSchema, DesiredStateSchema, } from './desired-state.js';
|
|
2
|
+
export { PortfolioV0SpecSchema, PortfolioV0EligibilitySchema, PortfolioV0IntentSchema, RestorationManifestSchema, VerdictManifestSchema, type Artifact, type PortfolioV0Spec, type PortfolioV0Eligibility, type PortfolioV0Intent, type RestorationManifest, type VerdictManifest, } from './portfolio.js';
|
|
2
3
|
export { TransientError, PermanentError } from './errors.js';
|
|
4
|
+
export { PredictionV0SpecSchema, PredictionV0EligibilitySchema, PredictionV0IntentSchema, PredictionSubmissionManifestSchema, PredictionVerdictManifestSchema, type PredictionV0Spec, type PredictionV0Eligibility, type PredictionV0Intent, type PredictionSubmissionManifest, type PredictionVerdictManifest, } from './prediction.js';
|
|
5
|
+
export { PredictionApyV0SpecSchema, PredictionApyV0EligibilitySchema, PredictionApyV0IntentSchema, PredictionApySubmissionManifestSchema, PredictionApyVerdictManifestSchema, type PredictionApyV0Spec, type PredictionApyV0Eligibility, type PredictionApyV0Intent, type PredictionApySubmissionManifest, type PredictionApyVerdictManifest, } from './prediction-apy.js';
|
package/dist/types/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
export { parseDesiredState, } from './desired-state.js';
|
|
1
|
+
export { parseDesiredState, WindowSchema, DesiredStateSchema, } from './desired-state.js';
|
|
2
|
+
export { PortfolioV0SpecSchema, PortfolioV0EligibilitySchema, PortfolioV0IntentSchema, RestorationManifestSchema, VerdictManifestSchema, } from './portfolio.js';
|
|
2
3
|
export { TransientError, PermanentError } from './errors.js';
|
|
4
|
+
export { PredictionV0SpecSchema, PredictionV0EligibilitySchema, PredictionV0IntentSchema, PredictionSubmissionManifestSchema, PredictionVerdictManifestSchema, } from './prediction.js';
|
|
5
|
+
export { PredictionApyV0SpecSchema, PredictionApyV0EligibilitySchema, PredictionApyV0IntentSchema, PredictionApySubmissionManifestSchema, PredictionApyVerdictManifestSchema, } from './prediction-apy.js';
|
|
3
6
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,GAOtB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,wBAAwB,EACxB,kCAAkC,EAClC,+BAA+B,GAMhC,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,yBAAyB,EACzB,gCAAgC,EAChC,2BAA2B,EAC3B,qCAAqC,EACrC,kCAAkC,GAMnC,MAAM,qBAAqB,CAAC"}
|