routstrd 0.4.5 → 0.4.7
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 +14 -0
- package/dist/daemon/index.js +68073 -77087
- package/dist/index.js +235 -192
- package/package.json +9 -2
- package/src/cli.ts +63 -15
- package/src/daemon/http/index.ts +1857 -0
- package/src/daemon/index.ts +408 -0
- package/src/daemon/wallet/index.ts +360 -0
- package/src/index.ts +4 -0
- package/src/integrations/index.ts +159 -0
- package/src/tui/usage/index.ts +1 -0
- package/.claude/settings.local.json +0 -10
- package/.dockerignore +0 -12
- package/COCO-2.0.0-MIGRATION-PLAN.md +0 -1191
- package/Dockerfile +0 -11
- package/IMPLEMENTATION.md +0 -253
- package/SKILL.md +0 -324
- package/bun.lock +0 -808
- package/docker-compose.yml +0 -15
- package/refund.js +0 -33
- package/refund_new.js +0 -20
- package/routstr-cost-logging.md +0 -71
- package/test_box.ts +0 -15
- package/test_chat.sh +0 -29
- package/test_curl.sh +0 -11
- package/test_split_box.ts +0 -17
- package/test_split_box2.ts +0 -23
- package/tests/daemon/config-store.perms.test.ts +0 -55
- package/tests/daemon/config-store.scenario.ts +0 -113
- package/tests/integrations/hermes.test.ts +0 -134
- package/tests/utils/daemon-client.test.ts +0 -61
- package/tests/wallet/short-keyset-token.test.ts +0 -106
- package/tsconfig.json +0 -20
- package/v1-messages-format-report.md +0 -223
package/package.json
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "routstrd",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"module": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
7
7
|
"bin": {
|
|
8
8
|
"routstrd": "./dist/index.js"
|
|
9
9
|
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"src",
|
|
13
|
+
"README.md",
|
|
14
|
+
"SECURITY.md"
|
|
15
|
+
],
|
|
10
16
|
"scripts": {
|
|
11
17
|
"start": "bun src/index.ts start",
|
|
18
|
+
"stop": "bun src/index.ts stop",
|
|
12
19
|
"monitor": "bun src/index.ts monitor",
|
|
13
20
|
"lint": "tsc --noEmit",
|
|
14
21
|
"test": "bun test",
|
|
@@ -26,7 +33,7 @@
|
|
|
26
33
|
"@cashu/cashu-ts": "^4.3.0",
|
|
27
34
|
"@cashu/coco-core": "^1.0.1",
|
|
28
35
|
"@cashu/coco-sqlite-bun": "^1.0.1",
|
|
29
|
-
"@routstr/sdk": "^0.4.
|
|
36
|
+
"@routstr/sdk": "^0.4.2",
|
|
30
37
|
"@scure/bip39": "^2.2.0",
|
|
31
38
|
"applesauce-core": "^5.1.0",
|
|
32
39
|
"applesauce-relay": "^5.1.0",
|
package/src/cli.ts
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
type RoutstrdConfig,
|
|
29
29
|
} from "./utils/config";
|
|
30
30
|
import { COCO_LOGS_DIR, logger } from "./utils/logger";
|
|
31
|
-
import { setupIntegration, runIntegrationsForClients } from "./integrations";
|
|
31
|
+
import { setupIntegration, runIntegrationsForClients, type IntegrationKey } from "./integrations";
|
|
32
32
|
import {
|
|
33
33
|
assertLegacyCocodNotRunning,
|
|
34
34
|
claimLegacyCocodPidFile,
|
|
@@ -215,7 +215,7 @@ async function requireLocalDaemon(): Promise<void> {
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
async function initDaemon(): Promise<void> {
|
|
218
|
+
async function initDaemon(integrationKey?: IntegrationKey): Promise<void> {
|
|
219
219
|
console.log("Initializing routstrd...");
|
|
220
220
|
|
|
221
221
|
// Create config directory (0700, correcting existing installs too)
|
|
@@ -273,7 +273,7 @@ async function initDaemon(): Promise<void> {
|
|
|
273
273
|
|
|
274
274
|
await startDaemon({ port: String(config.port || 8008), host: config.host || undefined });
|
|
275
275
|
|
|
276
|
-
await setupIntegration(config);
|
|
276
|
+
await setupIntegration(config, integrationKey);
|
|
277
277
|
|
|
278
278
|
console.log("\nInitialization complete!");
|
|
279
279
|
console.log(
|
|
@@ -574,20 +574,68 @@ program
|
|
|
574
574
|
.description(
|
|
575
575
|
"Initialize routstrd (creates config directory and initializes wallet)",
|
|
576
576
|
)
|
|
577
|
-
.
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
577
|
+
.option("--opencode", "Set up OpenCode integration (non-interactive)")
|
|
578
|
+
.option("--openclaw", "Set up OpenClaw integration (non-interactive)")
|
|
579
|
+
.option("--pi-agent", "Set up Pi Agent integration (non-interactive)")
|
|
580
|
+
.option("--claude-code", "Set up Claude Code integration (non-interactive)")
|
|
581
|
+
.option("--hermes", "Set up Hermes integration (non-interactive)")
|
|
582
|
+
.option("--skip-integration", "Skip integration setup")
|
|
583
|
+
.action(
|
|
584
|
+
async (options: {
|
|
585
|
+
opencode?: boolean;
|
|
586
|
+
openclaw?: boolean;
|
|
587
|
+
piAgent?: boolean;
|
|
588
|
+
claudeCode?: boolean;
|
|
589
|
+
hermes?: boolean;
|
|
590
|
+
skipIntegration?: boolean;
|
|
591
|
+
}) => {
|
|
592
|
+
await requireLocalDaemon();
|
|
593
|
+
|
|
594
|
+
const integrationFlags: Record<string, boolean | undefined> = {
|
|
595
|
+
opencode: options.opencode,
|
|
596
|
+
openclaw: options.openclaw,
|
|
597
|
+
"pi-agent": options.piAgent,
|
|
598
|
+
"claude-code": options.claudeCode,
|
|
599
|
+
hermes: options.hermes,
|
|
600
|
+
};
|
|
601
|
+
const selectedIntegrations = Object.keys(integrationFlags).filter(
|
|
602
|
+
(key) => integrationFlags[key],
|
|
603
|
+
);
|
|
604
|
+
|
|
605
|
+
if (selectedIntegrations.length > 1) {
|
|
606
|
+
console.error(
|
|
607
|
+
"Error: use only one integration flag, or use 'routstrd clients add' for multiple clients.",
|
|
608
|
+
);
|
|
586
609
|
process.exit(1);
|
|
587
610
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
611
|
+
|
|
612
|
+
if (options.skipIntegration && selectedIntegrations.length > 0) {
|
|
613
|
+
console.error(
|
|
614
|
+
"Error: --skip-integration cannot be combined with an integration flag.",
|
|
615
|
+
);
|
|
616
|
+
process.exit(1);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
let integrationKey: IntegrationKey | undefined;
|
|
620
|
+
if (options.skipIntegration) {
|
|
621
|
+
integrationKey = "skip";
|
|
622
|
+
} else if (selectedIntegrations.length === 1) {
|
|
623
|
+
integrationKey = selectedIntegrations[0];
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
try {
|
|
627
|
+
await initDaemon(integrationKey);
|
|
628
|
+
} catch (error) {
|
|
629
|
+
// An expected, user-actionable refusal — print the structured message
|
|
630
|
+
// without Bun's unhandled-rejection source snippet and stack trace.
|
|
631
|
+
if (error instanceof WalletMigrationConflictError) {
|
|
632
|
+
console.error(error.message);
|
|
633
|
+
process.exit(1);
|
|
634
|
+
}
|
|
635
|
+
throw error;
|
|
636
|
+
}
|
|
637
|
+
},
|
|
638
|
+
);
|
|
591
639
|
|
|
592
640
|
// Start - start the background daemon
|
|
593
641
|
program
|