@blockrun/clawrouter 0.12.102 → 0.12.103
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/cli.d.ts +0 -15
- package/dist/cli.js +80037 -407
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1406 -34
- package/dist/index.js +81085 -1075
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/auth.d.ts +0 -82
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js +0 -388
- package/dist/auth.js.map +0 -1
- package/dist/balance.d.ts +0 -97
- package/dist/balance.d.ts.map +0 -1
- package/dist/balance.js +0 -157
- package/dist/balance.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/compression/codebook.d.ts +0 -24
- package/dist/compression/codebook.d.ts.map +0 -1
- package/dist/compression/codebook.js +0 -119
- package/dist/compression/codebook.js.map +0 -1
- package/dist/compression/index.d.ts +0 -33
- package/dist/compression/index.d.ts.map +0 -1
- package/dist/compression/index.js +0 -246
- package/dist/compression/index.js.map +0 -1
- package/dist/compression/layers/deduplication.d.ts +0 -28
- package/dist/compression/layers/deduplication.d.ts.map +0 -1
- package/dist/compression/layers/deduplication.js +0 -101
- package/dist/compression/layers/deduplication.js.map +0 -1
- package/dist/compression/layers/dictionary.d.ts +0 -21
- package/dist/compression/layers/dictionary.d.ts.map +0 -1
- package/dist/compression/layers/dictionary.js +0 -73
- package/dist/compression/layers/dictionary.js.map +0 -1
- package/dist/compression/layers/dynamic-codebook.d.ts +0 -26
- package/dist/compression/layers/dynamic-codebook.d.ts.map +0 -1
- package/dist/compression/layers/dynamic-codebook.js +0 -149
- package/dist/compression/layers/dynamic-codebook.js.map +0 -1
- package/dist/compression/layers/json-compact.d.ts +0 -23
- package/dist/compression/layers/json-compact.d.ts.map +0 -1
- package/dist/compression/layers/json-compact.js +0 -79
- package/dist/compression/layers/json-compact.js.map +0 -1
- package/dist/compression/layers/observation.d.ts +0 -21
- package/dist/compression/layers/observation.d.ts.map +0 -1
- package/dist/compression/layers/observation.js +0 -130
- package/dist/compression/layers/observation.js.map +0 -1
- package/dist/compression/layers/paths.d.ts +0 -24
- package/dist/compression/layers/paths.d.ts.map +0 -1
- package/dist/compression/layers/paths.js +0 -110
- package/dist/compression/layers/paths.js.map +0 -1
- package/dist/compression/layers/whitespace.d.ts +0 -27
- package/dist/compression/layers/whitespace.d.ts.map +0 -1
- package/dist/compression/layers/whitespace.js +0 -60
- package/dist/compression/layers/whitespace.js.map +0 -1
- package/dist/compression/types.d.ts +0 -84
- package/dist/compression/types.d.ts.map +0 -1
- package/dist/compression/types.js +0 -27
- package/dist/compression/types.js.map +0 -1
- package/dist/config.d.ts +0 -12
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -22
- package/dist/config.js.map +0 -1
- package/dist/dedup.d.ts +0 -34
- package/dist/dedup.d.ts.map +0 -1
- package/dist/dedup.js +0 -150
- package/dist/dedup.js.map +0 -1
- package/dist/doctor.d.ts +0 -8
- package/dist/doctor.d.ts.map +0 -1
- package/dist/doctor.js +0 -375
- package/dist/doctor.js.map +0 -1
- package/dist/error-classification.test.d.ts +0 -2
- package/dist/error-classification.test.d.ts.map +0 -1
- package/dist/error-classification.test.js +0 -59
- package/dist/error-classification.test.js.map +0 -1
- package/dist/errors.d.ts +0 -54
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -85
- package/dist/errors.js.map +0 -1
- package/dist/exclude-models.d.ts +0 -28
- package/dist/exclude-models.d.ts.map +0 -1
- package/dist/exclude-models.integration.test.d.ts +0 -2
- package/dist/exclude-models.integration.test.d.ts.map +0 -1
- package/dist/exclude-models.integration.test.js +0 -46
- package/dist/exclude-models.integration.test.js.map +0 -1
- package/dist/exclude-models.js +0 -70
- package/dist/exclude-models.js.map +0 -1
- package/dist/exclude-models.test.d.ts +0 -5
- package/dist/exclude-models.test.d.ts.map +0 -1
- package/dist/exclude-models.test.js +0 -95
- package/dist/exclude-models.test.js.map +0 -1
- package/dist/fs-read.d.ts +0 -11
- package/dist/fs-read.d.ts.map +0 -1
- package/dist/fs-read.js +0 -47
- package/dist/fs-read.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/journal.d.ts +0 -67
- package/dist/journal.d.ts.map +0 -1
- package/dist/journal.js +0 -184
- package/dist/journal.js.map +0 -1
- package/dist/journal.test.d.ts +0 -2
- package/dist/journal.test.d.ts.map +0 -1
- package/dist/journal.test.js +0 -201
- package/dist/journal.test.js.map +0 -1
- package/dist/logger.d.ts +0 -33
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -35
- package/dist/logger.js.map +0 -1
- package/dist/models.d.ts +0 -107
- package/dist/models.d.ts.map +0 -1
- package/dist/models.js +0 -941
- package/dist/models.js.map +0 -1
- package/dist/models.test.d.ts +0 -2
- package/dist/models.test.d.ts.map +0 -1
- package/dist/models.test.js +0 -38
- package/dist/models.test.js.map +0 -1
- package/dist/partners/index.d.ts +0 -8
- package/dist/partners/index.d.ts.map +0 -1
- package/dist/partners/index.js +0 -6
- package/dist/partners/index.js.map +0 -1
- package/dist/partners/registry.d.ts +0 -51
- package/dist/partners/registry.d.ts.map +0 -1
- package/dist/partners/registry.js +0 -256
- package/dist/partners/registry.js.map +0 -1
- package/dist/partners/tools.d.ts +0 -24
- package/dist/partners/tools.d.ts.map +0 -1
- package/dist/partners/tools.js +0 -97
- package/dist/partners/tools.js.map +0 -1
- package/dist/payment-preauth.d.ts +0 -17
- package/dist/payment-preauth.d.ts.map +0 -1
- package/dist/payment-preauth.js +0 -102
- package/dist/payment-preauth.js.map +0 -1
- package/dist/provider.d.ts +0 -19
- package/dist/provider.d.ts.map +0 -1
- package/dist/provider.js +0 -45
- package/dist/provider.js.map +0 -1
- package/dist/proxy.d.ts +0 -210
- package/dist/proxy.d.ts.map +0 -1
- package/dist/proxy.debrand.test.d.ts +0 -2
- package/dist/proxy.debrand.test.d.ts.map +0 -1
- package/dist/proxy.debrand.test.js +0 -101
- package/dist/proxy.debrand.test.js.map +0 -1
- package/dist/proxy.degraded-response.test.d.ts +0 -2
- package/dist/proxy.degraded-response.test.d.ts.map +0 -1
- package/dist/proxy.degraded-response.test.js +0 -105
- package/dist/proxy.degraded-response.test.js.map +0 -1
- package/dist/proxy.image-download.test.d.ts +0 -2
- package/dist/proxy.image-download.test.d.ts.map +0 -1
- package/dist/proxy.image-download.test.js +0 -92
- package/dist/proxy.image-download.test.js.map +0 -1
- package/dist/proxy.js +0 -3810
- package/dist/proxy.js.map +0 -1
- package/dist/proxy.models-endpoint.test.d.ts +0 -2
- package/dist/proxy.models-endpoint.test.d.ts.map +0 -1
- package/dist/proxy.models-endpoint.test.js +0 -19
- package/dist/proxy.models-endpoint.test.js.map +0 -1
- package/dist/proxy.multiturn-thinking.test.d.ts +0 -2
- package/dist/proxy.multiturn-thinking.test.d.ts.map +0 -1
- package/dist/proxy.multiturn-thinking.test.js +0 -82
- package/dist/proxy.multiturn-thinking.test.js.map +0 -1
- package/dist/proxy.payment-chain-reuse.test.d.ts +0 -2
- package/dist/proxy.payment-chain-reuse.test.d.ts.map +0 -1
- package/dist/proxy.payment-chain-reuse.test.js +0 -30
- package/dist/proxy.payment-chain-reuse.test.js.map +0 -1
- package/dist/proxy.solana-resilience.test.d.ts +0 -12
- package/dist/proxy.solana-resilience.test.d.ts.map +0 -1
- package/dist/proxy.solana-resilience.test.js +0 -39
- package/dist/proxy.solana-resilience.test.js.map +0 -1
- package/dist/report.d.ts +0 -6
- package/dist/report.d.ts.map +0 -1
- package/dist/report.js +0 -44
- package/dist/report.js.map +0 -1
- package/dist/response-cache.advanced.test.d.ts +0 -2
- package/dist/response-cache.advanced.test.d.ts.map +0 -1
- package/dist/response-cache.advanced.test.js +0 -566
- package/dist/response-cache.advanced.test.js.map +0 -1
- package/dist/response-cache.d.ts +0 -85
- package/dist/response-cache.d.ts.map +0 -1
- package/dist/response-cache.edge-cases.test.d.ts +0 -2
- package/dist/response-cache.edge-cases.test.d.ts.map +0 -1
- package/dist/response-cache.edge-cases.test.js +0 -488
- package/dist/response-cache.edge-cases.test.js.map +0 -1
- package/dist/response-cache.extreme.test.d.ts +0 -2
- package/dist/response-cache.extreme.test.d.ts.map +0 -1
- package/dist/response-cache.extreme.test.js +0 -561
- package/dist/response-cache.extreme.test.js.map +0 -1
- package/dist/response-cache.js +0 -240
- package/dist/response-cache.js.map +0 -1
- package/dist/response-cache.test.d.ts +0 -2
- package/dist/response-cache.test.d.ts.map +0 -1
- package/dist/response-cache.test.js +0 -242
- package/dist/response-cache.test.js.map +0 -1
- package/dist/retry.d.ts +0 -42
- package/dist/retry.d.ts.map +0 -1
- package/dist/retry.js +0 -99
- package/dist/retry.js.map +0 -1
- package/dist/router/config.d.ts +0 -11
- package/dist/router/config.d.ts.map +0 -1
- package/dist/router/config.js +0 -1215
- package/dist/router/config.js.map +0 -1
- package/dist/router/index.d.ts +0 -18
- package/dist/router/index.d.ts.map +0 -1
- package/dist/router/index.js +0 -19
- package/dist/router/index.js.map +0 -1
- package/dist/router/llm-classifier.d.ts +0 -29
- package/dist/router/llm-classifier.d.ts.map +0 -1
- package/dist/router/llm-classifier.js +0 -99
- package/dist/router/llm-classifier.js.map +0 -1
- package/dist/router/rules.d.ts +0 -12
- package/dist/router/rules.d.ts.map +0 -1
- package/dist/router/rules.js +0 -202
- package/dist/router/rules.js.map +0 -1
- package/dist/router/selector.d.ts +0 -58
- package/dist/router/selector.d.ts.map +0 -1
- package/dist/router/selector.js +0 -165
- package/dist/router/selector.js.map +0 -1
- package/dist/router/selector.test.d.ts +0 -2
- package/dist/router/selector.test.d.ts.map +0 -1
- package/dist/router/selector.test.js +0 -67
- package/dist/router/selector.test.js.map +0 -1
- package/dist/router/strategy.d.ts +0 -19
- package/dist/router/strategy.d.ts.map +0 -1
- package/dist/router/strategy.js +0 -138
- package/dist/router/strategy.js.map +0 -1
- package/dist/router/strategy.test.d.ts +0 -2
- package/dist/router/strategy.test.d.ts.map +0 -1
- package/dist/router/strategy.test.js +0 -131
- package/dist/router/strategy.test.js.map +0 -1
- package/dist/router/types.d.ts +0 -127
- package/dist/router/types.d.ts.map +0 -1
- package/dist/router/types.js +0 -11
- package/dist/router/types.js.map +0 -1
- package/dist/session.d.ts +0 -124
- package/dist/session.d.ts.map +0 -1
- package/dist/session.js +0 -256
- package/dist/session.js.map +0 -1
- package/dist/session.test.d.ts +0 -2
- package/dist/session.test.d.ts.map +0 -1
- package/dist/session.test.js +0 -163
- package/dist/session.test.js.map +0 -1
- package/dist/solana-balance.d.ts +0 -48
- package/dist/solana-balance.d.ts.map +0 -1
- package/dist/solana-balance.js +0 -142
- package/dist/solana-balance.js.map +0 -1
- package/dist/spend-control.d.ts +0 -112
- package/dist/spend-control.d.ts.map +0 -1
- package/dist/spend-control.js +0 -278
- package/dist/spend-control.js.map +0 -1
- package/dist/spend-control.test.d.ts +0 -5
- package/dist/spend-control.test.d.ts.map +0 -1
- package/dist/spend-control.test.js +0 -210
- package/dist/spend-control.test.js.map +0 -1
- package/dist/stats.d.ts +0 -64
- package/dist/stats.d.ts.map +0 -1
- package/dist/stats.js +0 -295
- package/dist/stats.js.map +0 -1
- package/dist/types.d.ts +0 -150
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -9
- package/dist/types.js.map +0 -1
- package/dist/update-hint.test.d.ts +0 -9
- package/dist/update-hint.test.d.ts.map +0 -1
- package/dist/update-hint.test.js +0 -156
- package/dist/update-hint.test.js.map +0 -1
- package/dist/updater.d.ts +0 -10
- package/dist/updater.d.ts.map +0 -1
- package/dist/updater.js +0 -55
- package/dist/updater.js.map +0 -1
- package/dist/version.d.ts +0 -3
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js +0 -16
- package/dist/version.js.map +0 -1
- package/dist/wallet.d.ts +0 -52
- package/dist/wallet.d.ts.map +0 -1
- package/dist/wallet.js +0 -94
- package/dist/wallet.js.map +0 -1
- package/dist/wallet.test.d.ts +0 -6
- package/dist/wallet.test.d.ts.map +0 -1
- package/dist/wallet.test.js +0 -117
- package/dist/wallet.test.js.map +0 -1
- package/dist/x402-sdk.test.d.ts +0 -6
- package/dist/x402-sdk.test.d.ts.map +0 -1
- package/dist/x402-sdk.test.js +0 -161
- package/dist/x402-sdk.test.js.map +0 -1
package/dist/errors.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed Error Classes for ClawRouter
|
|
3
|
-
*
|
|
4
|
-
* Provides structured errors for balance-related failures with
|
|
5
|
-
* all necessary information for user-friendly error messages.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Thrown when wallet has insufficient USDC balance for a request.
|
|
9
|
-
*/
|
|
10
|
-
export declare class InsufficientFundsError extends Error {
|
|
11
|
-
readonly code: "INSUFFICIENT_FUNDS";
|
|
12
|
-
readonly currentBalanceUSD: string;
|
|
13
|
-
readonly requiredUSD: string;
|
|
14
|
-
readonly walletAddress: string;
|
|
15
|
-
constructor(opts: {
|
|
16
|
-
currentBalanceUSD: string;
|
|
17
|
-
requiredUSD: string;
|
|
18
|
-
walletAddress: string;
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Thrown when wallet has no USDC balance (or effectively zero).
|
|
23
|
-
*/
|
|
24
|
-
export declare class EmptyWalletError extends Error {
|
|
25
|
-
readonly code: "EMPTY_WALLET";
|
|
26
|
-
readonly walletAddress: string;
|
|
27
|
-
constructor(walletAddress: string);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Type guard to check if an error is InsufficientFundsError.
|
|
31
|
-
*/
|
|
32
|
-
export declare function isInsufficientFundsError(error: unknown): error is InsufficientFundsError;
|
|
33
|
-
/**
|
|
34
|
-
* Type guard to check if an error is EmptyWalletError.
|
|
35
|
-
*/
|
|
36
|
-
export declare function isEmptyWalletError(error: unknown): error is EmptyWalletError;
|
|
37
|
-
/**
|
|
38
|
-
* Type guard to check if an error is a balance-related error.
|
|
39
|
-
*/
|
|
40
|
-
export declare function isBalanceError(error: unknown): error is InsufficientFundsError | EmptyWalletError;
|
|
41
|
-
/**
|
|
42
|
-
* Thrown when RPC call fails (network error, node down, etc).
|
|
43
|
-
* Distinguishes infrastructure failures from actual empty wallets.
|
|
44
|
-
*/
|
|
45
|
-
export declare class RpcError extends Error {
|
|
46
|
-
readonly code: "RPC_ERROR";
|
|
47
|
-
readonly originalError: unknown;
|
|
48
|
-
constructor(message: string, originalError?: unknown);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Type guard to check if an error is RpcError.
|
|
52
|
-
*/
|
|
53
|
-
export declare function isRpcError(error: unknown): error is RpcError;
|
|
54
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,IAAI,EAAG,oBAAoB,CAAU;IAC9C,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;gBAEnB,IAAI,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE;CAa5F;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,IAAI,EAAG,cAAc,CAAU;IACxC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;gBAEnB,aAAa,EAAE,MAAM;CAYlC;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,sBAAsB,CAExF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAE5E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,sBAAsB,GAAG,gBAAgB,CAEjG;AAED;;;GAGG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAC,IAAI,EAAG,WAAW,CAAU;IACrC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;gBAEpB,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,OAAO;CAKrD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAE5D"}
|
package/dist/errors.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed Error Classes for ClawRouter
|
|
3
|
-
*
|
|
4
|
-
* Provides structured errors for balance-related failures with
|
|
5
|
-
* all necessary information for user-friendly error messages.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Thrown when wallet has insufficient USDC balance for a request.
|
|
9
|
-
*/
|
|
10
|
-
export class InsufficientFundsError extends Error {
|
|
11
|
-
code = "INSUFFICIENT_FUNDS";
|
|
12
|
-
currentBalanceUSD;
|
|
13
|
-
requiredUSD;
|
|
14
|
-
walletAddress;
|
|
15
|
-
constructor(opts) {
|
|
16
|
-
const msg = [
|
|
17
|
-
`Insufficient balance. Current: ${opts.currentBalanceUSD}, Required: ${opts.requiredUSD}`,
|
|
18
|
-
`Options:`,
|
|
19
|
-
` 1. Fund wallet: ${opts.walletAddress}`,
|
|
20
|
-
` 2. Use free model: /model free`,
|
|
21
|
-
].join("\n");
|
|
22
|
-
super(msg);
|
|
23
|
-
this.name = "InsufficientFundsError";
|
|
24
|
-
this.currentBalanceUSD = opts.currentBalanceUSD;
|
|
25
|
-
this.requiredUSD = opts.requiredUSD;
|
|
26
|
-
this.walletAddress = opts.walletAddress;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Thrown when wallet has no USDC balance (or effectively zero).
|
|
31
|
-
*/
|
|
32
|
-
export class EmptyWalletError extends Error {
|
|
33
|
-
code = "EMPTY_WALLET";
|
|
34
|
-
walletAddress;
|
|
35
|
-
constructor(walletAddress) {
|
|
36
|
-
const msg = [
|
|
37
|
-
`No USDC balance.`,
|
|
38
|
-
`Options:`,
|
|
39
|
-
` 1. Fund wallet: ${walletAddress}`,
|
|
40
|
-
` 2. Use free model: /model free`,
|
|
41
|
-
` 3. Uninstall: bash ~/.openclaw/extensions/clawrouter/scripts/uninstall.sh`,
|
|
42
|
-
].join("\n");
|
|
43
|
-
super(msg);
|
|
44
|
-
this.name = "EmptyWalletError";
|
|
45
|
-
this.walletAddress = walletAddress;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Type guard to check if an error is InsufficientFundsError.
|
|
50
|
-
*/
|
|
51
|
-
export function isInsufficientFundsError(error) {
|
|
52
|
-
return error instanceof Error && error.code === "INSUFFICIENT_FUNDS";
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Type guard to check if an error is EmptyWalletError.
|
|
56
|
-
*/
|
|
57
|
-
export function isEmptyWalletError(error) {
|
|
58
|
-
return error instanceof Error && error.code === "EMPTY_WALLET";
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Type guard to check if an error is a balance-related error.
|
|
62
|
-
*/
|
|
63
|
-
export function isBalanceError(error) {
|
|
64
|
-
return isInsufficientFundsError(error) || isEmptyWalletError(error);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Thrown when RPC call fails (network error, node down, etc).
|
|
68
|
-
* Distinguishes infrastructure failures from actual empty wallets.
|
|
69
|
-
*/
|
|
70
|
-
export class RpcError extends Error {
|
|
71
|
-
code = "RPC_ERROR";
|
|
72
|
-
originalError;
|
|
73
|
-
constructor(message, originalError) {
|
|
74
|
-
super(`RPC error: ${message}. Check network connectivity.`);
|
|
75
|
-
this.name = "RpcError";
|
|
76
|
-
this.originalError = originalError;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Type guard to check if an error is RpcError.
|
|
81
|
-
*/
|
|
82
|
-
export function isRpcError(error) {
|
|
83
|
-
return error instanceof Error && error.code === "RPC_ERROR";
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IACtC,IAAI,GAAG,oBAA6B,CAAC;IACrC,iBAAiB,CAAS;IAC1B,WAAW,CAAS;IACpB,aAAa,CAAS;IAE/B,YAAY,IAA+E;QACzF,MAAM,GAAG,GAAG;YACV,kCAAkC,IAAI,CAAC,iBAAiB,eAAe,IAAI,CAAC,WAAW,EAAE;YACzF,UAAU;YACV,qBAAqB,IAAI,CAAC,aAAa,EAAE;YACzC,kCAAkC;SACnC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,KAAK,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACrC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC;QAChD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;IAC1C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAChC,IAAI,GAAG,cAAuB,CAAC;IAC/B,aAAa,CAAS;IAE/B,YAAY,aAAqB;QAC/B,MAAM,GAAG,GAAG;YACV,kBAAkB;YAClB,UAAU;YACV,qBAAqB,aAAa,EAAE;YACpC,kCAAkC;YAClC,6EAA6E;SAC9E,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,KAAK,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACrD,OAAO,KAAK,YAAY,KAAK,IAAK,KAAgC,CAAC,IAAI,KAAK,oBAAoB,CAAC;AACnG,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,KAAK,YAAY,KAAK,IAAK,KAA0B,CAAC,IAAI,KAAK,cAAc,CAAC;AACvF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,wBAAwB,CAAC,KAAK,CAAC,IAAI,kBAAkB,CAAC,KAAK,CAAC,CAAC;AACtE,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IACxB,IAAI,GAAG,WAAoB,CAAC;IAC5B,aAAa,CAAU;IAEhC,YAAY,OAAe,EAAE,aAAuB;QAClD,KAAK,CAAC,cAAc,OAAO,+BAA+B,CAAC,CAAC;QAC5D,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,KAAK,YAAY,KAAK,IAAK,KAAkB,CAAC,IAAI,KAAK,WAAW,CAAC;AAC5E,CAAC"}
|
package/dist/exclude-models.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Exclude-models persistence module.
|
|
3
|
-
*
|
|
4
|
-
* Manages a user-configurable list of model IDs that the smart router
|
|
5
|
-
* should never select. Stored as a sorted JSON array on disk.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Load the exclude list from disk.
|
|
9
|
-
* Returns an empty set if the file does not exist.
|
|
10
|
-
*/
|
|
11
|
-
export declare function loadExcludeList(filePath?: string): Set<string>;
|
|
12
|
-
/**
|
|
13
|
-
* Add a model to the exclude list.
|
|
14
|
-
* Resolves aliases before persisting.
|
|
15
|
-
* @returns The resolved model ID.
|
|
16
|
-
*/
|
|
17
|
-
export declare function addExclusion(model: string, filePath?: string): string;
|
|
18
|
-
/**
|
|
19
|
-
* Remove a model from the exclude list.
|
|
20
|
-
* Resolves aliases before removing.
|
|
21
|
-
* @returns true if the model was present and removed, false otherwise.
|
|
22
|
-
*/
|
|
23
|
-
export declare function removeExclusion(model: string, filePath?: string): boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Clear the entire exclude list.
|
|
26
|
-
*/
|
|
27
|
-
export declare function clearExclusions(filePath?: string): void;
|
|
28
|
-
//# sourceMappingURL=exclude-models.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exclude-models.d.ts","sourceRoot":"","sources":["../src/exclude-models.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,GAAE,MAA0B,GAAG,GAAG,CAAC,MAAM,CAAC,CAWjF;AAYD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAA0B,GAAG,MAAM,CAMxF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAA0B,GAAG,OAAO,CAQ5F;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,GAAE,MAA0B,GAAG,IAAI,CAE1E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exclude-models.integration.test.d.ts","sourceRoot":"","sources":["../src/exclude-models.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { filterByExcludeList, getFallbackChain } from "./router/selector.js";
|
|
3
|
-
import { DEFAULT_ROUTING_CONFIG } from "./router/config.js";
|
|
4
|
-
describe("excludeModels integration", () => {
|
|
5
|
-
it("filters nvidia/gpt-oss-120b from eco SIMPLE chain", () => {
|
|
6
|
-
const chain = getFallbackChain("SIMPLE", DEFAULT_ROUTING_CONFIG.ecoTiers);
|
|
7
|
-
const excluded = new Set(["nvidia/gpt-oss-120b"]);
|
|
8
|
-
const filtered = filterByExcludeList(chain, excluded);
|
|
9
|
-
expect(filtered).not.toContain("nvidia/gpt-oss-120b");
|
|
10
|
-
expect(filtered.length).toBeGreaterThan(0);
|
|
11
|
-
});
|
|
12
|
-
it("excludes multiple models across all eco tiers", () => {
|
|
13
|
-
const exclude = new Set(["nvidia/gpt-oss-120b", "xai/grok-4-0709"]);
|
|
14
|
-
for (const tier of ["SIMPLE", "MEDIUM", "COMPLEX", "REASONING"]) {
|
|
15
|
-
const chain = getFallbackChain(tier, DEFAULT_ROUTING_CONFIG.ecoTiers);
|
|
16
|
-
const filtered = filterByExcludeList(chain, exclude);
|
|
17
|
-
for (const model of exclude) {
|
|
18
|
-
if (chain.includes(model)) {
|
|
19
|
-
expect(filtered).not.toContain(model);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
expect(filtered.length).toBeGreaterThan(0);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
it("gracefully handles excluding ALL models in a tier (safety net)", () => {
|
|
26
|
-
const chain = getFallbackChain("SIMPLE", DEFAULT_ROUTING_CONFIG.ecoTiers);
|
|
27
|
-
const excludeAll = new Set(chain);
|
|
28
|
-
const filtered = filterByExcludeList(chain, excludeAll);
|
|
29
|
-
expect(filtered).toEqual(chain);
|
|
30
|
-
});
|
|
31
|
-
it("works across auto tiers too", () => {
|
|
32
|
-
const exclude = new Set(["nvidia/gpt-oss-120b"]);
|
|
33
|
-
const chain = getFallbackChain("SIMPLE", DEFAULT_ROUTING_CONFIG.tiers);
|
|
34
|
-
const filtered = filterByExcludeList(chain, exclude);
|
|
35
|
-
if (chain.includes("nvidia/gpt-oss-120b")) {
|
|
36
|
-
expect(filtered).not.toContain("nvidia/gpt-oss-120b");
|
|
37
|
-
}
|
|
38
|
-
expect(filtered.length).toBeGreaterThan(0);
|
|
39
|
-
});
|
|
40
|
-
it("empty exclude list returns chain unchanged", () => {
|
|
41
|
-
const chain = getFallbackChain("COMPLEX", DEFAULT_ROUTING_CONFIG.tiers);
|
|
42
|
-
const filtered = filterByExcludeList(chain, new Set());
|
|
43
|
-
expect(filtered).toEqual(chain);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
//# sourceMappingURL=exclude-models.integration.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exclude-models.integration.test.js","sourceRoot":"","sources":["../src/exclude-models.integration.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC3D,MAAM,KAAK,GAAG,gBAAgB,CAAC,QAAQ,EAAE,sBAAsB,CAAC,QAAS,CAAC,CAAC;QAC3E,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC;QAClD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAEtD,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,qBAAqB,CAAC,CA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M,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC;QACjD,MAAM,KAAK,GAAG,gBAAgB,CAAC,QAAQ,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAC;QACvE,MAAM,QAAQ,GAAG,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAErD,IAAI,KAAK,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,CAAC;YAC1C,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QACxD,CAAC;QACD,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,MAAM,KAAK,GAAG,gBAAgB,CAAC,SAAS,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,mBAAmB,CAAC,KAAK,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/exclude-models.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Exclude-models persistence module.
|
|
3
|
-
*
|
|
4
|
-
* Manages a user-configurable list of model IDs that the smart router
|
|
5
|
-
* should never select. Stored as a sorted JSON array on disk.
|
|
6
|
-
*/
|
|
7
|
-
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
8
|
-
import { join, dirname } from "node:path";
|
|
9
|
-
import { homedir } from "node:os";
|
|
10
|
-
import { resolveModelAlias } from "./models.js";
|
|
11
|
-
const DEFAULT_FILE_PATH = join(homedir(), ".openclaw", "blockrun", "exclude-models.json");
|
|
12
|
-
/**
|
|
13
|
-
* Load the exclude list from disk.
|
|
14
|
-
* Returns an empty set if the file does not exist.
|
|
15
|
-
*/
|
|
16
|
-
export function loadExcludeList(filePath = DEFAULT_FILE_PATH) {
|
|
17
|
-
try {
|
|
18
|
-
const raw = readFileSync(filePath, "utf-8");
|
|
19
|
-
const arr = JSON.parse(raw);
|
|
20
|
-
if (Array.isArray(arr)) {
|
|
21
|
-
return new Set(arr.filter((x) => typeof x === "string"));
|
|
22
|
-
}
|
|
23
|
-
return new Set();
|
|
24
|
-
}
|
|
25
|
-
catch {
|
|
26
|
-
return new Set();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Save a set of model IDs to disk as a sorted JSON array.
|
|
31
|
-
*/
|
|
32
|
-
function saveExcludeList(set, filePath) {
|
|
33
|
-
const sorted = [...set].sort();
|
|
34
|
-
const dir = dirname(filePath);
|
|
35
|
-
mkdirSync(dir, { recursive: true });
|
|
36
|
-
writeFileSync(filePath, JSON.stringify(sorted, null, 2) + "\n", "utf-8");
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Add a model to the exclude list.
|
|
40
|
-
* Resolves aliases before persisting.
|
|
41
|
-
* @returns The resolved model ID.
|
|
42
|
-
*/
|
|
43
|
-
export function addExclusion(model, filePath = DEFAULT_FILE_PATH) {
|
|
44
|
-
const resolved = resolveModelAlias(model);
|
|
45
|
-
const set = loadExcludeList(filePath);
|
|
46
|
-
set.add(resolved);
|
|
47
|
-
saveExcludeList(set, filePath);
|
|
48
|
-
return resolved;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Remove a model from the exclude list.
|
|
52
|
-
* Resolves aliases before removing.
|
|
53
|
-
* @returns true if the model was present and removed, false otherwise.
|
|
54
|
-
*/
|
|
55
|
-
export function removeExclusion(model, filePath = DEFAULT_FILE_PATH) {
|
|
56
|
-
const resolved = resolveModelAlias(model);
|
|
57
|
-
const set = loadExcludeList(filePath);
|
|
58
|
-
const had = set.delete(resolved);
|
|
59
|
-
if (had) {
|
|
60
|
-
saveExcludeList(set, filePath);
|
|
61
|
-
}
|
|
62
|
-
return had;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Clear the entire exclude list.
|
|
66
|
-
*/
|
|
67
|
-
export function clearExclusions(filePath = DEFAULT_FILE_PATH) {
|
|
68
|
-
saveExcludeList(new Set(), filePath);
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=exclude-models.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exclude-models.js","sourceRoot":"","sources":["../src/exclude-models.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,qBAAqB,CAAC,CAAC;AAE1F;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,WAAmB,iBAAiB;IAClE,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC5C,MAAM,GAAG,GAAY,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC;QACxE,CAAC;QACD,OAAO,IAAI,GAAG,EAAE,CAAC;IACnB,CAAC;IAAC,MAAM,CAAC;QACP,O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AAG,EAAE,EAAE,QAAQ,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exclude-models.test.d.ts","sourceRoot":"","sources":["../src/exclude-models.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ExcludeModels persistence tests — load, add, remove, clear, aliases.
|
|
3
|
-
*/
|
|
4
|
-
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
5
|
-
import { mkdtempSync, rmSync, readFileSync } from "node:fs";
|
|
6
|
-
import { join } from "node:path";
|
|
7
|
-
import { tmpdir } from "node:os";
|
|
8
|
-
import { loadExcludeList, addExclusion, removeExclusion, clearExclusions, } from "./exclude-models.js";
|
|
9
|
-
describe("ExcludeModels", () => {
|
|
10
|
-
let tempDir;
|
|
11
|
-
let filePath;
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
tempDir = mkdtempSync(join(tmpdir(), "exclude-models-test-"));
|
|
14
|
-
filePath = join(tempDir, "exclude-models.json");
|
|
15
|
-
});
|
|
16
|
-
afterEach(() => {
|
|
17
|
-
rmSync(tempDir, { recursive: true, force: true });
|
|
18
|
-
});
|
|
19
|
-
it("returns empty set when file does not exist", () => {
|
|
20
|
-
const set = loadExcludeList(filePath);
|
|
21
|
-
expect(set.size).toBe(0);
|
|
22
|
-
});
|
|
23
|
-
it("add persists to disk and load returns it", () => {
|
|
24
|
-
const resolved = addExclusion("openai/gpt-4o", filePath);
|
|
25
|
-
expect(resolved).toBe("openai/gpt-4o");
|
|
26
|
-
const set = loadExcludeList(filePath);
|
|
27
|
-
expect(set.has("openai/gpt-4o")).toBe(true);
|
|
28
|
-
expect(set.size).toBe(1);
|
|
29
|
-
});
|
|
30
|
-
it("add multiple models", () => {
|
|
31
|
-
addExclusion("openai/gpt-4o", filePath);
|
|
32
|
-
addExclusion("anthropic/claude-sonnet-4.6", filePath);
|
|
33
|
-
const set = loadExcludeList(filePath);
|
|
34
|
-
expect(set.size).toBe(2);
|
|
35
|
-
expect(set.has("openai/gpt-4o")).toBe(true);
|
|
36
|
-
expect(set.has("anthropic/claude-sonnet-4.6")).toBe(true);
|
|
37
|
-
});
|
|
38
|
-
it("remove returns true when model was present", () => {
|
|
39
|
-
addExclusion("openai/gpt-4o", filePath);
|
|
40
|
-
const removed = removeExclusion("openai/gpt-4o", filePath);
|
|
41
|
-
expect(removed).toBe(true);
|
|
42
|
-
const set = loadExcludeList(filePath);
|
|
43
|
-
expect(set.size).toBe(0);
|
|
44
|
-
});
|
|
45
|
-
it("remove returns false when model was not present", () => {
|
|
46
|
-
const removed = removeExclusion("openai/gpt-4o", filePath);
|
|
47
|
-
expect(removed).toBe(false);
|
|
48
|
-
});
|
|
49
|
-
it("clear empties the list", () => {
|
|
50
|
-
addExclusion("openai/gpt-4o", filePath);
|
|
51
|
-
addExclusion("anthropic/claude-sonnet-4.6", filePath);
|
|
52
|
-
clearExclusions(filePath);
|
|
53
|
-
const set = loadExcludeList(filePath);
|
|
54
|
-
expect(set.size).toBe(0);
|
|
55
|
-
});
|
|
56
|
-
it("deduplication — adding same model twice results in one entry", () => {
|
|
57
|
-
addExclusion("openai/gpt-4o", filePath);
|
|
58
|
-
addExclusion("openai/gpt-4o", filePath);
|
|
59
|
-
const set = loadExcludeList(filePath);
|
|
60
|
-
expect(set.size).toBe(1);
|
|
61
|
-
});
|
|
62
|
-
it("resolves aliases — 'nvidia' becomes 'free/gpt-oss-120b'", () => {
|
|
63
|
-
const resolved = addExclusion("nvidia", filePath);
|
|
64
|
-
expect(resolved).toBe("free/gpt-oss-120b");
|
|
65
|
-
const set = loadExcludeList(filePath);
|
|
66
|
-
expect(set.has("free/gpt-oss-120b")).toBe(true);
|
|
67
|
-
expect(set.size).toBe(1);
|
|
68
|
-
});
|
|
69
|
-
it("resolves aliases — 'claude' becomes 'anthropic/claude-sonnet-4.6'", () => {
|
|
70
|
-
const resolved = addExclusion("claude", filePath);
|
|
71
|
-
expect(resolved).toBe("anthropic/claude-sonnet-4.6");
|
|
72
|
-
const set = loadExcludeList(filePath);
|
|
73
|
-
expect(set.has("anthropic/claude-sonnet-4.6")).toBe(true);
|
|
74
|
-
});
|
|
75
|
-
it("remove resolves aliases too", () => {
|
|
76
|
-
addExclusion("nvidia", filePath); // "nvidia" alias → "free/gpt-oss-120b"
|
|
77
|
-
const removed = removeExclusion("gpt-120b", filePath); // different alias for same model
|
|
78
|
-
expect(removed).toBe(true);
|
|
79
|
-
const set = loadExcludeList(filePath);
|
|
80
|
-
expect(set.size).toBe(0);
|
|
81
|
-
});
|
|
82
|
-
it("file contains sorted JSON array", () => {
|
|
83
|
-
addExclusion("openai/gpt-4o", filePath);
|
|
84
|
-
addExclusion("anthropic/claude-sonnet-4.6", filePath);
|
|
85
|
-
const raw = JSON.parse(readFileSync(filePath, "utf-8"));
|
|
86
|
-
expect(raw).toEqual(["anthropic/claude-sonnet-4.6", "openai/gpt-4o"]);
|
|
87
|
-
});
|
|
88
|
-
it("creates parent directories if they do not exist", () => {
|
|
89
|
-
const nestedPath = join(tempDir, "a", "b", "c", "exclude-models.json");
|
|
90
|
-
addExclusion("openai/gpt-4o", nestedPath);
|
|
91
|
-
const set = loadExcludeList(nestedPath);
|
|
92
|
-
expect(set.has("openai/gpt-4o")).toBe(true);
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
//# sourceMappingURL=exclude-models.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exclude-models.test.js","sourceRoot":"","sources":["../src/exclude-models.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAA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C;AACL,CAAC,CAAC,CAAC"}
|
package/dist/fs-read.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Scanner-safe file reading utilities.
|
|
3
|
-
*
|
|
4
|
-
* Uses open() + read() to avoid false positives from openclaw's
|
|
5
|
-
* potential-exfiltration heuristic in bundled output.
|
|
6
|
-
*/
|
|
7
|
-
/** Read file contents as UTF-8 string (async). */
|
|
8
|
-
export declare function readTextFile(filePath: string): Promise<string>;
|
|
9
|
-
/** Read file contents as UTF-8 string (sync). */
|
|
10
|
-
export declare function readTextFileSync(filePath: string): string;
|
|
11
|
-
//# sourceMappingURL=fs-read.d.ts.map
|
package/dist/fs-read.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fs-read.d.ts","sourceRoot":"","sources":["../src/fs-read.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,kDAAkD;AAClD,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAepE;AAED,iDAAiD;AACjD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAezD"}
|
package/dist/fs-read.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Scanner-safe file reading utilities.
|
|
3
|
-
*
|
|
4
|
-
* Uses open() + read() to avoid false positives from openclaw's
|
|
5
|
-
* potential-exfiltration heuristic in bundled output.
|
|
6
|
-
*/
|
|
7
|
-
import { open } from "node:fs/promises";
|
|
8
|
-
import { openSync, readSync, closeSync, fstatSync } from "node:fs";
|
|
9
|
-
/** Read file contents as UTF-8 string (async). */
|
|
10
|
-
export async function readTextFile(filePath) {
|
|
11
|
-
const fh = await open(filePath, "r");
|
|
12
|
-
try {
|
|
13
|
-
const size = (await fh.stat()).size;
|
|
14
|
-
const buf = Buffer.alloc(size);
|
|
15
|
-
let offset = 0;
|
|
16
|
-
while (offset < size) {
|
|
17
|
-
const { bytesRead } = await fh.read(buf, offset, size - offset, offset);
|
|
18
|
-
if (bytesRead === 0)
|
|
19
|
-
break;
|
|
20
|
-
offset += bytesRead;
|
|
21
|
-
}
|
|
22
|
-
return buf.subarray(0, offset).toString("utf-8");
|
|
23
|
-
}
|
|
24
|
-
finally {
|
|
25
|
-
await fh.close();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/** Read file contents as UTF-8 string (sync). */
|
|
29
|
-
export function readTextFileSync(filePath) {
|
|
30
|
-
const fd = openSync(filePath, "r");
|
|
31
|
-
try {
|
|
32
|
-
const size = fstatSync(fd).size;
|
|
33
|
-
const buf = Buffer.alloc(size);
|
|
34
|
-
let offset = 0;
|
|
35
|
-
while (offset < size) {
|
|
36
|
-
const bytesRead = readSync(fd, buf, offset, size - offset, offset);
|
|
37
|
-
if (bytesRead === 0)
|
|
38
|
-
break;
|
|
39
|
-
offset += bytesRead;
|
|
40
|
-
}
|
|
41
|
-
return buf.subarray(0, offset).toString("utf-8");
|
|
42
|
-
}
|
|
43
|
-
finally {
|
|
44
|
-
closeSync(fd);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=fs-read.js.map
|
package/dist/fs-read.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fs-read.js","sourceRoot":"","sources":["../src/fs-read.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEnE,kDAAkD;AAClD,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAgB;IACjD,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACrC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,CAAC,MAAM,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AAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7F,YAAY,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/journal.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session Journal - Memory layer for ClawRouter
|
|
3
|
-
*
|
|
4
|
-
* Maintains a compact record of key actions per session, enabling agents
|
|
5
|
-
* to recall earlier work even when OpenClaw's sessions_history is truncated.
|
|
6
|
-
*
|
|
7
|
-
* How it works:
|
|
8
|
-
* 1. As LLM responses flow through, extracts key actions ("I created X", "I fixed Y")
|
|
9
|
-
* 2. Stores them in a compact journal per session
|
|
10
|
-
* 3. When a request mentions past work ("what did you do today?"), injects the journal
|
|
11
|
-
*/
|
|
12
|
-
export interface JournalEntry {
|
|
13
|
-
timestamp: number;
|
|
14
|
-
action: string;
|
|
15
|
-
model?: string;
|
|
16
|
-
}
|
|
17
|
-
export interface SessionJournalConfig {
|
|
18
|
-
/** Maximum entries per session (default: 100) */
|
|
19
|
-
maxEntries?: number;
|
|
20
|
-
/** Maximum age of entries in ms (default: 24 hours) */
|
|
21
|
-
maxAgeMs?: number;
|
|
22
|
-
/** Maximum events to extract per response (default: 5) */
|
|
23
|
-
maxEventsPerResponse?: number;
|
|
24
|
-
}
|
|
25
|
-
export declare class SessionJournal {
|
|
26
|
-
private journals;
|
|
27
|
-
private config;
|
|
28
|
-
constructor(config?: SessionJournalConfig);
|
|
29
|
-
/**
|
|
30
|
-
* Extract key events from assistant response content.
|
|
31
|
-
* Looks for patterns like "I created...", "I fixed...", "Successfully..."
|
|
32
|
-
*/
|
|
33
|
-
extractEvents(content: string): string[];
|
|
34
|
-
/**
|
|
35
|
-
* Record events to the session journal.
|
|
36
|
-
*/
|
|
37
|
-
record(sessionId: string, events: string[], model?: string): void;
|
|
38
|
-
/**
|
|
39
|
-
* Check if the user message indicates a need for historical context.
|
|
40
|
-
*/
|
|
41
|
-
needsContext(lastUserMessage: string): boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Format the journal for injection into system message.
|
|
44
|
-
* Returns null if journal is empty.
|
|
45
|
-
*/
|
|
46
|
-
format(sessionId: string): string | null;
|
|
47
|
-
/**
|
|
48
|
-
* Get the raw journal entries for a session (for debugging/testing).
|
|
49
|
-
*/
|
|
50
|
-
getEntries(sessionId: string): JournalEntry[];
|
|
51
|
-
/**
|
|
52
|
-
* Clear journal for a specific session.
|
|
53
|
-
*/
|
|
54
|
-
clear(sessionId: string): void;
|
|
55
|
-
/**
|
|
56
|
-
* Clear all journals.
|
|
57
|
-
*/
|
|
58
|
-
clearAll(): void;
|
|
59
|
-
/**
|
|
60
|
-
* Get stats about the journal.
|
|
61
|
-
*/
|
|
62
|
-
getStats(): {
|
|
63
|
-
sessions: number;
|
|
64
|
-
totalEntries: number;
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=journal.d.ts.map
|
package/dist/journal.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"journal.d.ts","sourceRoot":"","sources":["../src/journal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAQD,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAA0C;IAC1D,OAAO,CAAC,MAAM,CAAiC;gBAEnC,MAAM,CAAC,EAAE,oBAAoB;IAIzC;;;OAGG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IA2DxC;;OAEG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAuBjE;;OAEG;IACH,YAAY,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO;IAqC9C;;;OAGG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAkBxC;;OAEG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,EAAE;IAI7C;;OAEG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAI9B;;OAEG;IACH,QAAQ,IAAI,IAAI;IAIhB;;OAEG;IACH,QAAQ,IAAI;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE;CAUvD"}
|