vana-cli 0.15.0 → 0.23.3
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/README.md +73 -15
- package/dist/cli/app/ask.d.ts +38 -0
- package/dist/cli/app/ask.d.ts.map +1 -0
- package/dist/cli/app/ask.js +110 -0
- package/dist/cli/app/ask.js.map +1 -0
- package/dist/cli/app/derivatives.d.ts +41 -0
- package/dist/cli/app/derivatives.d.ts.map +1 -0
- package/dist/cli/app/derivatives.js +227 -0
- package/dist/cli/app/derivatives.js.map +1 -0
- package/dist/cli/app/escrow.d.ts +44 -0
- package/dist/cli/app/escrow.d.ts.map +1 -0
- package/dist/cli/app/escrow.js +275 -0
- package/dist/cli/app/escrow.js.map +1 -0
- package/dist/cli/app/index.d.ts +11 -0
- package/dist/cli/app/index.d.ts.map +1 -0
- package/dist/cli/app/index.js +151 -0
- package/dist/cli/app/index.js.map +1 -0
- package/dist/cli/app/onchain.d.ts +14 -0
- package/dist/cli/app/onchain.d.ts.map +1 -0
- package/dist/cli/app/onchain.js +84 -0
- package/dist/cli/app/onchain.js.map +1 -0
- package/dist/cli/app/outcome.d.ts +45 -0
- package/dist/cli/app/outcome.d.ts.map +1 -0
- package/dist/cli/app/outcome.js +55 -0
- package/dist/cli/app/outcome.js.map +1 -0
- package/dist/cli/app/read.d.ts +43 -0
- package/dist/cli/app/read.d.ts.map +1 -0
- package/dist/cli/app/read.js +429 -0
- package/dist/cli/app/read.js.map +1 -0
- package/dist/cli/app/register.d.ts +34 -0
- package/dist/cli/app/register.d.ts.map +1 -0
- package/dist/cli/app/register.js +113 -0
- package/dist/cli/app/register.js.map +1 -0
- package/dist/cli/app/request.d.ts +50 -0
- package/dist/cli/app/request.d.ts.map +1 -0
- package/dist/cli/app/request.js +252 -0
- package/dist/cli/app/request.js.map +1 -0
- package/dist/cli/app/requests.d.ts +21 -0
- package/dist/cli/app/requests.d.ts.map +1 -0
- package/dist/cli/app/requests.js +163 -0
- package/dist/cli/app/requests.js.map +1 -0
- package/dist/cli/app/whoami.d.ts +13 -0
- package/dist/cli/app/whoami.d.ts.map +1 -0
- package/dist/cli/app/whoami.js +71 -0
- package/dist/cli/app/whoami.js.map +1 -0
- package/dist/cli/auth.d.ts +18 -0
- package/dist/cli/auth.d.ts.map +1 -1
- package/dist/cli/auth.js +109 -7
- package/dist/cli/auth.js.map +1 -1
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +307 -49
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/mcp-server.d.ts.map +1 -1
- package/dist/cli/mcp-server.js +32 -3
- package/dist/cli/mcp-server.js.map +1 -1
- package/dist/core/app-key.d.ts +50 -0
- package/dist/core/app-key.d.ts.map +1 -0
- package/dist/core/app-key.js +171 -0
- package/dist/core/app-key.js.map +1 -0
- package/dist/core/assets.d.ts +33 -0
- package/dist/core/assets.d.ts.map +1 -0
- package/dist/core/assets.js +87 -0
- package/dist/core/assets.js.map +1 -0
- package/dist/core/cli-types.d.ts +30 -0
- package/dist/core/cli-types.d.ts.map +1 -1
- package/dist/core/cli-types.js +16 -0
- package/dist/core/cli-types.js.map +1 -1
- package/dist/core/exit-codes.d.ts +48 -0
- package/dist/core/exit-codes.d.ts.map +1 -0
- package/dist/core/exit-codes.js +96 -0
- package/dist/core/exit-codes.js.map +1 -0
- package/dist/core/network.d.ts +52 -0
- package/dist/core/network.d.ts.map +1 -0
- package/dist/core/network.js +83 -0
- package/dist/core/network.js.map +1 -0
- package/dist/core/paths.d.ts +4 -2
- package/dist/core/paths.d.ts.map +1 -1
- package/dist/core/paths.js +8 -6
- package/dist/core/paths.js.map +1 -1
- package/dist/core/receipts.d.ts +37 -0
- package/dist/core/receipts.d.ts.map +1 -0
- package/dist/core/receipts.js +72 -0
- package/dist/core/receipts.js.map +1 -0
- package/dist/core/requests-store.d.ts +54 -0
- package/dist/core/requests-store.d.ts.map +1 -0
- package/dist/core/requests-store.js +83 -0
- package/dist/core/requests-store.js.map +1 -0
- package/dist/personal-server/registered.d.ts +25 -0
- package/dist/personal-server/registered.d.ts.map +1 -0
- package/dist/personal-server/registered.js +49 -0
- package/dist/personal-server/registered.js.map +1 -0
- package/dist/server/request-signer.d.ts.map +1 -1
- package/dist/server/request-signer.js +7 -24
- package/dist/server/request-signer.js.map +1 -1
- package/dist/server/session-relay.d.ts +6 -5
- package/dist/server/session-relay.d.ts.map +1 -1
- package/dist/server/session-relay.js +48 -51
- package/dist/server/session-relay.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one exit-code table for the whole binary.
|
|
3
|
+
*
|
|
4
|
+
* The previous contract was 0/1 only (every failure path returned 1, bad
|
|
5
|
+
* usage inherited commander's 1), while docs/CLI-AGENT-FRIENDLY.md claimed a
|
|
6
|
+
* different set of meanings for 2-5 that was never implemented. Both are
|
|
7
|
+
* replaced by this table; docs/CLI-EXIT-CODE-MATRIX.md is the human copy.
|
|
8
|
+
*
|
|
9
|
+
* Codes exist so an agent can branch without parsing prose. The JSON
|
|
10
|
+
* outcome's `code` field carries the finer-grained reason.
|
|
11
|
+
*/
|
|
12
|
+
import { CliOutcomeStatus } from "./cli-types.js";
|
|
13
|
+
export declare const CliExitCode: {
|
|
14
|
+
/** Done. */
|
|
15
|
+
readonly OK: 0;
|
|
16
|
+
/** Failed for a reason no other code names. */
|
|
17
|
+
readonly FAILURE: 1;
|
|
18
|
+
/** Bad usage: unknown command, unknown option, missing argument. */
|
|
19
|
+
readonly USAGE: 2;
|
|
20
|
+
/** No grant, or the grant does not cover this. */
|
|
21
|
+
readonly NO_GRANT: 3;
|
|
22
|
+
/** Payment required and not settled. */
|
|
23
|
+
readonly PAYMENT_REQUIRED: 4;
|
|
24
|
+
/** No server holding this data answered (incl. owner not ready). */
|
|
25
|
+
readonly SERVER_UNAVAILABLE: 5;
|
|
26
|
+
/** Not ready yet, come back. */
|
|
27
|
+
readonly NOT_READY: 6;
|
|
28
|
+
/** A person has to confirm before this can proceed. */
|
|
29
|
+
readonly CONFIRMATION_REQUIRED: 7;
|
|
30
|
+
};
|
|
31
|
+
export type CliExitCode = (typeof CliExitCode)[keyof typeof CliExitCode];
|
|
32
|
+
/**
|
|
33
|
+
* Exit code for an owner-side outcome status.
|
|
34
|
+
*
|
|
35
|
+
* Only statuses with an unambiguous slot in the table map to a distinct
|
|
36
|
+
* code; the rest stay {@link CliExitCode.FAILURE} with the status itself in
|
|
37
|
+
* the JSON payload. Success statuses map to OK.
|
|
38
|
+
*/
|
|
39
|
+
export declare function exitCodeForOutcome(status: CliOutcomeStatus): CliExitCode;
|
|
40
|
+
/**
|
|
41
|
+
* Protocol-level error classes the builder command group maps onto the
|
|
42
|
+
* table. Keys are the stable `code` values emitted in JSON outcomes.
|
|
43
|
+
*/
|
|
44
|
+
export declare const PROTOCOL_EXIT_MAP: Record<string, CliExitCode>;
|
|
45
|
+
/** Lowercase and strip the transport prefixes real SDK codes carry. */
|
|
46
|
+
export declare function normalizeProtocolCode(code: string): string;
|
|
47
|
+
export declare function exitCodeForProtocolCode(code: string): CliExitCode;
|
|
48
|
+
//# sourceMappingURL=exit-codes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exit-codes.d.ts","sourceRoot":"","sources":["../../src/core/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,eAAO,MAAM,WAAW;IACtB,YAAY;;IAEZ,+CAA+C;;IAE/C,oEAAoE;;IAEpE,kDAAkD;;IAElD,wCAAwC;;IAExC,oEAAoE;;IAEpE,gCAAgC;;IAEhC,uDAAuD;;CAE/C,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAEzE;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,WAAW,CAYxE;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAezD,CAAC;AAoBF,uEAAuE;AACvE,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG1D;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAEjE"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one exit-code table for the whole binary.
|
|
3
|
+
*
|
|
4
|
+
* The previous contract was 0/1 only (every failure path returned 1, bad
|
|
5
|
+
* usage inherited commander's 1), while docs/CLI-AGENT-FRIENDLY.md claimed a
|
|
6
|
+
* different set of meanings for 2-5 that was never implemented. Both are
|
|
7
|
+
* replaced by this table; docs/CLI-EXIT-CODE-MATRIX.md is the human copy.
|
|
8
|
+
*
|
|
9
|
+
* Codes exist so an agent can branch without parsing prose. The JSON
|
|
10
|
+
* outcome's `code` field carries the finer-grained reason.
|
|
11
|
+
*/
|
|
12
|
+
import { CliOutcomeStatus } from "./cli-types.js";
|
|
13
|
+
export const CliExitCode = {
|
|
14
|
+
/** Done. */
|
|
15
|
+
OK: 0,
|
|
16
|
+
/** Failed for a reason no other code names. */
|
|
17
|
+
FAILURE: 1,
|
|
18
|
+
/** Bad usage: unknown command, unknown option, missing argument. */
|
|
19
|
+
USAGE: 2,
|
|
20
|
+
/** No grant, or the grant does not cover this. */
|
|
21
|
+
NO_GRANT: 3,
|
|
22
|
+
/** Payment required and not settled. */
|
|
23
|
+
PAYMENT_REQUIRED: 4,
|
|
24
|
+
/** No server holding this data answered (incl. owner not ready). */
|
|
25
|
+
SERVER_UNAVAILABLE: 5,
|
|
26
|
+
/** Not ready yet, come back. */
|
|
27
|
+
NOT_READY: 6,
|
|
28
|
+
/** A person has to confirm before this can proceed. */
|
|
29
|
+
CONFIRMATION_REQUIRED: 7,
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Exit code for an owner-side outcome status.
|
|
33
|
+
*
|
|
34
|
+
* Only statuses with an unambiguous slot in the table map to a distinct
|
|
35
|
+
* code; the rest stay {@link CliExitCode.FAILURE} with the status itself in
|
|
36
|
+
* the JSON payload. Success statuses map to OK.
|
|
37
|
+
*/
|
|
38
|
+
export function exitCodeForOutcome(status) {
|
|
39
|
+
switch (status) {
|
|
40
|
+
case CliOutcomeStatus.CONNECTED_AND_INGESTED:
|
|
41
|
+
case CliOutcomeStatus.CONNECTED_LOCAL_ONLY:
|
|
42
|
+
return CliExitCode.OK;
|
|
43
|
+
case CliOutcomeStatus.PERSONAL_SERVER_UNAVAILABLE:
|
|
44
|
+
return CliExitCode.SERVER_UNAVAILABLE;
|
|
45
|
+
case CliOutcomeStatus.NEEDS_INPUT:
|
|
46
|
+
return CliExitCode.CONFIRMATION_REQUIRED;
|
|
47
|
+
default:
|
|
48
|
+
return CliExitCode.FAILURE;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Protocol-level error classes the builder command group maps onto the
|
|
53
|
+
* table. Keys are the stable `code` values emitted in JSON outcomes.
|
|
54
|
+
*/
|
|
55
|
+
export const PROTOCOL_EXIT_MAP = {
|
|
56
|
+
ok: CliExitCode.OK,
|
|
57
|
+
bad_usage: CliExitCode.USAGE,
|
|
58
|
+
grant_invalid: CliExitCode.NO_GRANT,
|
|
59
|
+
grant_revoked: CliExitCode.NO_GRANT,
|
|
60
|
+
payment_required: CliExitCode.PAYMENT_REQUIRED,
|
|
61
|
+
max_fee_exceeded: CliExitCode.PAYMENT_REQUIRED,
|
|
62
|
+
server_unavailable: CliExitCode.SERVER_UNAVAILABLE,
|
|
63
|
+
scope_not_found: CliExitCode.SERVER_UNAVAILABLE,
|
|
64
|
+
owner_not_ready: CliExitCode.SERVER_UNAVAILABLE,
|
|
65
|
+
not_ready: CliExitCode.NOT_READY,
|
|
66
|
+
version_mismatch: CliExitCode.NOT_READY,
|
|
67
|
+
confirmation_required: CliExitCode.CONFIRMATION_REQUIRED,
|
|
68
|
+
builder_unknown: CliExitCode.FAILURE,
|
|
69
|
+
internal: CliExitCode.FAILURE,
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Aliases for codes the SDK and gateway actually emit (jobs-client error
|
|
73
|
+
* `.code` values, gateway admission codes), normalized onto the table's
|
|
74
|
+
* stable keys. Extend here as the adapter meets new shapes; unknown codes
|
|
75
|
+
* stay FAILURE rather than guessing.
|
|
76
|
+
*/
|
|
77
|
+
const PROTOCOL_CODE_ALIASES = {
|
|
78
|
+
job_owner_not_ready: "owner_not_ready",
|
|
79
|
+
job_grant_invalid: "grant_invalid",
|
|
80
|
+
job_timeout: "not_ready",
|
|
81
|
+
job_not_found: "internal",
|
|
82
|
+
job_id_taken: "internal",
|
|
83
|
+
job_request_too_large: "bad_usage",
|
|
84
|
+
builder_unknown: "builder_unknown",
|
|
85
|
+
grant_invalid: "grant_invalid",
|
|
86
|
+
owner_not_ready: "owner_not_ready",
|
|
87
|
+
};
|
|
88
|
+
/** Lowercase and strip the transport prefixes real SDK codes carry. */
|
|
89
|
+
export function normalizeProtocolCode(code) {
|
|
90
|
+
const lower = code.trim().toLowerCase();
|
|
91
|
+
return PROTOCOL_CODE_ALIASES[lower] ?? lower;
|
|
92
|
+
}
|
|
93
|
+
export function exitCodeForProtocolCode(code) {
|
|
94
|
+
return PROTOCOL_EXIT_MAP[normalizeProtocolCode(code)] ?? CliExitCode.FAILURE;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=exit-codes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exit-codes.js","sourceRoot":"","sources":["../../src/core/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB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AAW,CAAC,qBAAqB;IACxD,eAAe,EAAE,WAAW,CAAC,OAAO;IACpC,QAAQ,EAAE,WAAW,CAAC,OAAO;CAC9B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,qBAAqB,GAA2B;IACpD,mBAAmB,EAAE,iBAAiB;IACtC,iBAAiB,EAAE,eAAe;IAClC,WAAW,EAAE,WAAW;IACxB,aAAa,EAAE,UAAU;IACzB,YAAY,EAAE,UAAU;IACxB,qBAAqB,EAAE,WAAW;IAClC,eAAe,EAAE,iBAAiB;IAClC,aAAa,EAAE,eAAe;IAC9B,eAAe,EAAE,iBAAiB;CACnC,CAAC;AAEF,uEAAuE;AACvE,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACxC,OAAO,qBAAqB,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,IAAY;IAClD,OAAO,iBAAiB,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolved network configuration for builder-side commands.
|
|
3
|
+
*
|
|
4
|
+
* The owner-side commands keep using {@link getEnvConfig} from constants.ts
|
|
5
|
+
* (a dev/prod host axis) untouched. Builder commands need one resolved
|
|
6
|
+
* object carrying the chain and every host, selected with `--network`:
|
|
7
|
+
* moksha is the default because its fees are play money, and mainnet spends
|
|
8
|
+
* real USDC.e from the app's escrow.
|
|
9
|
+
*
|
|
10
|
+
* `VANA_ENV=dev` swaps in the dev host set (internal use; dev serves the
|
|
11
|
+
* moksha chain).
|
|
12
|
+
*/
|
|
13
|
+
export type VanaNetworkName = "moksha" | "mainnet";
|
|
14
|
+
export declare const VANA_NETWORKS: readonly VanaNetworkName[];
|
|
15
|
+
export declare const DEFAULT_NETWORK: VanaNetworkName;
|
|
16
|
+
export interface ResolvedNetwork {
|
|
17
|
+
/** Network name as selected. */
|
|
18
|
+
name: VanaNetworkName;
|
|
19
|
+
/** Host set: "dev" only when VANA_ENV=dev (moksha chain, dev hosts). */
|
|
20
|
+
env: "dev" | "prod";
|
|
21
|
+
/** Vana chain id: 14800 moksha, 1480 mainnet. */
|
|
22
|
+
chainId: number;
|
|
23
|
+
/** Data Gateway base URL (the only address a builder needs). */
|
|
24
|
+
gatewayUrl: string;
|
|
25
|
+
/** Vana Account base URL. */
|
|
26
|
+
accountUrl: string;
|
|
27
|
+
/** Consent / approval app base URL. */
|
|
28
|
+
approvalUrl: string;
|
|
29
|
+
/** Session relay base URL (owner-side flows). */
|
|
30
|
+
sessionRelayUrl: string;
|
|
31
|
+
/** Block explorer base URL. */
|
|
32
|
+
explorerUrl: string;
|
|
33
|
+
/** JSON-RPC endpoint for on-chain calls (escrow depositNative). */
|
|
34
|
+
rpcUrl: string;
|
|
35
|
+
/** DataPortabilityGrantees contract, the EIP-712 verifying contract for
|
|
36
|
+
* builder registration (same deployment address on both networks). */
|
|
37
|
+
granteesContract: string;
|
|
38
|
+
}
|
|
39
|
+
export declare class UnknownNetworkError extends Error {
|
|
40
|
+
readonly value: string;
|
|
41
|
+
constructor(value: string);
|
|
42
|
+
}
|
|
43
|
+
export declare function isVanaNetworkName(value: string): value is VanaNetworkName;
|
|
44
|
+
/**
|
|
45
|
+
* Resolve a network selection into hosts and chain.
|
|
46
|
+
*
|
|
47
|
+
* @param name - `--network` value; falls back to `VANA_NETWORK`, then moksha.
|
|
48
|
+
* @param env - process env, injectable for tests.
|
|
49
|
+
* @throws {UnknownNetworkError} for a name outside {@link VANA_NETWORKS}.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveNetwork(name?: string, env?: Record<string, string | undefined>): ResolvedNetwork;
|
|
52
|
+
//# sourceMappingURL=network.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/core/network.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEnD,eAAO,MAAM,aAAa,EAAE,SAAS,eAAe,EAG1C,CAAC;AAEX,eAAO,MAAM,eAAe,EAAE,eAA0B,CAAC;AAEzD,MAAM,WAAW,eAAe;IAC9B,gCAAgC;IAChC,IAAI,EAAE,eAAe,CAAC;IACtB,wEAAwE;IACxE,GAAG,EAAE,KAAK,GAAG,MAAM,CAAC;IACpB,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,UAAU,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,eAAe,EAAE,MAAM,CAAC;IACxB,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,MAAM,EAAE,MAAM,CAAC;IACf;0EACsE;IACtE,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAsCD,qBAAa,mBAAoB,SAAQ,KAAK;aAChB,KAAK,EAAE,MAAM;gBAAb,KAAK,EAAE,MAAM;CAM1C;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,eAAe,CAEzE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,IAAI,CAAC,EAAE,MAAM,EACb,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD,eAAe,CAYjB"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolved network configuration for builder-side commands.
|
|
3
|
+
*
|
|
4
|
+
* The owner-side commands keep using {@link getEnvConfig} from constants.ts
|
|
5
|
+
* (a dev/prod host axis) untouched. Builder commands need one resolved
|
|
6
|
+
* object carrying the chain and every host, selected with `--network`:
|
|
7
|
+
* moksha is the default because its fees are play money, and mainnet spends
|
|
8
|
+
* real USDC.e from the app's escrow.
|
|
9
|
+
*
|
|
10
|
+
* `VANA_ENV=dev` swaps in the dev host set (internal use; dev serves the
|
|
11
|
+
* moksha chain).
|
|
12
|
+
*/
|
|
13
|
+
export const VANA_NETWORKS = [
|
|
14
|
+
"moksha",
|
|
15
|
+
"mainnet",
|
|
16
|
+
];
|
|
17
|
+
export const DEFAULT_NETWORK = "moksha";
|
|
18
|
+
const NETWORKS = {
|
|
19
|
+
moksha: {
|
|
20
|
+
name: "moksha",
|
|
21
|
+
chainId: 14800,
|
|
22
|
+
granteesContract: "0x8325C0A0948483EdA023A1A2Fd895e62C5131234",
|
|
23
|
+
gatewayUrl: "https://dp-rpc.moksha.vana.org",
|
|
24
|
+
accountUrl: "https://account.vana.org",
|
|
25
|
+
approvalUrl: "https://app.vana.org",
|
|
26
|
+
sessionRelayUrl: "https://session-relay.vana.org",
|
|
27
|
+
explorerUrl: "https://moksha.vanascan.io",
|
|
28
|
+
rpcUrl: "https://rpc.moksha.vana.org",
|
|
29
|
+
},
|
|
30
|
+
mainnet: {
|
|
31
|
+
name: "mainnet",
|
|
32
|
+
chainId: 1480,
|
|
33
|
+
granteesContract: "0x8325C0A0948483EdA023A1A2Fd895e62C5131234",
|
|
34
|
+
gatewayUrl: "https://dp-rpc.vana.org",
|
|
35
|
+
accountUrl: "https://account.vana.org",
|
|
36
|
+
approvalUrl: "https://app.vana.org",
|
|
37
|
+
sessionRelayUrl: "https://session-relay.vana.org",
|
|
38
|
+
explorerUrl: "https://vanascan.io",
|
|
39
|
+
rpcUrl: "https://rpc.vana.org",
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
/** Dev host overrides (moksha chain served by the dev deployment). */
|
|
43
|
+
const DEV_HOSTS = {
|
|
44
|
+
gatewayUrl: "https://dp-rpc-dev.vana.org",
|
|
45
|
+
accountUrl: "https://account-dev.vana.org",
|
|
46
|
+
// The SDK's dev consent endpoints live on app-dev (see
|
|
47
|
+
// @opendatalabs/vana-sdk dist/direct/endpoints.js); mixing the prod
|
|
48
|
+
// approval app with dev everything-else would split deployments.
|
|
49
|
+
approvalUrl: "https://app-dev.vana.org",
|
|
50
|
+
sessionRelayUrl: "https://dev.session-relay.vana.org",
|
|
51
|
+
};
|
|
52
|
+
export class UnknownNetworkError extends Error {
|
|
53
|
+
value;
|
|
54
|
+
constructor(value) {
|
|
55
|
+
super(`Unknown network "${value}". Expected one of: ${VANA_NETWORKS.join(", ")}.`);
|
|
56
|
+
this.value = value;
|
|
57
|
+
this.name = "UnknownNetworkError";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export function isVanaNetworkName(value) {
|
|
61
|
+
return VANA_NETWORKS.includes(value);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Resolve a network selection into hosts and chain.
|
|
65
|
+
*
|
|
66
|
+
* @param name - `--network` value; falls back to `VANA_NETWORK`, then moksha.
|
|
67
|
+
* @param env - process env, injectable for tests.
|
|
68
|
+
* @throws {UnknownNetworkError} for a name outside {@link VANA_NETWORKS}.
|
|
69
|
+
*/
|
|
70
|
+
export function resolveNetwork(name, env = process.env) {
|
|
71
|
+
const raw = (name ?? env.VANA_NETWORK ?? DEFAULT_NETWORK).toLowerCase();
|
|
72
|
+
if (!isVanaNetworkName(raw)) {
|
|
73
|
+
throw new UnknownNetworkError(raw);
|
|
74
|
+
}
|
|
75
|
+
const base = NETWORKS[raw];
|
|
76
|
+
const dev = env.VANA_ENV === "dev";
|
|
77
|
+
if (dev && raw === "mainnet") {
|
|
78
|
+
// There is no dev host set for mainnet; refuse rather than guess.
|
|
79
|
+
throw new UnknownNetworkError("mainnet with VANA_ENV=dev");
|
|
80
|
+
}
|
|
81
|
+
return dev ? { ...base, ...DEV_HOSTS, env: "dev" } : { ...base, env: "prod" };
|
|
82
|
+
}
|
|
83
|
+
//# sourceMapping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GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAQ,aAAmC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAa,EACb,MAA0C,OAAO,CAAC,GAAG;IAErD,MAAM,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,YAAY,IAAI,eAAe,CAAC,CAAC,WAAW,EAAE,CAAC;IACxE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC3B,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,KAAK,KAAK,CAAC;IACnC,IAAI,GAAG,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QAC7B,kEAAkE;QAClE,MAAM,IAAI,mBAAmB,CAAC,2BAA2B,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;AAChF,CAAC"}
|
package/dist/core/paths.d.ts
CHANGED
|
@@ -11,9 +11,11 @@ export declare function getVanaHome(): string;
|
|
|
11
11
|
* desktop app) keeps working. DataConnect hardcodes ~/.dataconnect in
|
|
12
12
|
* src-tauri/src/commands/connector.rs:66. It should adopt ~/.vana upstream.
|
|
13
13
|
*
|
|
14
|
-
* Returns
|
|
14
|
+
* Returns "migrated" when legacy data was actually moved, "symlinked" when
|
|
15
|
+
* only the compat symlink was created (typical first run of a fresh
|
|
16
|
+
* install), and null when nothing changed.
|
|
15
17
|
*/
|
|
16
|
-
export declare function migrateLegacyDataHome():
|
|
18
|
+
export declare function migrateLegacyDataHome(): "migrated" | "symlinked" | null;
|
|
17
19
|
export declare function getConnectorCacheDir(): string;
|
|
18
20
|
export declare function getBrowserProfilesDir(): string;
|
|
19
21
|
export declare function getCliStatePath(): string;
|
package/dist/core/paths.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/core/paths.ts"],"names":[],"mappings":"AAIA,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/core/paths.ts"],"names":[],"mappings":"AAIA,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,IAAI,UAAU,GAAG,WAAW,GAAG,IAAI,CA2BvE;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAG1D;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAG5D;AAED,6DAA6D;AAC7D,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQhE;AAED,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAM5D"}
|
package/dist/core/paths.js
CHANGED
|
@@ -16,7 +16,9 @@ export function getVanaHome() {
|
|
|
16
16
|
* desktop app) keeps working. DataConnect hardcodes ~/.dataconnect in
|
|
17
17
|
* src-tauri/src/commands/connector.rs:66. It should adopt ~/.vana upstream.
|
|
18
18
|
*
|
|
19
|
-
* Returns
|
|
19
|
+
* Returns "migrated" when legacy data was actually moved, "symlinked" when
|
|
20
|
+
* only the compat symlink was created (typical first run of a fresh
|
|
21
|
+
* install), and null when nothing changed.
|
|
20
22
|
*/
|
|
21
23
|
export function migrateLegacyDataHome() {
|
|
22
24
|
const vanaHome = getVanaHome();
|
|
@@ -26,10 +28,10 @@ export function migrateLegacyDataHome() {
|
|
|
26
28
|
try {
|
|
27
29
|
fs.renameSync(oldHome, vanaHome);
|
|
28
30
|
fs.symlinkSync(vanaHome, oldHome);
|
|
29
|
-
return
|
|
31
|
+
return "migrated";
|
|
30
32
|
}
|
|
31
33
|
catch {
|
|
32
|
-
return
|
|
34
|
+
return null;
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
// Case 2: new exists, old doesn't → create compat symlink
|
|
@@ -37,13 +39,13 @@ export function migrateLegacyDataHome() {
|
|
|
37
39
|
if (fs.existsSync(vanaHome) && !fs.existsSync(oldHome)) {
|
|
38
40
|
try {
|
|
39
41
|
fs.symlinkSync(vanaHome, oldHome);
|
|
40
|
-
return
|
|
42
|
+
return "symlinked";
|
|
41
43
|
}
|
|
42
44
|
catch {
|
|
43
|
-
return
|
|
45
|
+
return null;
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
|
-
return
|
|
48
|
+
return null;
|
|
47
49
|
}
|
|
48
50
|
export function getConnectorCacheDir() {
|
|
49
51
|
return path.join(getVanaHome(), "connectors");
|
package/dist/core/paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/core/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,M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,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,6CAA6C;IAC/C,CAAC;AACH,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,UAAU,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,MAAM,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,WAAW,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,QAAQ,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAc;IAClD,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IACtE,OAAO,IAAI,CAAC,IAAI,CACd,UAAU,EAAE,EACZ,GAAG,UAAU,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CACtE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable payment state for the builder read loop.
|
|
3
|
+
*
|
|
4
|
+
* Two responsibilities, one 0600 file (`~/.vana/app/receipts.json`):
|
|
5
|
+
*
|
|
6
|
+
* - Payment nonces per payer. The gateway rejects a reused (payer, nonce)
|
|
7
|
+
* pair, and the SDK's default nonce source is process-local seeded at 1,
|
|
8
|
+
* which breaks on the second CLI invocation. Nonces here only move
|
|
9
|
+
* forward.
|
|
10
|
+
* - Receipts: the exact `X-PAYMENT` header (plus amount/asset metadata) of a
|
|
11
|
+
* settled read, keyed by network, grant, and scope. A later read replays
|
|
12
|
+
* the header first, so a retry after a failure never settles a second fee
|
|
13
|
+
* for data the app already paid for.
|
|
14
|
+
*/
|
|
15
|
+
export interface StoredReceipt {
|
|
16
|
+
/** The signed X-PAYMENT header exactly as sent. */
|
|
17
|
+
header: string;
|
|
18
|
+
/** Base-unit decimal amount the header settles. */
|
|
19
|
+
amount: string;
|
|
20
|
+
/** Asset address (zero address = native VANA). */
|
|
21
|
+
asset: string;
|
|
22
|
+
/** ISO timestamp the CLI captured the header. */
|
|
23
|
+
capturedAt: string;
|
|
24
|
+
/** Payment metadata echoed by the Personal Server, when any. */
|
|
25
|
+
payment?: Record<string, unknown>;
|
|
26
|
+
}
|
|
27
|
+
export declare function receiptKey(network: string, grantId: string, scope: string): string;
|
|
28
|
+
export interface ReceiptsStore {
|
|
29
|
+
/** Next monotonically-increasing payment nonce for a payer; persisted. */
|
|
30
|
+
nextNonce(payerAddress: string): bigint;
|
|
31
|
+
getReceipt(key: string): StoredReceipt | null;
|
|
32
|
+
saveReceipt(key: string, receipt: StoredReceipt): void;
|
|
33
|
+
/** Drop a receipt the server refused (stale version, expired nonce). */
|
|
34
|
+
dropReceipt(key: string): void;
|
|
35
|
+
}
|
|
36
|
+
export declare function createReceiptsStore(filePath?: string): ReceiptsStore;
|
|
37
|
+
//# sourceMappingURL=receipts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receipts.d.ts","sourceRoot":"","sources":["../../src/core/receipts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,MAAM,WAAW,aAAa;IAC5B,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAUD,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,MAAM,CAER;AAED,MAAM,WAAW,aAAa;IAC5B,0EAA0E;IAC1E,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;IACxC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAAC;IAC9C,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IACvD,wEAAwE;IACxE,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,CAmDpE"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable payment state for the builder read loop.
|
|
3
|
+
*
|
|
4
|
+
* Two responsibilities, one 0600 file (`~/.vana/app/receipts.json`):
|
|
5
|
+
*
|
|
6
|
+
* - Payment nonces per payer. The gateway rejects a reused (payer, nonce)
|
|
7
|
+
* pair, and the SDK's default nonce source is process-local seeded at 1,
|
|
8
|
+
* which breaks on the second CLI invocation. Nonces here only move
|
|
9
|
+
* forward.
|
|
10
|
+
* - Receipts: the exact `X-PAYMENT` header (plus amount/asset metadata) of a
|
|
11
|
+
* settled read, keyed by network, grant, and scope. A later read replays
|
|
12
|
+
* the header first, so a retry after a failure never settles a second fee
|
|
13
|
+
* for data the app already paid for.
|
|
14
|
+
*/
|
|
15
|
+
import fs from "node:fs";
|
|
16
|
+
import path from "node:path";
|
|
17
|
+
import { getVanaHome } from "./paths.js";
|
|
18
|
+
const EMPTY = { version: 1, nonces: {}, receipts: {} };
|
|
19
|
+
export function receiptKey(network, grantId, scope) {
|
|
20
|
+
return `${network}:${grantId.toLowerCase()}:${scope}`;
|
|
21
|
+
}
|
|
22
|
+
export function createReceiptsStore(filePath) {
|
|
23
|
+
const file = filePath ?? path.join(getVanaHome(), "app", "receipts.json");
|
|
24
|
+
function read() {
|
|
25
|
+
try {
|
|
26
|
+
const parsed = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
27
|
+
if (parsed?.version !== 1) {
|
|
28
|
+
return structuredClone(EMPTY);
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
version: 1,
|
|
32
|
+
nonces: parsed.nonces ?? {},
|
|
33
|
+
receipts: parsed.receipts ?? {},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return structuredClone(EMPTY);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function write(state) {
|
|
41
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
42
|
+
fs.writeFileSync(file, JSON.stringify(state, null, 2) + "\n", {
|
|
43
|
+
mode: 0o600,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
nextNonce(payerAddress) {
|
|
48
|
+
const state = read();
|
|
49
|
+
const key = payerAddress.toLowerCase();
|
|
50
|
+
const next = BigInt(state.nonces[key] ?? "0") + 1n;
|
|
51
|
+
state.nonces[key] = next.toString();
|
|
52
|
+
write(state);
|
|
53
|
+
return next;
|
|
54
|
+
},
|
|
55
|
+
getReceipt(key) {
|
|
56
|
+
return read().receipts[key] ?? null;
|
|
57
|
+
},
|
|
58
|
+
saveReceipt(key, receipt) {
|
|
59
|
+
const state = read();
|
|
60
|
+
state.receipts[key] = receipt;
|
|
61
|
+
write(state);
|
|
62
|
+
},
|
|
63
|
+
dropReceipt(key) {
|
|
64
|
+
const state = read();
|
|
65
|
+
if (key in state.receipts) {
|
|
66
|
+
delete state.receipts[key];
|
|
67
|
+
write(state);
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|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0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local index of access requests this machine created.
|
|
3
|
+
*
|
|
4
|
+
* A request is written the moment it is created, not on approval: a
|
|
5
|
+
* `--no-input` run prints a URL and exits, and the agent that comes back
|
|
6
|
+
* later must be able to find the request without having kept the id.
|
|
7
|
+
*
|
|
8
|
+
* Entries are namespaced by app address, network and gateway host, so two
|
|
9
|
+
* apps, two networks or a dev deployment never see each other's requests.
|
|
10
|
+
*
|
|
11
|
+
* The DCR status carries no owner address, so an approved entry records the
|
|
12
|
+
* grant id and the CLI resolves the owner from the gateway when it needs
|
|
13
|
+
* one (a read does).
|
|
14
|
+
*/
|
|
15
|
+
export type StoredRequestStatus = "pending" | "approved" | "ready_for_read" | "completed" | "denied" | "expired";
|
|
16
|
+
export interface StoredRequest {
|
|
17
|
+
requestId: string;
|
|
18
|
+
/** App address that created it. */
|
|
19
|
+
appAddress: string;
|
|
20
|
+
network: string;
|
|
21
|
+
gatewayUrl: string;
|
|
22
|
+
/** Scopes asked for, verbatim (may carry `write:` prefixes). */
|
|
23
|
+
scopes: string[];
|
|
24
|
+
approvalUrl: string;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
status: StoredRequestStatus;
|
|
27
|
+
updatedAt: string;
|
|
28
|
+
expiresAt?: string;
|
|
29
|
+
/** Present once approved. */
|
|
30
|
+
grantId?: string;
|
|
31
|
+
/** Approved scopes as reported by the status route. */
|
|
32
|
+
approvedScopes?: string[];
|
|
33
|
+
/** `enclave` or `personal_server`, once the status route reports it. */
|
|
34
|
+
delivery?: string;
|
|
35
|
+
personalServerUrl?: string;
|
|
36
|
+
/** Derivative questions carried on the request, when any. */
|
|
37
|
+
questions?: {
|
|
38
|
+
derivedScope: string;
|
|
39
|
+
sourceScopes: string[];
|
|
40
|
+
}[];
|
|
41
|
+
}
|
|
42
|
+
export interface RequestsStore {
|
|
43
|
+
save(request: StoredRequest): void;
|
|
44
|
+
/** Merge fields into an existing entry; no-op when it is unknown. */
|
|
45
|
+
update(requestId: string, patch: Partial<StoredRequest>): void;
|
|
46
|
+
get(requestId: string): StoredRequest | null;
|
|
47
|
+
/** Newest first, optionally filtered to one app/network pair. */
|
|
48
|
+
list(filter?: {
|
|
49
|
+
appAddress?: string;
|
|
50
|
+
network?: string;
|
|
51
|
+
}): StoredRequest[];
|
|
52
|
+
}
|
|
53
|
+
export declare function createRequestsStore(filePath?: string): RequestsStore;
|
|
54
|
+
//# sourceMappingURL=requests-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requests-store.d.ts","sourceRoot":"","sources":["../../src/core/requests-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,MAAM,MAAM,mBAAmB,GAC3B,SAAS,GACT,UAAU,GACV,gBAAgB,GAChB,WAAW,GACX,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,6DAA6D;IAC7D,SAAS,CAAC,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;CAChE;AASD,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IACnC,qEAAqE;IACrE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;IAC/D,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAAC;IAC7C,iEAAiE;IACjE,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,aAAa,EAAE,CAAC;CAC3E;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,CAwEpE"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local index of access requests this machine created.
|
|
3
|
+
*
|
|
4
|
+
* A request is written the moment it is created, not on approval: a
|
|
5
|
+
* `--no-input` run prints a URL and exits, and the agent that comes back
|
|
6
|
+
* later must be able to find the request without having kept the id.
|
|
7
|
+
*
|
|
8
|
+
* Entries are namespaced by app address, network and gateway host, so two
|
|
9
|
+
* apps, two networks or a dev deployment never see each other's requests.
|
|
10
|
+
*
|
|
11
|
+
* The DCR status carries no owner address, so an approved entry records the
|
|
12
|
+
* grant id and the CLI resolves the owner from the gateway when it needs
|
|
13
|
+
* one (a read does).
|
|
14
|
+
*/
|
|
15
|
+
import fs from "node:fs";
|
|
16
|
+
import path from "node:path";
|
|
17
|
+
import { getVanaHome } from "./paths.js";
|
|
18
|
+
const EMPTY = { version: 1, requests: [] };
|
|
19
|
+
export function createRequestsStore(filePath) {
|
|
20
|
+
const file = filePath ?? path.join(getVanaHome(), "app", "requests.json");
|
|
21
|
+
function read() {
|
|
22
|
+
try {
|
|
23
|
+
const parsed = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
24
|
+
if (parsed?.version !== 1 || !Array.isArray(parsed.requests)) {
|
|
25
|
+
return structuredClone(EMPTY);
|
|
26
|
+
}
|
|
27
|
+
return parsed;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return structuredClone(EMPTY);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function write(state) {
|
|
34
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
35
|
+
fs.writeFileSync(file, JSON.stringify(state, null, 2) + "\n", {
|
|
36
|
+
mode: 0o600,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
save(request) {
|
|
41
|
+
const state = read();
|
|
42
|
+
const index = state.requests.findIndex((entry) => entry.requestId === request.requestId);
|
|
43
|
+
if (index >= 0) {
|
|
44
|
+
state.requests[index] = request;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
state.requests.push(request);
|
|
48
|
+
}
|
|
49
|
+
write(state);
|
|
50
|
+
},
|
|
51
|
+
update(requestId, patch) {
|
|
52
|
+
const state = read();
|
|
53
|
+
const index = state.requests.findIndex((entry) => entry.requestId === requestId);
|
|
54
|
+
if (index < 0) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
state.requests[index] = {
|
|
58
|
+
...state.requests[index],
|
|
59
|
+
...patch,
|
|
60
|
+
updatedAt: new Date().toISOString(),
|
|
61
|
+
};
|
|
62
|
+
write(state);
|
|
63
|
+
},
|
|
64
|
+
get(requestId) {
|
|
65
|
+
return (read().requests.find((entry) => entry.requestId === requestId) ?? null);
|
|
66
|
+
},
|
|
67
|
+
list(filter) {
|
|
68
|
+
return read()
|
|
69
|
+
.requests.filter((entry) => {
|
|
70
|
+
if (filter?.appAddress &&
|
|
71
|
+
entry.appAddress.toLowerCase() !== filter.appAddress.toLowerCase()) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
if (filter?.network && entry.network !== filter.network) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
78
|
+
})
|
|
79
|
+
.sort((a, b) => b.createdAt.localeCompare(a.createdAt));
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=requests-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requests-store.js","sourceRoot":"","sources":["../../src/core/requests-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAuCzC,MAAM,KAAK,GAAiB,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AAWzD,MAAM,UAAU,mBAAmB,CAAC,QAAiB;IACnD,MAAM,IAAI,GAAG,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;IAE1E,SAAS,IAAI;QACX,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAiB,CAAC;YACzE,IAAI,MAAM,EAAE,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC7D,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;YAChC,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAED,SAAS,KAAK,CAAC,KAAmB;QAChC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,EAAE,CAAC,aA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