@jinn-network/client 0.1.6-canary.fb9c8196 → 0.1.6
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/api/bootstrap-endpoint.js +0 -45
- package/dist/api/bootstrap-endpoint.js.map +1 -1
- package/dist/api/fleet-build.d.ts +0 -1
- package/dist/api/fleet-build.js +1 -2
- package/dist/api/fleet-build.js.map +1 -1
- package/dist/api/gather-status.js +1 -68
- package/dist/api/gather-status.js.map +1 -1
- package/dist/api/hermes-doctor-endpoint.d.ts +0 -10
- package/dist/api/hermes-doctor-endpoint.js +23 -30
- package/dist/api/hermes-doctor-endpoint.js.map +1 -1
- package/dist/api/setup-endpoints.d.ts +0 -16
- package/dist/api/setup-endpoints.js +0 -28
- package/dist/api/setup-endpoints.js.map +1 -1
- package/dist/api/status-build.d.ts +0 -14
- package/dist/api/status-build.js +18 -23
- package/dist/api/status-build.js.map +1 -1
- package/dist/build-info.json +4 -4
- package/dist/build-meta.json +1 -1
- package/dist/cli/commands/solver-nets.js +9 -24
- package/dist/cli/commands/solver-nets.js.map +1 -1
- package/dist/config.d.ts +0 -9
- package/dist/config.js +0 -7
- package/dist/config.js.map +1 -1
- package/dist/daemon/daemon.d.ts +0 -8
- package/dist/daemon/daemon.js +0 -17
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/dashboard/assets/{index-CarzUepP.css → index-DOlzFN8a.css} +1 -1
- package/dist/dashboard/assets/index-NkZ7CTAT.js +140 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/earning/bootstrap.d.ts +0 -59
- package/dist/earning/bootstrap.js +41 -139
- package/dist/earning/bootstrap.js.map +1 -1
- package/dist/earning/contracts.d.ts +0 -12
- package/dist/earning/contracts.js +0 -7
- package/dist/earning/contracts.js.map +1 -1
- package/dist/earning/funding-plan.js.map +1 -1
- package/dist/earning/jinn-rewards.d.ts +0 -46
- package/dist/earning/jinn-rewards.js +0 -32
- package/dist/earning/jinn-rewards.js.map +1 -1
- package/dist/earning/testnet-setup-migration.d.ts +0 -12
- package/dist/earning/testnet-setup-migration.js +1 -17
- package/dist/earning/testnet-setup-migration.js.map +1 -1
- package/dist/earning/types.d.ts +0 -15
- package/dist/harnesses/impls/hermes-agent/harness.d.ts +1 -23
- package/dist/harnesses/impls/hermes-agent/harness.js +0 -49
- package/dist/harnesses/impls/hermes-agent/harness.js.map +1 -1
- package/dist/harnesses/impls/index.d.ts +0 -2
- package/dist/harnesses/impls/index.js +1 -5
- package/dist/harnesses/impls/index.js.map +1 -1
- package/dist/main.js +30 -204
- package/dist/main.js.map +1 -1
- package/dist/operator-errors.d.ts +0 -7
- package/dist/operator-errors.js +1 -13
- package/dist/operator-errors.js.map +1 -1
- package/dist/solver-nets/prediction-operator-ux.js +3 -24
- package/dist/solver-nets/prediction-operator-ux.js.map +1 -1
- package/dist/solver-nets/registry.d.ts +0 -1
- package/dist/solver-nets/registry.js +1 -1
- package/dist/solver-nets/registry.js.map +1 -1
- package/package.json +1 -1
- package/dist/api/setup-retry-endpoint.d.ts +0 -19
- package/dist/api/setup-retry-endpoint.js +0 -32
- package/dist/api/setup-retry-endpoint.js.map +0 -1
- package/dist/daemon/eviction-loop.d.ts +0 -40
- package/dist/daemon/eviction-loop.js +0 -67
- package/dist/daemon/eviction-loop.js.map +0 -1
- package/dist/dashboard/assets/index-C_QnE4YV.js +0 -140
- package/dist/harnesses/cost-estimates.d.ts +0 -145
- package/dist/harnesses/cost-estimates.js +0 -297
- package/dist/harnesses/cost-estimates.js.map +0 -1
- package/dist/restart-daemon.d.ts +0 -71
- package/dist/restart-daemon.js +0 -82
- package/dist/restart-daemon.js.map +0 -1
- package/dist/setup/halt-mode.d.ts +0 -14
- package/dist/setup/halt-mode.js +0 -17
- package/dist/setup/halt-mode.js.map +0 -1
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
function serializeError(err) {
|
|
2
|
-
if (err instanceof Error)
|
|
3
|
-
return err.message;
|
|
4
|
-
if (typeof err === 'string')
|
|
5
|
-
return err;
|
|
6
|
-
try {
|
|
7
|
-
return JSON.stringify(err);
|
|
8
|
-
}
|
|
9
|
-
catch {
|
|
10
|
-
return String(err);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export function addSetupRetryEndpoint(app, deps) {
|
|
14
|
-
// In-flight promise for idempotency: concurrent POST /retry calls share the
|
|
15
|
-
// same bootstrap attempt rather than forking two state machines.
|
|
16
|
-
let inFlight = null;
|
|
17
|
-
app.post('/v1/setup/bootstrap/retry', async (c) => {
|
|
18
|
-
if (!inFlight) {
|
|
19
|
-
inFlight = deps.retryBootstrap().finally(() => {
|
|
20
|
-
inFlight = null;
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
try {
|
|
24
|
-
await inFlight;
|
|
25
|
-
return c.json({ ok: true });
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
28
|
-
return c.json({ ok: false, error: serializeError(err) }, 500);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=setup-retry-endpoint.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setup-retry-endpoint.js","sourceRoot":"","sources":["../../src/api/setup-retry-endpoint.ts"],"names":[],"mappings":"AAoBA,SAAS,cAAc,CAAC,GAAY;IAClC,IAAI,GAAG,YAAY,KAAK;QAAE,OAAO,GAAG,CAAC,OAAO,CAAC;IAC7C,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAC;IACxC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,GAAS,EAAE,IAAoB;IACnE,4EAA4E;IAC5E,iEAAiE;IACjE,IAAI,QAAQ,GAAyB,IAAI,CAAC;IAE1C,GAAG,CAAC,IAAI,CAAC,2BAA2B,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QAChD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,QAAQ,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;gBAC5C,QAAQ,GAAG,IAAI,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC;YACH,MAAM,QAAQ,CAAC;YACf,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QAChE,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Periodic eviction-check + auto-restake loop (jinn-mono-hjex.3).
|
|
3
|
-
*
|
|
4
|
-
* Polls the staking proxy's getStakingState for each complete service. When
|
|
5
|
-
* state === 2 (Evicted) it calls the injected `recoverEvictedService` helper
|
|
6
|
-
* so the service is restaked without requiring a daemon restart.
|
|
7
|
-
*
|
|
8
|
-
* Scheduling: interval from config (default 60s). Set to 0 to disable.
|
|
9
|
-
* Env: JINN_EVICTION_CHECK_INTERVAL_MS
|
|
10
|
-
*/
|
|
11
|
-
import { STAKING_ABI } from '../earning/contracts.js';
|
|
12
|
-
import type { FleetStateStore } from '../earning/store.js';
|
|
13
|
-
import type { JinnOnchainNetwork } from '../earning/viem-clients.js';
|
|
14
|
-
import { type ServiceState } from '../earning/types.js';
|
|
15
|
-
export type EvictionLoopReadContract = (opts: {
|
|
16
|
-
address: `0x${string}`;
|
|
17
|
-
abi: typeof STAKING_ABI;
|
|
18
|
-
functionName: 'getStakingState';
|
|
19
|
-
args: [bigint];
|
|
20
|
-
}) => Promise<bigint | number>;
|
|
21
|
-
export interface EvictionLoopConfig {
|
|
22
|
-
intervalMs: number;
|
|
23
|
-
store: FleetStateStore;
|
|
24
|
-
chain: JinnOnchainNetwork;
|
|
25
|
-
readContract: EvictionLoopReadContract;
|
|
26
|
-
/**
|
|
27
|
-
* Injected recovery function. In production this wraps
|
|
28
|
-
* `recoverEvictedService` from `../earning/bootstrap.js`.
|
|
29
|
-
* Accepts a ServiceState and kicks off the reStake call.
|
|
30
|
-
*/
|
|
31
|
-
recoverEvictedService: (svc: ServiceState) => Promise<void>;
|
|
32
|
-
}
|
|
33
|
-
export declare class EvictionLoop {
|
|
34
|
-
private readonly config;
|
|
35
|
-
private stopped;
|
|
36
|
-
constructor(config: EvictionLoopConfig);
|
|
37
|
-
stop(): void;
|
|
38
|
-
runOnce(): Promise<void>;
|
|
39
|
-
run(): Promise<void>;
|
|
40
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Periodic eviction-check + auto-restake loop (jinn-mono-hjex.3).
|
|
3
|
-
*
|
|
4
|
-
* Polls the staking proxy's getStakingState for each complete service. When
|
|
5
|
-
* state === 2 (Evicted) it calls the injected `recoverEvictedService` helper
|
|
6
|
-
* so the service is restaked without requiring a daemon restart.
|
|
7
|
-
*
|
|
8
|
-
* Scheduling: interval from config (default 60s). Set to 0 to disable.
|
|
9
|
-
* Env: JINN_EVICTION_CHECK_INTERVAL_MS
|
|
10
|
-
*/
|
|
11
|
-
import { getAddress } from 'viem';
|
|
12
|
-
import { STAKING_ABI } from '../earning/contracts.js';
|
|
13
|
-
import { displayFleetServiceIndex } from '../earning/fleet-display-index.js';
|
|
14
|
-
import { isStakedLikeServiceStep } from '../earning/types.js';
|
|
15
|
-
// ---------------------------------------------------------------------------
|
|
16
|
-
// EvictionLoop
|
|
17
|
-
// ---------------------------------------------------------------------------
|
|
18
|
-
export class EvictionLoop {
|
|
19
|
-
config;
|
|
20
|
-
stopped = false;
|
|
21
|
-
constructor(config) {
|
|
22
|
-
this.config = config;
|
|
23
|
-
}
|
|
24
|
-
stop() {
|
|
25
|
-
this.stopped = true;
|
|
26
|
-
}
|
|
27
|
-
async runOnce() {
|
|
28
|
-
const state = await this.config.store.load(this.config.chain);
|
|
29
|
-
for (const svc of state.services) {
|
|
30
|
-
if (!svc.service_id || !svc.staking_address)
|
|
31
|
-
continue;
|
|
32
|
-
if (!isStakedLikeServiceStep(svc.step))
|
|
33
|
-
continue;
|
|
34
|
-
const displayIndex = displayFleetServiceIndex(svc);
|
|
35
|
-
try {
|
|
36
|
-
const stakingState = await this.config.readContract({
|
|
37
|
-
address: getAddress(svc.staking_address),
|
|
38
|
-
abi: STAKING_ABI,
|
|
39
|
-
functionName: 'getStakingState',
|
|
40
|
-
args: [BigInt(svc.service_id)],
|
|
41
|
-
});
|
|
42
|
-
if (Number(stakingState) === 2) {
|
|
43
|
-
console.error(`[eviction-loop] Service ${displayIndex} (service_id ${svc.service_id}) is evicted; triggering auto-restake`);
|
|
44
|
-
await this.config.recoverEvictedService(svc);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
catch (err) {
|
|
48
|
-
console.error(`[eviction-loop] Service ${displayIndex}: error checking staking state (non-fatal): ${err instanceof Error ? err.message : err}`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
async run() {
|
|
53
|
-
if (this.config.intervalMs <= 0) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
while (!this.stopped) {
|
|
57
|
-
try {
|
|
58
|
-
await this.runOnce();
|
|
59
|
-
}
|
|
60
|
-
catch (err) {
|
|
61
|
-
console.error('[eviction-loop] Tick failed (non-fatal):', err instanceof Error ? err.message : err);
|
|
62
|
-
}
|
|
63
|
-
await new Promise(r => setTimeout(r, this.config.intervalMs));
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
//# source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