auramaxx 1.0.0-alpha.4
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/LICENSE +26 -0
- package/README.md +112 -0
- package/bin/aurawallet.js +121 -0
- package/docs/ADAPTERS.md +467 -0
- package/docs/API.md +2679 -0
- package/docs/APPS.md +198 -0
- package/docs/ARCHITECTURE.md +350 -0
- package/docs/AUTH.md +698 -0
- package/docs/BEST-PRACTICES.md +121 -0
- package/docs/CLI.md +61 -0
- package/docs/DEVELOPING-APPS.md +452 -0
- package/docs/EXTENSION.md +97 -0
- package/docs/JOBS.md +33 -0
- package/docs/MCP.md +76 -0
- package/docs/PROTOCOL.md +142 -0
- package/docs/SETUP.md +219 -0
- package/docs/WORKSPACE.md +672 -0
- package/docs/agent-auth.md +63 -0
- package/docs/aura-file.md +48 -0
- package/docs/credentials.md +53 -0
- package/docs/external/getting-started.md +65 -0
- package/docs/external/overview.md +45 -0
- package/docs/external/use-cases.md +48 -0
- package/docs/external/why-aura.md +35 -0
- package/docs/jobs/connect-agent.md +77 -0
- package/docs/jobs/migrate-from-dotenv.md +79 -0
- package/docs/jobs/recover-from-lockout.md +72 -0
- package/docs/jobs/secure-ci.md +63 -0
- package/docs/oauth2.md +42 -0
- package/docs/passkeys.md +60 -0
- package/docs/security.md +540 -0
- package/docs/specs/aura-open-protocol.md +61 -0
- package/docs/specs/aura-provider-plugin.md +24 -0
- package/docs/specs/aura-registry-model.md +31 -0
- package/docs/specs/fixtures/invalid-bad-key.aura +1 -0
- package/docs/specs/fixtures/invalid-bad-unicode-escape.aura +1 -0
- package/docs/specs/fixtures/invalid-duplicate-key.aura +2 -0
- package/docs/specs/fixtures/valid-basic.aura +4 -0
- package/docs/specs/fixtures/valid-provider-ref.aura +1 -0
- package/docs/specs/fixtures/valid-quoted-escapes.aura +2 -0
- package/docs/templates/RELEASE_NOTES_TEMPLATE.md +22 -0
- package/docs/totp.md +40 -0
- package/docs/wallet/AI.md +508 -0
- package/docs/wallet/DEVELOPING-STRATEGIES.md +713 -0
- package/docs/wallet/README.md +47 -0
- package/docs/wallet/STRATEGY.md +89 -0
- package/next.config.ts +21 -0
- package/package.json +151 -0
- package/postcss.config.mjs +8 -0
- package/prisma/migrations/20260214170000_baseline/migration.sql +511 -0
- package/prisma/migrations/20260216214537_add_passkey_model/migration.sql +18 -0
- package/prisma/migrations/20260217150500_add_credential_access_audit/migration.sql +31 -0
- package/prisma/migrations/migration_lock.toml +3 -0
- package/prisma/schema.prisma +447 -0
- package/public/logo-chevron.svg +31 -0
- package/public/logo-concentric.svg +31 -0
- package/public/logo-crosshatch.svg +39 -0
- package/public/logo-dashed.svg +39 -0
- package/public/logo-horizontal.svg +31 -0
- package/public/logo-m56.svg +64 -0
- package/public/logo.webp +0 -0
- package/scripts/add-app.js +245 -0
- package/scripts/init.sh +57 -0
- package/scripts/migrate-apikeys-to-credentials.ts +35 -0
- package/scripts/sandbox-agent-flow.sh +235 -0
- package/scripts/sandbox.sh +175 -0
- package/scripts/validate-job-docs.mjs +125 -0
- package/server/abi/SwapHelper.json +438 -0
- package/server/cli/approval.ts +447 -0
- package/server/cli/commands/app.ts +204 -0
- package/server/cli/commands/cron.ts +24 -0
- package/server/cli/commands/doctor.ts +1007 -0
- package/server/cli/commands/env.ts +456 -0
- package/server/cli/commands/init.ts +752 -0
- package/server/cli/commands/mcp.ts +125 -0
- package/server/cli/commands/restore.ts +314 -0
- package/server/cli/commands/shell-hook.ts +468 -0
- package/server/cli/commands/start.ts +62 -0
- package/server/cli/commands/status.ts +59 -0
- package/server/cli/commands/stop.ts +14 -0
- package/server/cli/commands/token.ts +180 -0
- package/server/cli/commands/unlock.ts +49 -0
- package/server/cli/commands/vault.ts +417 -0
- package/server/cli/index.ts +328 -0
- package/server/cli/lib/aura-parser.ts +64 -0
- package/server/cli/lib/credential-create.ts +74 -0
- package/server/cli/lib/credential-resolve.ts +254 -0
- package/server/cli/lib/dotenv-migrate.ts +116 -0
- package/server/cli/lib/dotenv-parser.ts +146 -0
- package/server/cli/lib/http.ts +91 -0
- package/server/cli/lib/init-steps.ts +76 -0
- package/server/cli/lib/local-agent-trust.ts +45 -0
- package/server/cli/lib/process.ts +136 -0
- package/server/cli/lib/prompt.ts +85 -0
- package/server/cli/lib/theme.ts +240 -0
- package/server/cli/socket.ts +570 -0
- package/server/cli/transport-client.ts +50 -0
- package/server/cron/index.ts +137 -0
- package/server/cron/job.ts +31 -0
- package/server/cron/jobs/balance-sync.ts +436 -0
- package/server/cron/jobs/incoming-scan.ts +506 -0
- package/server/cron/jobs/native-price.ts +70 -0
- package/server/cron/jobs/orphan-cleanup.ts +40 -0
- package/server/cron/jobs/strategy-runner.ts +175 -0
- package/server/cron/scheduler.ts +125 -0
- package/server/index.ts +406 -0
- package/server/lib/adapters/factory.ts +110 -0
- package/server/lib/adapters/index.ts +19 -0
- package/server/lib/adapters/router.ts +297 -0
- package/server/lib/adapters/telegram.ts +645 -0
- package/server/lib/adapters/types.ts +89 -0
- package/server/lib/adapters/webhook.ts +95 -0
- package/server/lib/address.ts +49 -0
- package/server/lib/agent-auth/contracts.ts +1194 -0
- package/server/lib/agent-profiles.ts +328 -0
- package/server/lib/ai.ts +285 -0
- package/server/lib/api-registry/contracts.ts +86 -0
- package/server/lib/api-registry/validation.ts +172 -0
- package/server/lib/apikey-migration.ts +189 -0
- package/server/lib/app-installer.ts +505 -0
- package/server/lib/app-tokens.ts +247 -0
- package/server/lib/auth.ts +314 -0
- package/server/lib/batch.ts +242 -0
- package/server/lib/cold.ts +874 -0
- package/server/lib/config.ts +381 -0
- package/server/lib/credential-access-audit.ts +85 -0
- package/server/lib/credential-access-policy.ts +110 -0
- package/server/lib/credential-health.ts +343 -0
- package/server/lib/credential-import.ts +487 -0
- package/server/lib/credential-scope.ts +87 -0
- package/server/lib/credential-shares.ts +190 -0
- package/server/lib/credential-transport.ts +342 -0
- package/server/lib/credential-vault.ts +77 -0
- package/server/lib/credentials.ts +333 -0
- package/server/lib/crypto.ts +8 -0
- package/server/lib/db.ts +15 -0
- package/server/lib/defaults.ts +366 -0
- package/server/lib/dex/index.ts +80 -0
- package/server/lib/dex/relay.ts +235 -0
- package/server/lib/dex/types.ts +59 -0
- package/server/lib/dex/uniswap.ts +370 -0
- package/server/lib/e2e-agent/artifacts.ts +36 -0
- package/server/lib/e2e-agent/contracts.ts +112 -0
- package/server/lib/e2e-agent/validation.ts +135 -0
- package/server/lib/encrypt.ts +128 -0
- package/server/lib/error.ts +20 -0
- package/server/lib/events.ts +205 -0
- package/server/lib/hot.ts +357 -0
- package/server/lib/key-fingerprint.ts +28 -0
- package/server/lib/logger.ts +331 -0
- package/server/lib/network.ts +137 -0
- package/server/lib/notifications.ts +219 -0
- package/server/lib/oauth2-refresh.ts +241 -0
- package/server/lib/oursecret.ts +54 -0
- package/server/lib/passkey-credential.ts +360 -0
- package/server/lib/passkey.ts +68 -0
- package/server/lib/permissions.ts +248 -0
- package/server/lib/pino.ts +24 -0
- package/server/lib/policy-preview.ts +138 -0
- package/server/lib/price.ts +338 -0
- package/server/lib/prices.ts +34 -0
- package/server/lib/project-scope.ts +239 -0
- package/server/lib/resolve-action.ts +427 -0
- package/server/lib/resolve.ts +36 -0
- package/server/lib/sessions.ts +632 -0
- package/server/lib/solana/connection.ts +26 -0
- package/server/lib/solana/jupiter.ts +128 -0
- package/server/lib/solana/transfer.ts +108 -0
- package/server/lib/solana/wallet.ts +136 -0
- package/server/lib/strategy/emits.ts +21 -0
- package/server/lib/strategy/engine.ts +1305 -0
- package/server/lib/strategy/executor.ts +115 -0
- package/server/lib/strategy/hook-context.ts +158 -0
- package/server/lib/strategy/hooks.ts +990 -0
- package/server/lib/strategy/index.ts +28 -0
- package/server/lib/strategy/installer.ts +305 -0
- package/server/lib/strategy/loader.ts +256 -0
- package/server/lib/strategy/message.ts +235 -0
- package/server/lib/strategy/repository.ts +218 -0
- package/server/lib/strategy/session-logger.ts +693 -0
- package/server/lib/strategy/sources.ts +288 -0
- package/server/lib/strategy/state.ts +189 -0
- package/server/lib/strategy/templates.ts +403 -0
- package/server/lib/strategy/tick.ts +404 -0
- package/server/lib/strategy/types.ts +230 -0
- package/server/lib/swap.ts +3 -0
- package/server/lib/temp.ts +86 -0
- package/server/lib/token-metadata.ts +86 -0
- package/server/lib/token-safety.ts +200 -0
- package/server/lib/token-search.ts +444 -0
- package/server/lib/totp.ts +194 -0
- package/server/lib/transactions.ts +123 -0
- package/server/lib/transport.ts +75 -0
- package/server/lib/txhistory/decoder.ts +262 -0
- package/server/lib/txhistory/enricher.ts +652 -0
- package/server/lib/txhistory/index.ts +391 -0
- package/server/lib/txhistory/signatures.ts +59 -0
- package/server/lib/verified-summary.ts +421 -0
- package/server/mcp/profile-policy.ts +30 -0
- package/server/mcp/server.ts +619 -0
- package/server/mcp/tools.ts +523 -0
- package/server/middleware/auth.ts +119 -0
- package/server/middleware/requestLogger.ts +84 -0
- package/server/routes/actions.ts +459 -0
- package/server/routes/adapters.ts +703 -0
- package/server/routes/addressbook.ts +113 -0
- package/server/routes/ai.ts +34 -0
- package/server/routes/apikeys.ts +295 -0
- package/server/routes/apps.ts +601 -0
- package/server/routes/auth.ts +457 -0
- package/server/routes/backup.ts +340 -0
- package/server/routes/batch.ts +270 -0
- package/server/routes/bookmarks.ts +162 -0
- package/server/routes/credential-shares.ts +198 -0
- package/server/routes/credential-vaults.ts +154 -0
- package/server/routes/credentials.ts +1290 -0
- package/server/routes/dashboard.ts +71 -0
- package/server/routes/defaults.ts +124 -0
- package/server/routes/fund.ts +229 -0
- package/server/routes/import.ts +352 -0
- package/server/routes/launch.ts +665 -0
- package/server/routes/lock.ts +54 -0
- package/server/routes/logs.ts +68 -0
- package/server/routes/nuke.ts +111 -0
- package/server/routes/passkey-credentials.ts +99 -0
- package/server/routes/passkey.ts +346 -0
- package/server/routes/portfolio.ts +217 -0
- package/server/routes/price.ts +63 -0
- package/server/routes/resolve.ts +31 -0
- package/server/routes/security.ts +45 -0
- package/server/routes/send-evm.ts +241 -0
- package/server/routes/send-solana.ts +281 -0
- package/server/routes/send.ts +178 -0
- package/server/routes/setup.ts +210 -0
- package/server/routes/strategy.ts +894 -0
- package/server/routes/swap-evm.ts +353 -0
- package/server/routes/swap-solana.ts +177 -0
- package/server/routes/swap.ts +356 -0
- package/server/routes/token.ts +247 -0
- package/server/routes/unlock.ts +403 -0
- package/server/routes/wallet-assets.ts +361 -0
- package/server/routes/wallet-transactions.ts +515 -0
- package/server/routes/wallet.ts +710 -0
- package/server/types.ts +146 -0
- package/skills/aurawallet/SKILL.md +739 -0
- package/skills/aurawallet-setup/SKILL.md +74 -0
- package/skills/security-review/SKILL.md +148 -0
- package/src/app/api/agent-requests/route.ts +30 -0
- package/src/app/api/apps/install/route.ts +126 -0
- package/src/app/api/apps/manifests/route.ts +16 -0
- package/src/app/api/apps/static/[...path]/route.ts +57 -0
- package/src/app/api/events/route.ts +92 -0
- package/src/app/api/page.tsx +212 -0
- package/src/app/api/workspace/[id]/apps/[wid]/route.ts +119 -0
- package/src/app/api/workspace/[id]/apps/route.ts +81 -0
- package/src/app/api/workspace/[id]/export/route.ts +67 -0
- package/src/app/api/workspace/[id]/route.ts +168 -0
- package/src/app/api/workspace/auth.ts +34 -0
- package/src/app/api/workspace/config/route.ts +106 -0
- package/src/app/api/workspace/import/route.ts +127 -0
- package/src/app/api/workspace/route.ts +116 -0
- package/src/app/app/page.tsx +2122 -0
- package/src/app/apple-icon.png +0 -0
- package/src/app/docs/page.tsx +178 -0
- package/src/app/favicon.ico +0 -0
- package/src/app/globals.css +572 -0
- package/src/app/health/page.tsx +5 -0
- package/src/app/hello/page.tsx +15 -0
- package/src/app/icon.png +0 -0
- package/src/app/layout.tsx +34 -0
- package/src/app/page.tsx +986 -0
- package/src/app/providers.tsx +90 -0
- package/src/app/share/[token]/page.tsx +295 -0
- package/src/components/ChainSelector.tsx +144 -0
- package/src/components/HumanActionBar.tsx +695 -0
- package/src/components/NotificationDrawer.tsx +129 -0
- package/src/components/apps/AgentKeysApp.tsx +490 -0
- package/src/components/apps/App.tsx +153 -0
- package/src/components/apps/AppGrid.tsx +15 -0
- package/src/components/apps/DetailedAddressDrawer.tsx +325 -0
- package/src/components/apps/DraggableApp.tsx +562 -0
- package/src/components/apps/IFrameApp.tsx +73 -0
- package/src/components/apps/LogsApp.tsx +360 -0
- package/src/components/apps/SendApp.tsx +394 -0
- package/src/components/apps/SetupWizardApp.tsx +1004 -0
- package/src/components/apps/SystemDefaultsApp.tsx +845 -0
- package/src/components/apps/ThirdPartyApp.tsx +428 -0
- package/src/components/apps/TokenApp.tsx +319 -0
- package/src/components/apps/TransactionsApp.tsx +438 -0
- package/src/components/apps/WalletDetailApp.tsx +1505 -0
- package/src/components/apps/index.ts +13 -0
- package/src/components/design-system/Button.tsx +53 -0
- package/src/components/design-system/ChainIndicator.tsx +65 -0
- package/src/components/design-system/ChainSelector.tsx +137 -0
- package/src/components/design-system/ConfirmationModal.tsx +106 -0
- package/src/components/design-system/ConfirmationPopover.tsx +81 -0
- package/src/components/design-system/Drawer.tsx +123 -0
- package/src/components/design-system/FilterDropdown.tsx +72 -0
- package/src/components/design-system/Modal.tsx +206 -0
- package/src/components/design-system/Popover.tsx +142 -0
- package/src/components/design-system/TextInput.tsx +85 -0
- package/src/components/design-system/Toggle.tsx +58 -0
- package/src/components/design-system/index.ts +11 -0
- package/src/components/docs/DocsThemeToggle.tsx +49 -0
- package/src/components/health/CredentialHealthDashboard.tsx +214 -0
- package/src/components/icons/ChainIcons.tsx +72 -0
- package/src/components/layout/AppStoreDrawer.tsx +369 -0
- package/src/components/layout/ContentArea.tsx +21 -0
- package/src/components/layout/TabBar.tsx +278 -0
- package/src/components/layout/WalletSidebar.tsx +1033 -0
- package/src/components/layout/index.ts +4 -0
- package/src/components/marketing/AuraWalletSpecOverlay.tsx +635 -0
- package/src/components/marketing/DeviceMorphExperience.tsx +216 -0
- package/src/components/vault/ApiKeysConsole.tsx +1080 -0
- package/src/components/vault/AuditConsole.tsx +584 -0
- package/src/components/vault/CredentialDetail.tsx +455 -0
- package/src/components/vault/CredentialEmpty.tsx +55 -0
- package/src/components/vault/CredentialField.tsx +361 -0
- package/src/components/vault/CredentialForm.tsx +1212 -0
- package/src/components/vault/CredentialList.tsx +165 -0
- package/src/components/vault/CredentialRow.tsx +97 -0
- package/src/components/vault/CredentialShareModal.tsx +178 -0
- package/src/components/vault/CredentialVault.tsx +754 -0
- package/src/components/vault/CredentialWalletWidget.tsx +103 -0
- package/src/components/vault/ImportCredentialsModal.tsx +515 -0
- package/src/components/vault/LargeTypeModal.tsx +64 -0
- package/src/components/vault/PasswordGenerator.tsx +224 -0
- package/src/components/vault/TOTPDisplay.tsx +123 -0
- package/src/components/vault/VaultSidebar.tsx +413 -0
- package/src/components/vault/types.ts +54 -0
- package/src/context/AuthContext.tsx +337 -0
- package/src/context/PriceContext.tsx +113 -0
- package/src/context/ThemeContext.tsx +164 -0
- package/src/context/WebSocketContext.tsx +269 -0
- package/src/context/WorkspaceContext.tsx +668 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useAgentActions.ts +368 -0
- package/src/hooks/useBalance.ts +103 -0
- package/src/hooks/useBalances.ts +129 -0
- package/src/instrumentation.ts +12 -0
- package/src/lib/api.ts +449 -0
- package/src/lib/app-loader.ts +148 -0
- package/src/lib/app-registry.ts +178 -0
- package/src/lib/app-sdk.ts +157 -0
- package/src/lib/audit-console-adapter.ts +151 -0
- package/src/lib/auth-client.ts +75 -0
- package/src/lib/config.ts +74 -0
- package/src/lib/crypto.ts +112 -0
- package/src/lib/db.ts +21 -0
- package/src/lib/docs.ts +390 -0
- package/src/lib/events.ts +361 -0
- package/src/lib/pino.ts +24 -0
- package/src/lib/theme-handlers.ts +168 -0
- package/src/lib/theme.ts +351 -0
- package/src/lib/tokenData.ts +378 -0
- package/src/lib/vault-crypto.ts +129 -0
- package/src/lib/websocket-server.ts +302 -0
- package/src/lib/websocket-setup.ts +79 -0
- package/src/lib/wordlist.ts +2050 -0
- package/src/lib/workspace-handlers.ts +285 -0
- package/start.sh +80 -0
- package/tailwind.config.ts +99 -0
- package/tsconfig.json +42 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { LocalAgentProfileMode } from '../../lib/agent-profiles';
|
|
2
|
+
import { fetchJson } from './http';
|
|
3
|
+
|
|
4
|
+
export interface LocalAgentTrustDefaults {
|
|
5
|
+
profile: LocalAgentProfileMode;
|
|
6
|
+
profileVersion: 'v1';
|
|
7
|
+
autoApprove: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function resolveLocalAgentModeChoice(input: string): LocalAgentProfileMode {
|
|
11
|
+
const normalized = input.trim().toLowerCase();
|
|
12
|
+
if (normalized === '2' || normalized === 'strict') return 'strict';
|
|
13
|
+
if (normalized === '3' || normalized === 'admin') return 'admin';
|
|
14
|
+
return 'dev';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function toLocalAgentTrustDefaults(profile: LocalAgentProfileMode): LocalAgentTrustDefaults {
|
|
18
|
+
return {
|
|
19
|
+
profile,
|
|
20
|
+
profileVersion: 'v1',
|
|
21
|
+
autoApprove: profile !== 'strict',
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function persistLocalAgentTrustDefaults(token: string, profile: LocalAgentProfileMode): Promise<LocalAgentTrustDefaults> {
|
|
26
|
+
const defaults = toLocalAgentTrustDefaults(profile);
|
|
27
|
+
|
|
28
|
+
await fetchJson('/defaults/trust.localProfile', {
|
|
29
|
+
method: 'PATCH',
|
|
30
|
+
body: { value: defaults.profile },
|
|
31
|
+
token,
|
|
32
|
+
});
|
|
33
|
+
await fetchJson('/defaults/trust.localProfileVersion', {
|
|
34
|
+
method: 'PATCH',
|
|
35
|
+
body: { value: defaults.profileVersion },
|
|
36
|
+
token,
|
|
37
|
+
});
|
|
38
|
+
await fetchJson('/defaults/trust.localAutoApprove', {
|
|
39
|
+
method: 'PATCH',
|
|
40
|
+
body: { value: defaults.autoApprove },
|
|
41
|
+
token,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
return defaults;
|
|
45
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process management for CLI commands
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { spawn, ChildProcess, execSync } from 'child_process';
|
|
6
|
+
import { randomBytes } from 'crypto';
|
|
7
|
+
import * as path from 'path';
|
|
8
|
+
import * as fs from 'fs';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Find the project root by walking up from __dirname to find package.json with name "aurawallet"
|
|
12
|
+
*/
|
|
13
|
+
export function findProjectRoot(): string {
|
|
14
|
+
let dir = __dirname;
|
|
15
|
+
for (let i = 0; i < 10; i++) {
|
|
16
|
+
const pkgPath = path.join(dir, 'package.json');
|
|
17
|
+
if (fs.existsSync(pkgPath)) {
|
|
18
|
+
try {
|
|
19
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
20
|
+
if (pkg.name === 'aurawallet') return dir;
|
|
21
|
+
} catch {
|
|
22
|
+
// Not valid JSON, keep going
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const parent = path.dirname(dir);
|
|
26
|
+
if (parent === dir) break;
|
|
27
|
+
dir = parent;
|
|
28
|
+
}
|
|
29
|
+
throw new Error('Could not find aurawallet project root');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Stop any running AuraWallet server processes
|
|
34
|
+
*/
|
|
35
|
+
export function stopServer(): void {
|
|
36
|
+
// In sandbox mode, don't kill other processes — the sandbox script manages its own
|
|
37
|
+
if (process.env.SANDBOX_MODE) return;
|
|
38
|
+
|
|
39
|
+
const patterns = [
|
|
40
|
+
'tsx server/index.ts',
|
|
41
|
+
'tsx watch server/index.ts',
|
|
42
|
+
'tsx server/cron/index.ts',
|
|
43
|
+
'next dev -p 4747',
|
|
44
|
+
'next start -p 4747',
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
for (const pattern of patterns) {
|
|
48
|
+
try {
|
|
49
|
+
execSync(`pkill -f "${pattern}" 2>/dev/null`, { stdio: 'ignore' });
|
|
50
|
+
} catch {
|
|
51
|
+
// Process not found, that's fine
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Give processes a moment to die
|
|
56
|
+
try {
|
|
57
|
+
execSync('sleep 0.5', { stdio: 'ignore' });
|
|
58
|
+
} catch {
|
|
59
|
+
// Ignore
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Start the AuraWallet server processes
|
|
65
|
+
* Returns child processes for cleanup
|
|
66
|
+
*/
|
|
67
|
+
export function startServer(opts: { headless?: boolean } = {}): ChildProcess[] {
|
|
68
|
+
const root = findProjectRoot();
|
|
69
|
+
const children: ChildProcess[] = [];
|
|
70
|
+
|
|
71
|
+
// Set BYPASS_RATE_LIMIT for local dev
|
|
72
|
+
// Generate a shared secret so the cron server can authenticate with the wallet server's internal endpoints.
|
|
73
|
+
// Regenerated every start, so it's ephemeral like the SIGNING_KEY.
|
|
74
|
+
const cronSecret = randomBytes(32).toString('hex');
|
|
75
|
+
const env = { ...process.env, BYPASS_RATE_LIMIT: 'true', STRATEGY_CRON_SHARED_SECRET: cronSecret };
|
|
76
|
+
const useNodeTsxLoader = process.env.SANDBOX_MODE === 'true' || process.env.AURA_FORCE_NODE_TSX === '1';
|
|
77
|
+
const tsRunnerCmd = useNodeTsxLoader ? process.execPath : 'npx';
|
|
78
|
+
const tsRunnerArgs = (entryFile: string) =>
|
|
79
|
+
useNodeTsxLoader ? ['--import', 'tsx', entryFile] : ['tsx', entryFile];
|
|
80
|
+
|
|
81
|
+
// Start Express server
|
|
82
|
+
const server = spawn(tsRunnerCmd, tsRunnerArgs('server/index.ts'), {
|
|
83
|
+
cwd: root,
|
|
84
|
+
env,
|
|
85
|
+
stdio: 'ignore',
|
|
86
|
+
detached: true,
|
|
87
|
+
});
|
|
88
|
+
server.unref();
|
|
89
|
+
children.push(server);
|
|
90
|
+
|
|
91
|
+
// Start cron server
|
|
92
|
+
const cron = spawn(tsRunnerCmd, tsRunnerArgs('server/cron/index.ts'), {
|
|
93
|
+
cwd: root,
|
|
94
|
+
env,
|
|
95
|
+
stdio: 'ignore',
|
|
96
|
+
detached: true,
|
|
97
|
+
});
|
|
98
|
+
cron.unref();
|
|
99
|
+
children.push(cron);
|
|
100
|
+
|
|
101
|
+
// Start Next.js dashboard unless headless
|
|
102
|
+
if (!opts.headless) {
|
|
103
|
+
const dashboardPort = process.env.DASHBOARD_PORT || '4747';
|
|
104
|
+
const dashboard = spawn('npx', ['next', 'dev', '-p', dashboardPort], {
|
|
105
|
+
cwd: root,
|
|
106
|
+
env,
|
|
107
|
+
stdio: 'ignore',
|
|
108
|
+
detached: true,
|
|
109
|
+
});
|
|
110
|
+
dashboard.unref();
|
|
111
|
+
children.push(dashboard);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return children;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Clean up temp files (lock files, socket files)
|
|
119
|
+
*/
|
|
120
|
+
export function cleanupTempFiles(): void {
|
|
121
|
+
const uid = process.getuid?.() ?? 'unknown';
|
|
122
|
+
const files = [
|
|
123
|
+
`/tmp/aura-cli-${uid}.lock`,
|
|
124
|
+
`/tmp/aura-cli-${uid}.sock`,
|
|
125
|
+
];
|
|
126
|
+
|
|
127
|
+
for (const file of files) {
|
|
128
|
+
try {
|
|
129
|
+
if (fs.existsSync(file)) {
|
|
130
|
+
fs.unlinkSync(file);
|
|
131
|
+
}
|
|
132
|
+
} catch {
|
|
133
|
+
// Ignore cleanup errors
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive prompts for CLI commands
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as readline from 'readline';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Prompt for a password with hidden input
|
|
9
|
+
*/
|
|
10
|
+
export async function promptPassword(label: string = 'Password'): Promise<string> {
|
|
11
|
+
return new Promise((resolve) => {
|
|
12
|
+
const rl = readline.createInterface({
|
|
13
|
+
input: process.stdin,
|
|
14
|
+
output: process.stdout,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
process.stdout.write(`${label}: `);
|
|
18
|
+
|
|
19
|
+
const stdin = process.stdin;
|
|
20
|
+
const wasRaw = stdin.isRaw;
|
|
21
|
+
|
|
22
|
+
if (stdin.isTTY) {
|
|
23
|
+
stdin.setRawMode(true);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let password = '';
|
|
27
|
+
|
|
28
|
+
const onData = (char: Buffer) => {
|
|
29
|
+
const c = char.toString();
|
|
30
|
+
|
|
31
|
+
if (c === '\n' || c === '\r') {
|
|
32
|
+
stdin.removeListener('data', onData);
|
|
33
|
+
if (stdin.isTTY) {
|
|
34
|
+
stdin.setRawMode(wasRaw ?? false);
|
|
35
|
+
}
|
|
36
|
+
process.stdout.write('\n');
|
|
37
|
+
rl.close();
|
|
38
|
+
resolve(password);
|
|
39
|
+
} else if (c === '\u0003') {
|
|
40
|
+
// Ctrl+C
|
|
41
|
+
process.stdout.write('\n');
|
|
42
|
+
process.exit(1);
|
|
43
|
+
} else if (c === '\u007f' || c === '\b') {
|
|
44
|
+
if (password.length > 0) {
|
|
45
|
+
password = password.slice(0, -1);
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
password += c;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
stdin.on('data', onData);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Prompt for visible text input
|
|
58
|
+
*/
|
|
59
|
+
export async function promptInput(label: string): Promise<string> {
|
|
60
|
+
return new Promise((resolve) => {
|
|
61
|
+
const rl = readline.createInterface({
|
|
62
|
+
input: process.stdin,
|
|
63
|
+
output: process.stdout,
|
|
64
|
+
});
|
|
65
|
+
rl.question(`${label}: `, (answer) => {
|
|
66
|
+
rl.close();
|
|
67
|
+
resolve(answer.trim());
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Prompt for yes/no confirmation
|
|
74
|
+
*/
|
|
75
|
+
export async function promptConfirm(msg: string): Promise<boolean> {
|
|
76
|
+
const answer = await promptInput(`${msg} (y/n)`);
|
|
77
|
+
return answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Wait for the user to press Enter
|
|
82
|
+
*/
|
|
83
|
+
export async function waitForEnter(msg: string = 'Press Enter to continue...'): Promise<void> {
|
|
84
|
+
await promptInput(msg);
|
|
85
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aura CLI Theme — Medical / Industrial / Tyvek
|
|
3
|
+
*
|
|
4
|
+
* Shared visual primitives for all CLI commands.
|
|
5
|
+
* Inspired by the AuraWallet SVG logo system: registration corner marks,
|
|
6
|
+
* three diagonal stripes at 45° (aura_logo.svg), dot micro-textures, monochrome fills.
|
|
7
|
+
*
|
|
8
|
+
* All output degrades safely in non-TTY / NO_COLOR / CI / TERM=dumb.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// ── ANSI ─────────────────────────────────────────────────────
|
|
12
|
+
|
|
13
|
+
const ANSI = {
|
|
14
|
+
reset: '\x1b[0m',
|
|
15
|
+
bold: '\x1b[1m',
|
|
16
|
+
dim: '\x1b[2m',
|
|
17
|
+
italic: '\x1b[3m',
|
|
18
|
+
fgCyan: '\x1b[36m',
|
|
19
|
+
fgGreen: '\x1b[32m',
|
|
20
|
+
fgRed: '\x1b[31m',
|
|
21
|
+
fgYellow:'\x1b[33m',
|
|
22
|
+
fgGray: '\x1b[90m',
|
|
23
|
+
} as const;
|
|
24
|
+
|
|
25
|
+
export function supportsColor(): boolean {
|
|
26
|
+
if (!process.stdout.isTTY) return false;
|
|
27
|
+
if (process.env.NO_COLOR) return false;
|
|
28
|
+
if (process.env.CI === 'true') return false;
|
|
29
|
+
return process.env.TERM !== 'dumb';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const USE_COLOR = supportsColor();
|
|
33
|
+
|
|
34
|
+
export function paint(text: string, ...codes: string[]): string {
|
|
35
|
+
if (!USE_COLOR) return text;
|
|
36
|
+
return `${codes.join('')}${text}${ANSI.reset}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// ── Constants ────────────────────────────────────────────────
|
|
40
|
+
|
|
41
|
+
const W = 62; // content width (fits 80-col with 2-char indent + padding)
|
|
42
|
+
|
|
43
|
+
export const SEPARATOR = ' ' + '- '.repeat(Math.floor(W / 2));
|
|
44
|
+
|
|
45
|
+
const CORNER_TL = paint('.-', ANSI.fgGray);
|
|
46
|
+
const CORNER_TR = paint('-.', ANSI.fgGray);
|
|
47
|
+
const CORNER_BL = paint("'-", ANSI.fgGray);
|
|
48
|
+
const CORNER_BR = paint("-'", ANSI.fgGray);
|
|
49
|
+
|
|
50
|
+
// ── Banner ───────────────────────────────────────────────────
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Print the Aura branded banner.
|
|
54
|
+
*
|
|
55
|
+
* Left side: three diagonal stripes at 45° inside a bordered square —
|
|
56
|
+
* matching the canonical Aura logo (website/public/aura_logo.svg:
|
|
57
|
+
* three rotated rects clipped to a square with corner marks).
|
|
58
|
+
* Right side: AURA wordmark + subtitle.
|
|
59
|
+
* Outer frame: crop-mark corners (from all SVG logos).
|
|
60
|
+
*/
|
|
61
|
+
export function printBanner(subtitle?: string): void {
|
|
62
|
+
const sub = subtitle ? subtitle.toUpperCase() : '';
|
|
63
|
+
|
|
64
|
+
const P = paint('|', ANSI.fgGray); // outer pipe
|
|
65
|
+
const LP = paint('|', ANSI.fgGray); // logo pipe
|
|
66
|
+
const S = (t: string) => paint(t, ANSI.bold); // stripe chars
|
|
67
|
+
|
|
68
|
+
// Logo box borders (dashed, matching Tyvek style)
|
|
69
|
+
const LT = paint('.', ANSI.fgGray) + paint('----------', ANSI.dim) + paint('.', ANSI.fgGray);
|
|
70
|
+
const LB = paint("'", ANSI.fgGray) + paint('----------', ANSI.dim) + paint("'", ANSI.fgGray);
|
|
71
|
+
|
|
72
|
+
// Three diagonal stripes inside a 12×5 square (≈ square at 2:1 char ratio)
|
|
73
|
+
// Row 1: |// // //| Row 2: | // // /| Row 3: | // // |
|
|
74
|
+
const r1 = `${LP}${S('//')} ${S('//')} ${S('//')}${LP}`;
|
|
75
|
+
const r2 = `${LP} ${S('//')} ${S('//')} ${S('/')}${LP}`;
|
|
76
|
+
const r3 = `${LP} ${S('//')} ${S('//')} ${LP}`;
|
|
77
|
+
|
|
78
|
+
console.log('');
|
|
79
|
+
console.log(` ${CORNER_TL}${paint(' '.repeat(W - 4), ANSI.dim)}${CORNER_TR}`);
|
|
80
|
+
console.log(` ${P} ${LT}${' '.repeat(W - 19)}${P}`);
|
|
81
|
+
console.log(` ${P} ${r1} ${paint('A U R A', ANSI.bold)}${' '.repeat(W - 30)}${P}`);
|
|
82
|
+
console.log(` ${P} ${r2} ${paint('W A L L E T', ANSI.dim)}${' '.repeat(W - 34)}${P}`);
|
|
83
|
+
console.log(` ${P} ${r3} ${sub ? paint(sub, ANSI.fgCyan) : ''}${' '.repeat(Math.max(0, W - 23 - sub.length))}${P}`);
|
|
84
|
+
console.log(` ${P} ${LB}${' '.repeat(W - 19)}${P}`);
|
|
85
|
+
console.log(` ${CORNER_BL}${paint(' '.repeat(W - 4), ANSI.dim)}${CORNER_BR}`);
|
|
86
|
+
console.log('');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// ── Section ──────────────────────────────────────────────────
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Print a section header with Tyvek-style framing.
|
|
93
|
+
*
|
|
94
|
+
* Output:
|
|
95
|
+
* - - - - - - - - - - - - - - - - - - -
|
|
96
|
+
* [ SECTION TITLE ]
|
|
97
|
+
* Optional subtitle
|
|
98
|
+
*/
|
|
99
|
+
export function printSection(title: string, subtitle?: string): void {
|
|
100
|
+
console.log('');
|
|
101
|
+
console.log(SEPARATOR);
|
|
102
|
+
console.log(` ${paint(`[ ${title.toUpperCase()} ]`, ANSI.bold)}`);
|
|
103
|
+
if (subtitle) {
|
|
104
|
+
console.log(` ${paint(subtitle, ANSI.dim)}`);
|
|
105
|
+
}
|
|
106
|
+
console.log('');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// ── Box ──────────────────────────────────────────────────────
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Print a framed box with crop-mark corners.
|
|
113
|
+
* Replaces the old ╔═══╗ double-line Unicode boxes.
|
|
114
|
+
*
|
|
115
|
+
* Output:
|
|
116
|
+
* .- - - - - - - - - - - - - - - - -.
|
|
117
|
+
* | Line 1 |
|
|
118
|
+
* | Line 2 |
|
|
119
|
+
* '- - - - - - - - - - - - - - - - -'
|
|
120
|
+
*/
|
|
121
|
+
export function printBox(lines: string[]): void {
|
|
122
|
+
const inner = W - 4; // account for "| " and " |"
|
|
123
|
+
const dashes = '- '.repeat(Math.floor((W - 2) / 2));
|
|
124
|
+
|
|
125
|
+
console.log(` ${CORNER_TL}${paint(dashes.slice(0, W - 4), ANSI.dim)}${CORNER_TR}`);
|
|
126
|
+
for (const line of lines) {
|
|
127
|
+
// Strip ANSI to measure visible length for padding
|
|
128
|
+
const visible = line.replace(/\x1b\[[0-9;]*m/g, '');
|
|
129
|
+
const pad = Math.max(0, inner - visible.length);
|
|
130
|
+
console.log(` ${paint('|', ANSI.fgGray)} ${line}${' '.repeat(pad)}${paint('|', ANSI.fgGray)}`);
|
|
131
|
+
}
|
|
132
|
+
console.log(` ${CORNER_BL}${paint(dashes.slice(0, W - 4), ANSI.dim)}${CORNER_BR}`);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// ── Status line ──────────────────────────────────────────────
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Print a key/value status line.
|
|
139
|
+
*
|
|
140
|
+
* Output:
|
|
141
|
+
* Label: value
|
|
142
|
+
* Label: [ok] value
|
|
143
|
+
*/
|
|
144
|
+
export function printStatus(label: string, value: string, ok?: boolean): void {
|
|
145
|
+
const paddedLabel = label.padEnd(16);
|
|
146
|
+
let indicator = '';
|
|
147
|
+
if (ok === true) indicator = paint('[ok]', ANSI.fgGreen) + ' ';
|
|
148
|
+
else if (ok === false) indicator = paint('[--]', ANSI.fgRed) + ' ';
|
|
149
|
+
console.log(` ${paint(paddedLabel, ANSI.dim)}${indicator}${value}`);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// ── Check result (for doctor) ────────────────────────────────
|
|
153
|
+
|
|
154
|
+
export type CheckBadge = 'pass' | 'warn' | 'fail';
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Format a diagnostic check badge in Tyvek style.
|
|
158
|
+
*/
|
|
159
|
+
export function checkBadge(status: CheckBadge): string {
|
|
160
|
+
switch (status) {
|
|
161
|
+
case 'pass': return paint('[PASS]', ANSI.fgGreen, ANSI.bold);
|
|
162
|
+
case 'warn': return paint('[WARN]', ANSI.fgYellow, ANSI.bold);
|
|
163
|
+
case 'fail': return paint('[FAIL]', ANSI.fgRed, ANSI.bold);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// ── Completion ───────────────────────────────────────────────
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Print a branded completion message.
|
|
171
|
+
*/
|
|
172
|
+
export function printComplete(message: string): void {
|
|
173
|
+
console.log('');
|
|
174
|
+
console.log(SEPARATOR);
|
|
175
|
+
console.log(` ${paint('[ok]', ANSI.fgGreen)} ${paint(message, ANSI.bold)}`);
|
|
176
|
+
console.log('');
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// ── Seed phrase box (security-critical) ──────────────────────
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Display a seed phrase in a clearly framed box.
|
|
183
|
+
* This is security-critical — readability is paramount.
|
|
184
|
+
*/
|
|
185
|
+
export function printSeedPhrase(mnemonic: string): void {
|
|
186
|
+
const words = mnemonic.split(' ');
|
|
187
|
+
const inner = 46;
|
|
188
|
+
|
|
189
|
+
console.log('');
|
|
190
|
+
console.log(` ${CORNER_TL}${paint('-'.repeat(inner), ANSI.dim)}${CORNER_TR}`);
|
|
191
|
+
console.log(` ${paint('|', ANSI.fgGray)} ${paint('SEED PHRASE', ANSI.bold)}${' '.repeat(inner - 14)}${paint('|', ANSI.fgGray)}`);
|
|
192
|
+
console.log(` ${paint('|', ANSI.fgGray)} ${paint('Write this down. Store it safely.', ANSI.dim)}${' '.repeat(inner - 36)}${paint('|', ANSI.fgGray)}`);
|
|
193
|
+
console.log(` ${paint('|', ANSI.fgGray)}${' '.repeat(inner + 2)}${paint('|', ANSI.fgGray)}`);
|
|
194
|
+
for (let i = 0; i < words.length; i += 4) {
|
|
195
|
+
const line = words.slice(i, i + 4)
|
|
196
|
+
.map((w, j) => `${String(i + j + 1).padStart(2)}. ${w.padEnd(10)}`)
|
|
197
|
+
.join('');
|
|
198
|
+
const pad = Math.max(0, inner - 2 - line.length);
|
|
199
|
+
console.log(` ${paint('|', ANSI.fgGray)} ${line}${' '.repeat(pad)}${paint('|', ANSI.fgGray)}`);
|
|
200
|
+
}
|
|
201
|
+
console.log(` ${paint('|', ANSI.fgGray)}${' '.repeat(inner + 2)}${paint('|', ANSI.fgGray)}`);
|
|
202
|
+
console.log(` ${paint('|', ANSI.fgGray)} ${paint('It cannot be recovered.', ANSI.fgRed)}${' '.repeat(inner - 27)}${paint('|', ANSI.fgGray)}`);
|
|
203
|
+
console.log(` ${CORNER_BL}${paint('-'.repeat(inner), ANSI.dim)}${CORNER_BR}`);
|
|
204
|
+
console.log('');
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// ── Help formatter ───────────────────────────────────────────
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Print a branded help screen.
|
|
211
|
+
*/
|
|
212
|
+
export function printHelp(
|
|
213
|
+
title: string,
|
|
214
|
+
usage: string,
|
|
215
|
+
commands: Array<{ name: string; desc: string }>,
|
|
216
|
+
extras?: string[],
|
|
217
|
+
): void {
|
|
218
|
+
printBanner(title);
|
|
219
|
+
|
|
220
|
+
console.log(` ${paint('Usage:', ANSI.bold)} ${usage}`);
|
|
221
|
+
console.log('');
|
|
222
|
+
|
|
223
|
+
if (commands.length > 0) {
|
|
224
|
+
console.log(` ${paint('Commands:', ANSI.bold)}`);
|
|
225
|
+
const maxName = Math.max(...commands.map(c => c.name.length));
|
|
226
|
+
for (const cmd of commands) {
|
|
227
|
+
console.log(` ${paint(cmd.name.padEnd(maxName + 2), ANSI.fgCyan)}${cmd.desc}`);
|
|
228
|
+
}
|
|
229
|
+
console.log('');
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (extras) {
|
|
233
|
+
for (const line of extras) {
|
|
234
|
+
console.log(` ${line}`);
|
|
235
|
+
}
|
|
236
|
+
console.log('');
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export { ANSI, USE_COLOR, W };
|