@tangle-network/blueprint-ui 0.1.2 → 0.3.1

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.
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/utils/resolveOperatorRpc.ts","../src/contracts/chains.ts","../src/utils/env.ts","../src/stores/persistedAtom.ts","../src/stores/txHistory.ts","../src/stores/infra.ts","../src/stores/theme.ts","../src/contracts/abi.ts","../src/contracts/publicClient.ts","../src/contracts/generic-encoder.ts","../src/hooks/useJobForm.ts","../src/hooks/useQuotes.ts","../src/hooks/useJobPrice.ts","../src/hooks/useSubmitJob.ts","../src/hooks/useThemeValue.ts"],"sourcesContent":["/** Rewrite operator RPC hostname for browser reachability. */\nexport function resolveOperatorRpc(raw: string): string {\n if (typeof window === 'undefined') return raw;\n const withProto = raw.includes('://') ? raw : `http://${raw}`;\n try {\n const url = new URL(withProto);\n const pageHost = window.location.hostname;\n const isNonRoutable =\n url.hostname.endsWith('.local') ||\n !url.hostname.includes('.') ||\n url.hostname === '127.0.0.1' ||\n url.hostname === 'localhost';\n if (isNonRoutable && pageHost !== url.hostname) {\n url.hostname = pageHost;\n }\n return url.toString().replace(/\\/$/, '');\n } catch {\n return withProto;\n }\n}\n","import { defineChain } from 'viem';\nimport { mainnet } from 'viem/chains';\nimport type { Address, Chain } from 'viem';\nimport { getEnvVar, isDevEnv } from '../utils/env';\n\n/**\n * Resolve RPC URL for the current environment.\n * Handles local dev (hostname swap), Vite dev proxy, and remote access.\n */\nexport function resolveRpcUrl(envUrl?: string): string {\n const configured = envUrl ?? getEnvVar('VITE_RPC_URL') ?? 'http://localhost:8545';\n if (typeof window === 'undefined') return configured;\n try {\n const rpc = new URL(configured);\n const isLocalRpc = rpc.hostname === '127.0.0.1' || rpc.hostname === 'localhost';\n const pageHost = window.location.hostname;\n const isLocalPage = pageHost === '127.0.0.1' || pageHost === 'localhost';\n // Dev-mode proxy for LAN access to local RPC\n if (isLocalRpc && !isLocalPage && isDevEnv()) {\n return `${window.location.origin}/rpc-proxy`;\n }\n // Non-dev LAN access: swap hostname\n if (isLocalRpc && !isLocalPage) {\n rpc.hostname = pageHost;\n return rpc.toString().replace(/\\/$/, '');\n }\n } catch {\n // malformed\n }\n return configured;\n}\n\nexport const rpcUrl = resolveRpcUrl();\n\nexport interface LocalChainOptions {\n chainId?: number;\n rpcUrl?: string;\n}\n\nexport function createTangleLocalChain(options: LocalChainOptions = {}) {\n const chainId = options.chainId ?? Number(getEnvVar('VITE_CHAIN_ID') ?? 31337);\n const localRpcUrl = resolveRpcUrl(options.rpcUrl);\n\n return defineChain({\n id: chainId,\n name: 'Tangle Local',\n nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },\n rpcUrls: { default: { http: [localRpcUrl] } },\n blockExplorers: { default: { name: 'Explorer', url: '' } },\n contracts: { multicall3: { address: '0xcA11bde05977b3631167028862bE2a173976CA11' } },\n });\n}\n\nexport const tangleLocal = createTangleLocalChain();\n\nexport const tangleTestnet = defineChain({\n id: 3799,\n name: 'Tangle Testnet',\n nativeCurrency: { name: 'Tangle', symbol: 'tTNT', decimals: 18 },\n rpcUrls: {\n default: {\n http: ['https://testnet-rpc.tangle.tools'],\n webSocket: ['wss://testnet-rpc.tangle.tools'],\n },\n },\n blockExplorers: { default: { name: 'Tangle Explorer', url: 'https://testnet-explorer.tangle.tools' } },\n contracts: { multicall3: { address: '0xcA11bde05977b3631167028862bE2a173976CA11' } },\n});\n\nexport const tangleMainnet = defineChain({\n id: 5845,\n name: 'Tangle',\n nativeCurrency: { name: 'Tangle', symbol: 'TNT', decimals: 18 },\n rpcUrls: {\n default: {\n http: ['https://rpc.tangle.tools'],\n webSocket: ['wss://rpc.tangle.tools'],\n },\n },\n blockExplorers: { default: { name: 'Tangle Explorer', url: 'https://explorer.tangle.tools' } },\n contracts: { multicall3: { address: '0xcA11bde05977b3631167028862bE2a173976CA11' } },\n});\n\n/** Minimum required contract addresses for Tangle core hooks. */\nexport interface CoreAddresses {\n jobs: Address;\n services: Address;\n [key: string]: Address;\n}\n\nexport interface NetworkConfig<T extends CoreAddresses = CoreAddresses> {\n chain: Chain;\n rpcUrl: string;\n label: string;\n shortLabel: string;\n addresses: T;\n}\n\nlet _networks: Record<number, NetworkConfig<any>> = {};\n\n/** Register networks with app-specific address shapes at startup. */\nexport function configureNetworks<T extends CoreAddresses>(\n nets: Record<number, NetworkConfig<T>>,\n) {\n _networks = nets;\n}\n\nexport function getNetworks<T extends CoreAddresses = CoreAddresses>(): Record<number, NetworkConfig<T>> {\n return _networks as Record<number, NetworkConfig<T>>;\n}\n\nexport { mainnet };\nexport const allTangleChains = [tangleLocal, tangleTestnet, tangleMainnet] as const;\n","type ImportMetaEnvLike = {\n DEV?: boolean;\n VITE_RPC_URL?: string;\n VITE_CHAIN_ID?: string;\n VITE_BLUEPRINT_ID?: string;\n VITE_SERVICE_ID?: string;\n VITE_SERVICE_IDS?: string;\n VITE_OPERATOR_API_URL?: string;\n};\n\nfunction readImportMetaEnv(): ImportMetaEnvLike {\n return ((import.meta as ImportMeta & { env?: ImportMetaEnvLike }).env ?? {});\n}\n\nexport function getEnvVar(key: keyof ImportMetaEnvLike): string | undefined {\n const value = readImportMetaEnv()[key];\n return typeof value === 'string' ? value : undefined;\n}\n\nexport function isDevEnv(): boolean {\n return Boolean(readImportMetaEnv().DEV);\n}\n","import { atom, type WritableAtom } from 'nanostores';\n\n/**\n * JSON serializer that handles bigint values (converts to `{__bigint: \"123\"}`).\n * Needed because TrackedTx.blockNumber and gasUsed are bigints.\n */\nexport function serializeWithBigInt(value: unknown): string {\n return JSON.stringify(value, (_key, v) =>\n typeof v === 'bigint' ? { __bigint: v.toString() } : v,\n );\n}\n\n/** Deserialize JSON produced by `serializeWithBigInt`. */\nexport function deserializeWithBigInt<T>(raw: string): T {\n return JSON.parse(raw, (_key, v) => {\n if (v && typeof v === 'object' && '__bigint' in v && typeof v.__bigint === 'string') {\n return BigInt(v.__bigint);\n }\n return v;\n }) as T;\n}\n\ninterface PersistedAtomOpts<T> {\n /** localStorage key */\n key: string;\n /** Default value when nothing is stored */\n initial: T;\n /** Custom serializer (defaults to JSON.stringify) */\n serialize?: (value: T) => string;\n /** Custom deserializer (defaults to JSON.parse) */\n deserialize?: (raw: string) => T;\n}\n\n/**\n * A nanostores atom backed by localStorage.\n * Restores on init, persists on every `.set()`.\n * SSR-safe: falls back to `initial` when `window` is unavailable.\n */\nexport function persistedAtom<T>(opts: PersistedAtomOpts<T>): WritableAtom<T> {\n const { key, initial, serialize = JSON.stringify, deserialize = JSON.parse } = opts;\n\n let restored = initial;\n if (typeof window !== 'undefined') {\n try {\n const raw = localStorage.getItem(key);\n if (raw !== null) {\n restored = deserialize(raw);\n }\n } catch {\n // corrupt data — use initial\n }\n }\n\n const store = atom<T>(restored);\n\n if (typeof window !== 'undefined') {\n store.subscribe((value: T) => {\n try {\n localStorage.setItem(key, serialize(value));\n } catch {\n // storage full or unavailable — silently ignore\n }\n });\n }\n\n return store;\n}\n","import { computed } from 'nanostores';\nimport { persistedAtom, serializeWithBigInt, deserializeWithBigInt } from './persistedAtom';\n\nexport interface TrackedTx {\n hash: `0x${string}`;\n label: string;\n status: 'pending' | 'confirmed' | 'failed';\n timestamp: number;\n chainId: number;\n blockNumber?: bigint;\n gasUsed?: bigint;\n}\n\nconst MAX_TXS = 50;\n\nexport const txListStore = persistedAtom<TrackedTx[]>({\n key: 'bp_tx_history',\n initial: [],\n serialize: serializeWithBigInt,\n deserialize: deserializeWithBigInt,\n});\n\nexport const pendingCount = computed(txListStore, (txs: TrackedTx[]) =>\n txs.filter((tx: TrackedTx) => tx.status === 'pending').length,\n);\n\nexport function addTx(hash: `0x${string}`, label: string, chainId: number) {\n const existing = txListStore.get();\n if (existing.some((tx) => tx.hash === hash)) return;\n const newTx: TrackedTx = { hash, label, status: 'pending', timestamp: Date.now(), chainId };\n txListStore.set([newTx, ...existing].slice(0, MAX_TXS));\n}\n\nexport function updateTx(\n hash: `0x${string}`,\n update: Partial<Pick<TrackedTx, 'status' | 'blockNumber' | 'gasUsed'>>,\n) {\n txListStore.set(\n txListStore.get().map((tx: TrackedTx) =>\n tx.hash === hash ? { ...tx, ...update } : tx,\n ),\n );\n}\n\nexport function clearTxs() {\n txListStore.set([]);\n}\n","import { persistedAtom } from './persistedAtom';\nimport { getEnvVar } from '../utils/env';\n\nconst defaultBlueprintId = getEnvVar('VITE_BLUEPRINT_ID') ?? '0';\nconst defaultServiceId = getEnvVar('VITE_SERVICE_ID') ?? getEnvVar('VITE_SERVICE_IDS')?.split(',')[0] ?? '0';\n\nexport interface OperatorInfo {\n address: string;\n rpcAddress: string;\n}\n\nexport interface InfraConfig {\n blueprintId: string;\n serviceId: string;\n /** Whether the user has validated the service on-chain */\n serviceValidated: boolean;\n /** Cached service info from last validation */\n serviceInfo?: {\n active: boolean;\n operatorCount: number;\n owner: string;\n blueprintId: string;\n permitted: boolean;\n /** Operators with RPC endpoints (cached for RFQ) */\n operators?: OperatorInfo[];\n };\n}\n\nexport const infraStore = persistedAtom<InfraConfig>({\n key: 'bp_infra',\n initial: {\n blueprintId: defaultBlueprintId,\n serviceId: defaultServiceId,\n serviceValidated: false,\n },\n});\n\nexport function updateInfra(update: Partial<InfraConfig>) {\n infraStore.set({ ...infraStore.get(), ...update });\n}\n\nexport function getInfra(): InfraConfig {\n return infraStore.get();\n}\n","import { atom } from 'nanostores';\n\nexport type Theme = 'dark' | 'light';\n\nexport const kTheme = 'bp_theme';\nexport const DEFAULT_THEME = 'dark';\n\nexport const themeStore = atom<Theme>(initStore());\n\nexport function themeIsDark() {\n return themeStore.get() === 'dark';\n}\n\nfunction initStore() {\n if (typeof window !== 'undefined') {\n const persisted = localStorage.getItem(kTheme) as Theme | undefined;\n const attr = document.querySelector('html')?.getAttribute('data-theme');\n return persisted ?? (attr as Theme) ?? DEFAULT_THEME;\n }\n return DEFAULT_THEME;\n}\n\nexport function toggleTheme() {\n const next = themeStore.get() === 'dark' ? 'light' : 'dark';\n themeStore.set(next);\n localStorage.setItem(kTheme, next);\n document.querySelector('html')?.setAttribute('data-theme', next);\n}\n","/**\n * Tangle core precompile ABIs — shared across all blueprints.\n * Blueprint-specific ABIs (agentSandboxBlueprintAbi, tradingBlueprintAbi, etc.)\n * stay in each consuming app.\n */\n\nexport const tangleJobsAbi = [\n {\n type: 'function',\n name: 'submitJob',\n inputs: [\n { name: 'serviceId', type: 'uint64' },\n { name: 'job', type: 'uint8' },\n { name: 'args', type: 'bytes' },\n ],\n outputs: [{ name: 'callId', type: 'uint64' }],\n stateMutability: 'payable',\n },\n {\n type: 'event',\n name: 'JobCalled',\n inputs: [\n { name: 'serviceId', type: 'uint64', indexed: true },\n { name: 'job', type: 'uint8', indexed: true },\n { name: 'callId', type: 'uint64', indexed: true },\n { name: 'caller', type: 'address', indexed: false },\n { name: 'args', type: 'bytes', indexed: false },\n ],\n },\n {\n type: 'event',\n name: 'JobResultReceived',\n inputs: [\n { name: 'serviceId', type: 'uint64', indexed: true },\n { name: 'job', type: 'uint8', indexed: true },\n { name: 'callId', type: 'uint64', indexed: true },\n { name: 'operator', type: 'address', indexed: false },\n { name: 'outputs', type: 'bytes', indexed: false },\n ],\n },\n {\n type: 'event',\n name: 'JobSubmitted',\n inputs: [\n { name: 'serviceId', type: 'uint64', indexed: true },\n { name: 'callId', type: 'uint64', indexed: true },\n { name: 'jobIndex', type: 'uint8', indexed: false },\n { name: 'caller', type: 'address', indexed: false },\n { name: 'inputs', type: 'bytes', indexed: false },\n ],\n },\n {\n type: 'event',\n name: 'JobCompleted',\n inputs: [\n { name: 'serviceId', type: 'uint64', indexed: true },\n { name: 'callId', type: 'uint64', indexed: true },\n ],\n },\n {\n type: 'event',\n name: 'JobResultSubmitted',\n inputs: [\n { name: 'serviceId', type: 'uint64', indexed: true },\n { name: 'callId', type: 'uint64', indexed: true },\n { name: 'operator', type: 'address', indexed: true },\n { name: 'output', type: 'bytes', indexed: false },\n ],\n },\n] as const;\n\nexport const tangleServicesAbi = [\n {\n type: 'function',\n name: 'requestService',\n inputs: [\n { name: 'blueprintId', type: 'uint64' },\n { name: 'operators', type: 'address[]' },\n { name: 'config', type: 'bytes' },\n { name: 'permittedCallers', type: 'address[]' },\n { name: 'ttl', type: 'uint64' },\n { name: 'paymentToken', type: 'address' },\n { name: 'paymentAmount', type: 'uint256' },\n ],\n outputs: [{ name: 'requestId', type: 'uint64' }],\n stateMutability: 'payable',\n },\n {\n type: 'function',\n name: 'createServiceFromQuotes',\n inputs: [\n { name: 'blueprintId', type: 'uint64' },\n {\n name: 'quotes',\n type: 'tuple[]',\n components: [\n {\n name: 'details',\n type: 'tuple',\n components: [\n { name: 'blueprintId', type: 'uint64' },\n { name: 'ttlBlocks', type: 'uint64' },\n { name: 'totalCost', type: 'uint256' },\n { name: 'timestamp', type: 'uint64' },\n { name: 'expiry', type: 'uint64' },\n { name: 'confidentiality', type: 'uint8' },\n {\n name: 'securityCommitments',\n type: 'tuple[]',\n components: [\n {\n name: 'asset',\n type: 'tuple',\n components: [\n { name: 'kind', type: 'uint8' },\n { name: 'token', type: 'address' },\n ],\n },\n { name: 'exposureBps', type: 'uint16' },\n ],\n },\n {\n name: 'resourceCommitments',\n type: 'tuple[]',\n components: [\n { name: 'kind', type: 'uint8' },\n { name: 'count', type: 'uint64' },\n ],\n },\n ],\n },\n { name: 'signature', type: 'bytes' },\n { name: 'operator', type: 'address' },\n ],\n },\n { name: 'config', type: 'bytes' },\n { name: 'permittedCallers', type: 'address[]' },\n { name: 'ttl', type: 'uint64' },\n ],\n outputs: [{ name: 'serviceId', type: 'uint64' }],\n stateMutability: 'payable',\n },\n {\n type: 'function',\n name: 'getService',\n inputs: [{ name: 'serviceId', type: 'uint64' }],\n outputs: [\n {\n name: '',\n type: 'tuple',\n components: [\n { name: 'blueprintId', type: 'uint64' },\n { name: 'owner', type: 'address' },\n { name: 'createdAt', type: 'uint64' },\n { name: 'ttl', type: 'uint64' },\n { name: 'terminatedAt', type: 'uint64' },\n { name: 'lastPaymentAt', type: 'uint64' },\n { name: 'operatorCount', type: 'uint32' },\n { name: 'minOperators', type: 'uint32' },\n { name: 'maxOperators', type: 'uint32' },\n { name: 'membership', type: 'uint8' },\n { name: 'pricing', type: 'uint8' },\n { name: 'status', type: 'uint8' },\n ],\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'isServiceActive',\n inputs: [{ name: 'serviceId', type: 'uint64' }],\n outputs: [{ name: '', type: 'bool' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'getServiceOperators',\n inputs: [{ name: 'serviceId', type: 'uint64' }],\n outputs: [{ name: '', type: 'address[]' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'isPermittedCaller',\n inputs: [\n { name: 'serviceId', type: 'uint64' },\n { name: 'caller', type: 'address' },\n ],\n outputs: [{ name: '', type: 'bool' }],\n stateMutability: 'view',\n },\n {\n type: 'event',\n name: 'ServiceRequested',\n inputs: [\n { name: 'requestId', type: 'uint64', indexed: true },\n { name: 'blueprintId', type: 'uint64', indexed: true },\n { name: 'requester', type: 'address', indexed: true },\n ],\n },\n {\n type: 'event',\n name: 'ServiceActivated',\n inputs: [\n { name: 'serviceId', type: 'uint64', indexed: true },\n { name: 'requestId', type: 'uint64', indexed: true },\n { name: 'blueprintId', type: 'uint64', indexed: true },\n ],\n },\n] as const;\n\nexport const tangleOperatorsAbi = [\n {\n type: 'function',\n name: 'blueprintOperatorCount',\n inputs: [{ name: 'blueprintId', type: 'uint64' }],\n outputs: [{ name: '', type: 'uint256' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'isOperatorRegistered',\n inputs: [\n { name: 'blueprintId', type: 'uint64' },\n { name: 'operator', type: 'address' },\n ],\n outputs: [{ name: '', type: 'bool' }],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'getOperatorPreferences',\n inputs: [\n { name: 'blueprintId', type: 'uint64' },\n { name: 'operator', type: 'address' },\n ],\n outputs: [\n {\n name: 'preferences',\n type: 'tuple',\n components: [\n { name: 'ecdsaPublicKey', type: 'bytes' },\n { name: 'rpcAddress', type: 'string' },\n ],\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'event',\n name: 'OperatorRegistered',\n inputs: [\n { name: 'blueprintId', type: 'uint64', indexed: true },\n { name: 'operator', type: 'address', indexed: true },\n { name: 'ecdsaPublicKey', type: 'bytes', indexed: false },\n { name: 'rpcAddress', type: 'string', indexed: false },\n ],\n },\n {\n type: 'event',\n name: 'OperatorUnregistered',\n inputs: [\n { name: 'blueprintId', type: 'uint64', indexed: true },\n { name: 'operator', type: 'address', indexed: true },\n ],\n },\n] as const;\n","import { createPublicClient, http } from 'viem';\nimport type { PublicClient } from 'viem';\nimport { atom } from 'nanostores';\nimport { getNetworks, tangleLocal, type CoreAddresses } from './chains';\nimport { persistedAtom } from '../stores/persistedAtom';\nimport { getEnvVar } from '../utils/env';\n\nconst defaultChainId = Number(getEnvVar('VITE_CHAIN_ID') ?? tangleLocal.id);\n\nexport const selectedChainIdStore = persistedAtom<number>({\n key: 'bp_selected_chain',\n initial: defaultChainId,\n});\n\nconst clientCache = new Map<number, PublicClient>();\n\nfunction configuredDefaultChainId(): number {\n const networks = getNetworks();\n if (networks[defaultChainId]) return defaultChainId;\n\n for (const [chainId, net] of Object.entries(networks)) {\n if (\n net?.shortLabel === 'Local' ||\n net?.label === 'Tangle Local' ||\n net?.chain?.name === 'Tangle Local'\n ) {\n return Number(chainId);\n }\n }\n\n const [firstConfigured] = Object.keys(networks);\n return firstConfigured ? Number(firstConfigured) : defaultChainId;\n}\n\nfunction normalizeSelectedChainId(chainId: number): number {\n const networks = getNetworks();\n if (!Object.keys(networks).length) return chainId;\n return networks[chainId] ? chainId : configuredDefaultChainId();\n}\n\nexport function sanitizeSelectedChainId(): number {\n const normalized = normalizeSelectedChainId(selectedChainIdStore.get());\n if (normalized !== selectedChainIdStore.get()) {\n selectedChainIdStore.set(normalized);\n }\n return normalized;\n}\n\nfunction getOrCreateClient(chainId: number): PublicClient {\n const normalizedChainId = normalizeSelectedChainId(chainId);\n\n const cached = clientCache.get(normalizedChainId);\n if (cached) return cached;\n const networks = getNetworks();\n const net = networks[normalizedChainId];\n if (!net) {\n const fallback = networks[configuredDefaultChainId()];\n if (!fallback) {\n return createPublicClient({ chain: tangleLocal, transport: http() });\n }\n return createPublicClient({ chain: fallback.chain, transport: http(fallback.rpcUrl) });\n }\n const client = createPublicClient({ chain: net.chain, transport: http(net.rpcUrl) });\n clientCache.set(normalizedChainId, client);\n return client;\n}\n\nexport const publicClientStore = atom<PublicClient>(getOrCreateClient(sanitizeSelectedChainId()));\n\nselectedChainIdStore.subscribe((chainId: number) => {\n const normalized = normalizeSelectedChainId(chainId);\n if (normalized !== chainId) {\n selectedChainIdStore.set(normalized);\n return;\n }\n publicClientStore.set(getOrCreateClient(normalized));\n});\n\nexport function getPublicClient(): PublicClient {\n sanitizeSelectedChainId();\n return publicClientStore.get();\n}\n\nexport const publicClient = new Proxy({} as PublicClient, {\n get(_target, prop) {\n const client = getOrCreateClient(sanitizeSelectedChainId());\n const value = (client as any)[prop];\n return typeof value === 'function' ? value.bind(client) : value;\n },\n});\n\nexport function getAddresses<T extends CoreAddresses = CoreAddresses>(): T {\n const networks = getNetworks<T>();\n const selectedChainId = sanitizeSelectedChainId();\n const net = networks[selectedChainId];\n return net?.addresses ?? networks[configuredDefaultChainId()]?.addresses ?? {} as T;\n}\n","import { encodeAbiParameters } from 'viem';\nimport type { JobDefinition } from '../blueprints/registry';\n\n/**\n * Generic ABI encoder for any blueprint job.\n *\n * Builds the ordered parameter array from:\n * 1. contextParams (e.g. sidecar_url, sandbox_id) — prepended first\n * 2. fields with abiType set — appended in definition order\n *\n * Delegates to job.customEncoder when present (for nested-struct jobs like batch_create).\n */\nexport function encodeJobArgs(\n job: JobDefinition,\n formValues: Record<string, unknown>,\n context?: Record<string, unknown>,\n): `0x${string}` {\n if (job.customEncoder) {\n return job.customEncoder(formValues, context);\n }\n\n const abiDefs: { name: string; type: string }[] = [];\n const values: unknown[] = [];\n\n // Context params first (sidecar_url, sandbox_id, etc.)\n if (job.contextParams) {\n for (const cp of job.contextParams) {\n abiDefs.push({ name: cp.abiName, type: cp.abiType });\n values.push(coerceValue(context?.[cp.abiName], cp.abiType));\n }\n }\n\n // Form fields with ABI metadata\n for (const field of job.fields) {\n if (!field.abiType) continue;\n abiDefs.push({ name: field.abiParam ?? field.name, type: field.abiType });\n values.push(coerceValue(formValues[field.name], field.abiType));\n }\n\n return encodeAbiParameters(abiDefs, values);\n}\n\nfunction coerceValue(value: unknown, abiType: string): unknown {\n switch (abiType) {\n case 'bool':\n return Boolean(value);\n case 'uint8':\n case 'uint16':\n case 'uint32':\n return Number(value) || 0;\n case 'uint64':\n case 'uint128':\n case 'uint256':\n return BigInt(Number(value) || 0);\n case 'string':\n return String(value ?? '');\n case 'string[]':\n if (Array.isArray(value)) return value.map(String);\n return String(value ?? '').split('\\n').filter(Boolean);\n case 'address[]':\n if (Array.isArray(value)) return value;\n return String(value ?? '')\n .split('\\n')\n .map((s) => s.trim())\n .filter((s) => /^0x[a-fA-F0-9]{40}$/.test(s));\n default:\n return value;\n }\n}\n","import { useState, useCallback, useEffect, useMemo } from 'react';\nimport type { JobDefinition } from '../blueprints/registry';\n\nexport interface JobFormState {\n values: Record<string, unknown>;\n errors: Record<string, string>;\n onChange: (name: string, value: unknown) => void;\n validate: () => boolean;\n reset: () => void;\n}\n\nfunction buildDefaults(job: JobDefinition): Record<string, unknown> {\n const init: Record<string, unknown> = {};\n for (const f of job.fields) {\n if (f.internal) continue;\n if (f.defaultValue !== undefined) {\n init[f.name] = f.defaultValue;\n } else if (f.type === 'boolean') {\n init[f.name] = false;\n } else if (f.type === 'number') {\n init[f.name] = f.min ?? 0;\n } else {\n init[f.name] = '';\n }\n }\n return init;\n}\n\nexport function useJobForm(job: JobDefinition | null): JobFormState {\n const defaults = useMemo(() => (job ? buildDefaults(job) : {}), [job]);\n const [values, setValues] = useState<Record<string, unknown>>(defaults);\n const [errors, setErrors] = useState<Record<string, string>>({});\n\n // Sync form values when job changes (e.g. blueprint selection or async load)\n useEffect(() => {\n setValues(defaults);\n setErrors({});\n }, [defaults]);\n\n const onChange = useCallback((name: string, value: unknown) => {\n setValues((prev) => ({ ...prev, [name]: value }));\n setErrors((prev) => {\n if (!prev[name]) return prev;\n const next = { ...prev };\n delete next[name];\n return next;\n });\n }, []);\n\n const validate = useCallback((): boolean => {\n if (!job) return false;\n const errs: Record<string, string> = {};\n for (const f of job.fields) {\n if (f.internal) continue;\n const v = values[f.name];\n if (f.required && (v === undefined || v === null || v === '')) {\n errs[f.name] = `${f.label} is required`;\n continue;\n }\n if (f.type === 'number' && typeof v === 'number') {\n if (f.min != null && v < f.min) {\n errs[f.name] = `${f.label} must be at least ${f.min}`;\n } else if (f.max != null && v > f.max) {\n errs[f.name] = `${f.label} must be at most ${f.max}`;\n }\n }\n }\n setErrors(errs);\n return Object.keys(errs).length === 0;\n }, [job, values]);\n\n const reset = useCallback(() => {\n setValues(defaults);\n setErrors({});\n }, [defaults]);\n\n return { values, errors, onChange, validate, reset };\n}\n","import { useState, useEffect, useCallback } from 'react';\nimport type { Address } from 'viem';\nimport { sha256 as viemSha256, toHex } from 'viem';\nimport type { DiscoveredOperator } from './useOperators';\nimport { resolveOperatorRpc } from '../utils/resolveOperatorRpc';\n\n/**\n * RFQ (Request for Quote) hook — fetches pricing quotes from operators.\n *\n * Implements the Tangle pricing protocol:\n * 1. Solve PoW challenge (SHA256 with 20-bit difficulty)\n * 2. Send gRPC GetPrice request to each operator's registered RPC\n * 3. Collect signed QuoteDetails for createServiceFromQuotes()\n *\n * When operators don't have a pricing engine (no rpcAddress), falls back to\n * multiplier-based estimation from the on-chain getDefaultJobRates().\n */\n\n// ── Types ──\n\ntype SecurityCommitment = {\n asset: { kind: number; token: Address };\n exposureBps: number;\n};\n\ntype ResourceCommitment = {\n kind: number;\n count: bigint;\n};\n\nexport interface OperatorQuote {\n operator: Address;\n totalCost: bigint;\n signature: `0x${string}`;\n details: {\n blueprintId: bigint;\n ttlBlocks: bigint;\n totalCost: bigint;\n timestamp: bigint;\n expiry: bigint;\n confidentiality: number;\n securityCommitments: readonly SecurityCommitment[];\n resourceCommitments: readonly ResourceCommitment[];\n };\n costRate: number;\n teeAttested?: boolean;\n teeProvider?: string;\n}\n\nexport interface UseQuotesResult {\n quotes: OperatorQuote[];\n isLoading: boolean;\n isSolvingPow: boolean;\n errors: Map<Address, string>;\n totalCost: bigint;\n refetch: () => void;\n}\n\n// ── PoW solver (mirrors Tangle pricing-engine/src/pow.rs) ──\n\nconst POW_DIFFICULTY = 20;\nconst WEI_PER_TNT = 1_000_000_000_000_000_000; // 10^18\nconst RESOURCE_KIND_TO_ID = {\n CPU: 0,\n MemoryMB: 1,\n StorageMB: 2,\n NetworkEgressMB: 3,\n NetworkIngressMB: 4,\n GPU: 5,\n} as const;\nconst ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' as Address;\nconst DEFAULT_RESOURCE_REQUIREMENTS = [\n { kind: 'CPU', count: 1 },\n { kind: 'MemoryMB', count: 1024 },\n { kind: 'StorageMB', count: 10240 },\n] as const;\n\nfunction sha256(data: Uint8Array): Uint8Array {\n return viemSha256(data, 'bytes');\n}\n\nfunction generateChallenge(blueprintId: bigint, timestamp: bigint): Uint8Array {\n const input = new Uint8Array(16);\n const view = new DataView(input.buffer);\n view.setBigUint64(0, blueprintId, false);\n view.setBigUint64(8, timestamp, false);\n return sha256(input);\n}\n\nfunction checkDifficulty(hash: Uint8Array, difficulty: number): boolean {\n const zeroBytes = Math.floor(difficulty / 8);\n const zeroBits = difficulty % 8;\n for (let i = 0; i < zeroBytes; i++) {\n if (hash[i] !== 0) return false;\n }\n if (zeroBits > 0) {\n const mask = 0xff << (8 - zeroBits);\n if ((hash[zeroBytes] & mask) !== 0) return false;\n }\n return true;\n}\n\nexport async function solvePoW(\n blueprintId: bigint,\n timestamp: bigint,\n): Promise<{ hash: Uint8Array; nonce: number; proof: Uint8Array }> {\n const challenge = generateChallenge(blueprintId, timestamp);\n const buf = new Uint8Array(challenge.length + 8);\n buf.set(challenge, 0);\n const view = new DataView(buf.buffer);\n\n for (let nonce = 0; nonce < 0x1_0000_0000; nonce++) {\n view.setBigUint64(challenge.length, BigInt(nonce), false);\n const hash = sha256(buf);\n if (checkDifficulty(hash, POW_DIFFICULTY)) {\n // Bincode-serialize Proof { hash: Vec<u8>, nonce: u64 }\n const proof = new Uint8Array(8 + 32 + 8);\n const pv = new DataView(proof.buffer);\n pv.setBigUint64(0, 32n, true);\n proof.set(hash, 8);\n pv.setBigUint64(40, BigInt(nonce), true);\n return { hash, nonce, proof };\n }\n // Yield to browser every 5000 iterations\n if (nonce % 5000 === 0 && nonce > 0) {\n await new Promise((r) => setTimeout(r, 0));\n }\n }\n throw new Error('PoW: exhausted nonce space');\n}\n\nexport function formatCost(totalCost: bigint): string {\n // totalCost is in wei (1e18 wei = 1 TNT)\n const tnt = Number(totalCost) / WEI_PER_TNT;\n if (tnt === 0) return '0 TNT';\n if (tnt < 0.001) return `${(tnt * 1_000_000).toFixed(2)} \\u03bcTNT`;\n if (tnt < 0.01) return `${(tnt * 1000).toFixed(2)} mTNT`;\n if (tnt < 1000) return `${tnt.toFixed(4)} TNT`;\n return `${tnt.toLocaleString(undefined, { maximumFractionDigits: 2 })} TNT`;\n}\n\nfunction quoteConfidentiality(requireTee: boolean): number {\n return requireTee ? 1 : 0;\n}\n\nfunction resourceKindToId(kind: string): number {\n const mapped = RESOURCE_KIND_TO_ID[kind as keyof typeof RESOURCE_KIND_TO_ID];\n if (mapped === undefined) {\n throw new Error(`Unsupported resource kind in quote: ${kind}`);\n }\n return mapped;\n}\n\nfunction mapJsonSecurityCommitment(sc: any): SecurityCommitment {\n return {\n asset: {\n kind: sc.asset?.kind ?? 0,\n token: (sc.asset?.token ?? ZERO_ADDRESS) as Address,\n },\n exposureBps: sc.exposure_bps ?? 0,\n };\n}\n\nfunction mapJsonResourceCommitment(resource: any): ResourceCommitment {\n return {\n kind: resourceKindToId(String(resource.kind ?? 'CPU')),\n count: BigInt(resource.count ?? 0),\n };\n}\n\n// ── Hook ──\n\nexport function useQuotes(\n operators: DiscoveredOperator[],\n blueprintId: bigint,\n ttlBlocks: bigint,\n enabled: boolean,\n requireTee = false,\n): UseQuotesResult {\n const [quotes, setQuotes] = useState<OperatorQuote[]>([]);\n const [isLoading, setIsLoading] = useState(false);\n const [isSolvingPow, setIsSolvingPow] = useState(false);\n const [errors, setErrors] = useState<Map<Address, string>>(new Map());\n const [fetchKey, setFetchKey] = useState(0);\n\n const refetch = useCallback(() => setFetchKey((k) => k + 1), []);\n\n useEffect(() => {\n if (!enabled || operators.length === 0) {\n // Only set state if it's actually non-empty to avoid triggering re-renders\n setQuotes((prev) => (prev.length === 0 ? prev : []));\n setErrors((prev) => (prev.size === 0 ? prev : new Map()));\n return;\n }\n\n let cancelled = false;\n setIsLoading(true);\n setIsSolvingPow(true);\n setQuotes([]);\n setErrors(new Map());\n\n async function fetchQuotes() {\n const results: OperatorQuote[] = [];\n const errs = new Map<Address, string>();\n\n const promises = operators.map(async (op) => {\n try {\n if (!op.rpcAddress) throw new Error('No RPC address registered');\n\n const rpcUrl = resolveOperatorRpc(op.rpcAddress);\n const timestamp = BigInt(Math.floor(Date.now() / 1000));\n\n // Solve PoW challenge\n if (!cancelled) setIsSolvingPow(true);\n const { proof } = await solvePoW(blueprintId, timestamp);\n if (!cancelled) setIsSolvingPow(false);\n\n // Try gRPC GetPrice endpoint\n // Since we may not have the generated protobuf types, try a JSON/REST\n // fallback first, then gRPC if available\n const response = await fetchPriceFromOperator(rpcUrl, {\n blueprintId,\n ttlBlocks,\n proofOfWork: proof,\n challengeTimestamp: timestamp,\n requireTee,\n });\n\n if (!response) throw new Error('No quote returned from operator');\n\n if (!cancelled) results.push(response);\n } catch (err) {\n if (!cancelled) {\n errs.set(op.address, err instanceof Error ? err.message : String(err));\n }\n }\n });\n\n await Promise.allSettled(promises);\n\n if (!cancelled) {\n setQuotes(results);\n setErrors(errs);\n setIsLoading(false);\n setIsSolvingPow(false);\n }\n }\n\n fetchQuotes();\n return () => {\n cancelled = true;\n };\n }, [operators, blueprintId, ttlBlocks, enabled, fetchKey, requireTee]);\n\n const totalCost = quotes.reduce((sum, q) => sum + q.totalCost, 0n);\n\n return { quotes, isLoading, isSolvingPow, errors, totalCost, refetch };\n}\n\n/**\n * Attempt to fetch a price from an operator's RPC endpoint.\n * Tries a JSON endpoint first (/pricing/quote), which operators may optionally expose.\n * Returns null if the operator doesn't support pricing.\n */\nasync function fetchPriceFromOperator(\n rpcUrl: string,\n params: {\n blueprintId: bigint;\n ttlBlocks: bigint;\n proofOfWork: Uint8Array;\n challengeTimestamp: bigint;\n requireTee: boolean;\n },\n): Promise<OperatorQuote | null> {\n // Try JSON endpoint (simpler, no protobuf dependency required)\n try {\n const response = await fetch(`${rpcUrl}/pricing/quote`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n blueprint_id: String(params.blueprintId),\n ttl_blocks: String(params.ttlBlocks),\n proof_of_work: toHex(params.proofOfWork),\n challenge_timestamp: String(params.challengeTimestamp),\n require_tee: params.requireTee,\n resource_requirements: DEFAULT_RESOURCE_REQUIREMENTS,\n }),\n signal: AbortSignal.timeout(10_000),\n });\n\n if (!response.ok) throw new Error(`HTTP ${response.status}`);\n const data = await response.json();\n\n return {\n operator: data.operator as Address,\n totalCost: BigInt(data.total_cost ?? '0'),\n signature: (data.signature ?? '0x') as `0x${string}`,\n costRate: Number(data.cost_rate ?? 0),\n teeAttested: Boolean(data.tee_attested),\n teeProvider: data.tee_provider || undefined,\n details: {\n blueprintId: BigInt(data.details?.blueprint_id ?? params.blueprintId),\n ttlBlocks: BigInt(data.details?.ttl_blocks ?? params.ttlBlocks),\n totalCost: BigInt(data.details?.total_cost ?? '0'),\n timestamp: BigInt(data.details?.timestamp ?? params.challengeTimestamp),\n expiry: BigInt(data.details?.expiry ?? '0'),\n confidentiality: Number(data.details?.confidentiality ?? quoteConfidentiality(params.requireTee)),\n securityCommitments: (data.details?.security_commitments ?? []).map(mapJsonSecurityCommitment),\n resourceCommitments: (data.details?.resources ?? []).map(mapJsonResourceCommitment),\n },\n };\n } catch {\n // JSON endpoint not available — operator doesn't have pricing engine\n return null;\n }\n}\n","import { useState, useEffect, useCallback, useRef } from 'react';\nimport type { Address } from 'viem';\nimport { toHex } from 'viem';\nimport { solvePoW, formatCost } from './useQuotes';\n\n/**\n * Per-job RFQ hook — fetches price quotes for a specific job before submission.\n *\n * Implements the GetJobPrice protocol:\n * 1. Solve PoW challenge (same as service-level RFQ)\n * 2. POST to operator's /pricing/job-quote endpoint\n * 3. Return signed JobQuoteDetails for submitJobFromQuote()\n *\n * This is the per-job counterpart to useQuotes (which handles service creation).\n * Together they provide full RFQ coverage for the UI.\n */\n\n// ── Types ──\n\nexport interface JobQuote {\n serviceId: bigint;\n jobIndex: number;\n price: bigint;\n timestamp: bigint;\n expiry: bigint;\n signature: `0x${string}`;\n operatorAddress: Address;\n}\n\nexport interface UseJobPriceResult {\n quote: JobQuote | null;\n isLoading: boolean;\n isSolvingPow: boolean;\n error: string | null;\n formattedPrice: string;\n refetch: () => void;\n}\n\n/** Rewrite operator RPC hostname for browser reachability */\nfunction resolveOperatorRpc(raw: string): string {\n if (typeof window === 'undefined') return raw;\n const withProto = raw.includes('://') ? raw : `http://${raw}`;\n try {\n const url = new URL(withProto);\n const pageHost = window.location.hostname;\n const isNonRoutable =\n url.hostname.endsWith('.local') ||\n !url.hostname.includes('.') ||\n url.hostname === '127.0.0.1' ||\n url.hostname === 'localhost';\n if (isNonRoutable && pageHost !== url.hostname) {\n url.hostname = pageHost;\n }\n return url.toString().replace(/\\/$/, '');\n } catch {\n return withProto;\n }\n}\n\n// ── Hook ──\n\nexport function useJobPrice(\n operatorRpcUrl: string | undefined,\n serviceId: bigint,\n jobIndex: number,\n blueprintId: bigint,\n enabled: boolean,\n): UseJobPriceResult {\n const [quote, setQuote] = useState<JobQuote | null>(null);\n const [isLoading, setIsLoading] = useState(false);\n const [isSolvingPow, setIsSolvingPow] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [fetchKey, setFetchKey] = useState(0);\n const cancelledRef = useRef(false);\n\n const refetch = useCallback(() => setFetchKey((k) => k + 1), []);\n\n useEffect(() => {\n if (!enabled || !operatorRpcUrl || serviceId === 0n) {\n setQuote(null);\n setError(null);\n return;\n }\n\n cancelledRef.current = false;\n setIsLoading(true);\n setError(null);\n setQuote(null);\n\n async function fetchJobQuote() {\n try {\n const rpcUrl = resolveOperatorRpc(operatorRpcUrl!);\n const timestamp = BigInt(Math.floor(Date.now() / 1000));\n\n // Solve PoW\n setIsSolvingPow(true);\n const { proof } = await solvePoW(blueprintId, timestamp);\n if (cancelledRef.current) return;\n setIsSolvingPow(false);\n\n // Fetch job price from operator\n const response = await fetch(`${rpcUrl}/pricing/job-quote`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n service_id: String(serviceId),\n job_index: jobIndex,\n proof_of_work: toHex(proof),\n challenge_timestamp: String(timestamp),\n }),\n signal: AbortSignal.timeout(10_000),\n });\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${await response.text().catch(() => 'Unknown error')}`);\n }\n\n const data = await response.json();\n if (cancelledRef.current) return;\n\n setQuote({\n serviceId: BigInt(data.service_id ?? serviceId),\n jobIndex: data.job_index ?? jobIndex,\n price: BigInt(data.price ?? '0'),\n timestamp: BigInt(data.timestamp ?? timestamp),\n expiry: BigInt(data.expiry ?? '0'),\n signature: (data.signature ?? '0x') as `0x${string}`,\n operatorAddress: data.operator as Address,\n });\n } catch (err) {\n if (!cancelledRef.current) {\n setError(err instanceof Error ? err.message : String(err));\n }\n } finally {\n if (!cancelledRef.current) {\n setIsLoading(false);\n setIsSolvingPow(false);\n }\n }\n }\n\n fetchJobQuote();\n return () => {\n cancelledRef.current = true;\n };\n }, [operatorRpcUrl, serviceId, jobIndex, blueprintId, enabled, fetchKey]);\n\n const formattedPrice = quote ? formatCost(quote.price) : '--';\n\n return { quote, isLoading, isSolvingPow, error, formattedPrice, refetch };\n}\n\n/**\n * Batch version — fetches job prices for multiple jobs at once.\n * Used by the blueprint job list to show all prices simultaneously.\n */\nexport interface JobPriceEntry {\n jobIndex: number;\n jobName: string;\n price: bigint;\n formattedPrice: string;\n mode: 'flat' | 'dynamic' | 'free';\n quote: JobQuote | null;\n error: string | null;\n}\n\nexport interface UseJobPricesResult {\n prices: JobPriceEntry[];\n isLoading: boolean;\n error: string | null;\n refetch: () => void;\n}\n\nexport function useJobPrices(\n operatorRpcUrl: string | undefined,\n serviceId: bigint,\n blueprintId: bigint,\n jobIndexes: { index: number; name: string; multiplier: number }[],\n enabled: boolean,\n): UseJobPricesResult {\n const [prices, setPrices] = useState<JobPriceEntry[]>([]);\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [fetchKey, setFetchKey] = useState(0);\n\n const refetch = useCallback(() => setFetchKey((k) => k + 1), []);\n\n useEffect(() => {\n if (!enabled || !operatorRpcUrl || serviceId === 0n || jobIndexes.length === 0) {\n setPrices([]);\n setError(null);\n return;\n }\n\n let cancelled = false;\n setIsLoading(true);\n setError(null);\n\n async function fetchAllPrices() {\n try {\n const rpcUrl = resolveOperatorRpc(operatorRpcUrl!);\n const timestamp = BigInt(Math.floor(Date.now() / 1000));\n const { proof } = await solvePoW(blueprintId, timestamp);\n if (cancelled) return;\n\n // Fetch all job prices in parallel\n const results = await Promise.allSettled(\n jobIndexes.map(async (job) => {\n const response = await fetch(`${rpcUrl}/pricing/job-quote`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n service_id: String(serviceId),\n job_index: job.index,\n proof_of_work: toHex(proof),\n challenge_timestamp: String(timestamp),\n }),\n signal: AbortSignal.timeout(10_000),\n });\n\n if (!response.ok) return null;\n return response.json();\n }),\n );\n\n if (cancelled) return;\n\n const entries: JobPriceEntry[] = jobIndexes.map((job, i) => {\n const result = results[i];\n if (result.status === 'fulfilled' && result.value) {\n const data = result.value;\n const price = BigInt(data.price ?? '0');\n return {\n jobIndex: job.index,\n jobName: job.name,\n price,\n formattedPrice: formatCost(price),\n mode: (data.mode ?? 'flat') as 'flat' | 'dynamic' | 'free',\n quote: {\n serviceId: BigInt(data.service_id ?? serviceId),\n jobIndex: job.index,\n price,\n timestamp: BigInt(data.timestamp ?? timestamp),\n expiry: BigInt(data.expiry ?? '0'),\n signature: (data.signature ?? '0x') as `0x${string}`,\n operatorAddress: data.operator as Address,\n },\n error: null,\n };\n }\n // Fallback: estimate from multiplier (base rate = 0.001 TNT = 1e15 wei)\n const estimatedPrice = BigInt(job.multiplier) * 1_000_000_000_000_000n;\n return {\n jobIndex: job.index,\n jobName: job.name,\n price: estimatedPrice,\n formattedPrice: `~${formatCost(estimatedPrice)}`,\n mode: 'flat' as const,\n quote: null,\n error: 'No RFQ response — showing estimate',\n };\n });\n\n setPrices(entries);\n } catch (err) {\n if (!cancelled) {\n setError(err instanceof Error ? err.message : String(err));\n }\n } finally {\n if (!cancelled) {\n setIsLoading(false);\n }\n }\n }\n\n fetchAllPrices();\n return () => {\n cancelled = true;\n };\n }, [operatorRpcUrl, serviceId, blueprintId, jobIndexes, enabled, fetchKey]);\n\n return { prices, isLoading, error, refetch };\n}\n","import { useCallback, useState, useMemo } from 'react';\nimport { useAccount, useWriteContract, useWaitForTransactionReceipt } from 'wagmi';\nimport { decodeEventLog } from 'viem';\nimport { tangleJobsAbi } from '../contracts/abi';\nimport { getAddresses } from '../contracts/publicClient';\nimport { addTx, updateTx } from '../stores/txHistory';\nimport { selectedChainIdStore } from '../contracts/publicClient';\nimport { useEffect } from 'react';\n\nexport interface SubmitJobOpts {\n serviceId: bigint;\n jobId: number;\n args: `0x${string}`;\n label?: string;\n value?: bigint;\n}\n\nexport type JobSubmitStatus = 'idle' | 'signing' | 'pending' | 'confirmed' | 'failed';\n\nexport function useSubmitJob() {\n const { address } = useAccount();\n const { writeContractAsync, data: hash, isPending: isSigning } = useWriteContract();\n const [status, setStatus] = useState<JobSubmitStatus>('idle');\n const [error, setError] = useState<string | null>(null);\n const [txHash, setTxHash] = useState<`0x${string}` | undefined>();\n\n const { data: receipt, isSuccess, isError } = useWaitForTransactionReceipt({\n hash: txHash,\n });\n\n // Extract callId from the JobCalled event in the receipt logs\n const callId = useMemo<number | null>(() => {\n if (!receipt?.logs) return null;\n for (const log of receipt.logs) {\n try {\n const decoded = decodeEventLog({\n abi: tangleJobsAbi,\n data: log.data,\n topics: log.topics,\n });\n if (decoded.eventName === 'JobCalled' && 'callId' in decoded.args) {\n return Number(decoded.args.callId);\n }\n } catch {\n // Not a matching event, skip\n }\n }\n return null;\n }, [receipt]);\n\n useEffect(() => {\n if (isSuccess && txHash) {\n setStatus('confirmed');\n updateTx(txHash, { status: 'confirmed' });\n }\n if (isError && txHash) {\n setStatus('failed');\n updateTx(txHash, { status: 'failed' });\n }\n }, [isSuccess, isError, txHash]);\n\n const submitJob = useCallback(\n async (opts: SubmitJobOpts) => {\n if (!address) {\n setError('Wallet not connected');\n return undefined;\n }\n\n const addrs = getAddresses();\n const label = opts.label ?? `Job #${opts.jobId}`;\n\n try {\n setStatus('signing');\n setError(null);\n\n const result = await writeContractAsync({\n address: addrs.jobs,\n abi: tangleJobsAbi,\n functionName: 'submitJob',\n args: [opts.serviceId, opts.jobId, opts.args],\n value: opts.value,\n });\n\n setTxHash(result);\n setStatus('pending');\n addTx(result, label, selectedChainIdStore.get());\n\n return result;\n } catch (err: any) {\n setStatus('failed');\n const msg = err?.shortMessage ?? err?.message ?? 'Transaction failed';\n setError(msg);\n return undefined;\n }\n },\n [address, writeContractAsync],\n );\n\n const reset = useCallback(() => {\n setStatus('idle');\n setError(null);\n setTxHash(undefined);\n }, []);\n\n return {\n submitJob,\n reset,\n status,\n error,\n txHash,\n callId,\n isSigning,\n isConnected: !!address,\n };\n}\n","import { useStore } from '@nanostores/react';\nimport { themeStore, type Theme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S,MAAM,mBAAmB;AAAA,UACtC,SAAS,MAAM;AAAA,UACf,KAAK;AAAA,UACL,cAAc;AAAA,UACd,MAAM,CAAC,KAAK,WAAW,KAAK,OAAO,KAAK,IAAI;AAAA,UAC5C,OAAO,KAAK;AAAA,QACd,CAAC;AAED,kBAAU,MAAM;AAChB,kBAAU,SAAS;AACnB,cAAM,QAAQ,OAAO,qBAAqB,IAAI,CAAC;AAE/C,eAAO;AAAA,MACT,SAAS,KAAU;AACjB,kBAAU,QAAQ;AAClB,cAAM,MAAM,KAAK,gBAAgB,KAAK,WAAW;AACjD,iBAAS,GAAG;AACZ,eAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,CAAC,SAAS,kBAAkB;AAAA,EAC9B;AAEA,QAAM,QAAQA,aAAY,MAAM;AAC9B,cAAU,MAAM;AAChB,aAAS,IAAI;AACb,cAAU,MAAS;AAAA,EACrB,GAAG,CAAC,CAAC;AAEL,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa,CAAC,CAAC;AAAA,EACjB;AACF;;;AClHA,SAAS,gBAAgB;AAGlB,SAAS,gBAAuB;AACrC,SAAO,SAAS,UAAU;AAC5B;","names":["atom","atom","atom","useState","useEffect","useCallback","useState","useCallback","useEffect","rpcUrl","useState","useEffect","useCallback","toHex","resolveOperatorRpc","useState","useCallback","useEffect","rpcUrl","toHex","useCallback","useState","useMemo","useEffect","useState","useMemo","useCallback"]}
@@ -1,327 +0,0 @@
1
- // src/host/resolver.ts
2
- var EXPERIENCE_TIER_LABELS = {
3
- generic: "Protocol fallback",
4
- declarative: "Declarative blueprint UI",
5
- "curated-module": "Curated app module",
6
- "external-app": "External app handoff"
7
- };
8
- var SLUG_POLICY_LABELS = {
9
- reserved: "Reserved slug",
10
- "publisher-scoped": "Publisher-scoped slug",
11
- "public-requested": "Public requested slug"
12
- };
13
- var SURFACE_LABELS = {
14
- "generic-overview": "Generic overview",
15
- "service-explorer": "Service explorer",
16
- "service-console": "Service console",
17
- "actions-panel": "Actions panel",
18
- resources: "Resources",
19
- chat: "Chat",
20
- vaults: "Vaults",
21
- metrics: "Metrics",
22
- permissions: "Permissions"
23
- };
24
- var PUBLISHER_VERIFICATION_LABELS = {
25
- "first-party": "First-party publisher",
26
- verified: "Verified publisher",
27
- unverified: "Unverified publisher"
28
- };
29
- var EXTERNAL_APP_TRUST_LABELS = {
30
- trusted: "Trusted external app",
31
- restricted: "Restricted external app"
32
- };
33
- function buildCanonicalBlueprintSlug(entry) {
34
- if (entry.canonicalSlug) {
35
- return entry.canonicalSlug;
36
- }
37
- if (entry.slugPolicy === "reserved" || !entry.publisher.namespace) {
38
- return entry.slug;
39
- }
40
- return `@${entry.publisher.namespace}/${entry.slug}`;
41
- }
42
- function resolveBlueprintAppView(entry) {
43
- return {
44
- slug: entry.slug,
45
- canonicalSlug: buildCanonicalBlueprintSlug(entry),
46
- blueprintId: entry.blueprintId,
47
- publisher: entry.publisher,
48
- tier: entry.tier,
49
- slugPolicy: entry.slugPolicy,
50
- manifest: entry.manifest,
51
- module: entry.module,
52
- fallbackEnabled: true
53
- };
54
- }
55
- function toBlueprintAppEntry(view) {
56
- return {
57
- slug: view.slug,
58
- canonicalSlug: view.canonicalSlug,
59
- blueprintId: view.blueprintId,
60
- publisher: view.publisher,
61
- tier: view.tier,
62
- slugPolicy: view.slugPolicy,
63
- manifest: view.manifest,
64
- module: view.module
65
- };
66
- }
67
- function getBlueprintExperienceTierLabel(tier) {
68
- return EXPERIENCE_TIER_LABELS[tier];
69
- }
70
- function getBlueprintSlugPolicyLabel(policy) {
71
- return SLUG_POLICY_LABELS[policy];
72
- }
73
- function getBlueprintSurfaceLabel(surface) {
74
- return SURFACE_LABELS[surface];
75
- }
76
- function getBlueprintPublisherVerificationLabel(verification) {
77
- return PUBLISHER_VERIFICATION_LABELS[verification];
78
- }
79
- function getExternalAppTrustLabel(trust) {
80
- return EXTERNAL_APP_TRUST_LABELS[trust];
81
- }
82
- function isVerifiedBlueprintPublisher(publisher) {
83
- return publisher.verification === "first-party" || publisher.verification === "verified";
84
- }
85
- function canPublisherClaimSlug(slug, publisher, reservedSlugs = /* @__PURE__ */ new Set()) {
86
- if (reservedSlugs.has(slug)) {
87
- return false;
88
- }
89
- return publisher?.namespace !== void 0 && publisher.namespace.trim().length > 0 && (publisher.verification === "verified" || publisher.verification === "first-party");
90
- }
91
- function isTrustedExternalAppHost(host, trustedHosts = []) {
92
- const normalizedHost = host.trim().toLowerCase();
93
- return trustedHosts.some(
94
- (trustedHost) => normalizedHost === trustedHost || normalizedHost.endsWith(`.${trustedHost}`)
95
- );
96
- }
97
- function getBlueprintPath(view) {
98
- if (view.tier === "curated-module" || view.tier === "external-app") {
99
- return `/blueprints/${view.canonicalSlug}`;
100
- }
101
- if (view.blueprintId !== void 0) {
102
- return `/blueprints/${view.blueprintId.toString()}`;
103
- }
104
- return `/blueprints/${view.slug}`;
105
- }
106
- function getBlueprintServicePath(view, serviceId) {
107
- if (view.tier === "curated-module" || view.tier === "external-app") {
108
- return `${getBlueprintPath(view)}/${serviceId}`;
109
- }
110
- return `${getBlueprintPath(view)}/services/${serviceId}`;
111
- }
112
- function sanitizeBlueprintSlugPart(value) {
113
- return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, "-");
114
- }
115
- function deriveBlueprintRequestedSlug(blueprint) {
116
- const fromName = sanitizeBlueprintSlugPart(blueprint.name);
117
- if (fromName.length > 0) {
118
- return fromName;
119
- }
120
- const fromAuthor = sanitizeBlueprintSlugPart(blueprint.author);
121
- if (fromAuthor.length > 0) {
122
- return `${fromAuthor}-${blueprint.id.toString()}`;
123
- }
124
- return `blueprint-${blueprint.id.toString()}`;
125
- }
126
-
127
- // src/utils.ts
128
- import { clsx } from "clsx";
129
- import { twMerge } from "tailwind-merge";
130
- function cn(...inputs) {
131
- return twMerge(clsx(inputs));
132
- }
133
-
134
- // src/components/ui/card.tsx
135
- import { jsx } from "react/jsx-runtime";
136
- function Card({ className, ...props }) {
137
- return /* @__PURE__ */ jsx(
138
- "div",
139
- {
140
- "data-slot": "card",
141
- className: cn("glass-card rounded-xl text-bp-elements-textPrimary", className),
142
- ...props
143
- }
144
- );
145
- }
146
- function CardHeader({ className, ...props }) {
147
- return /* @__PURE__ */ jsx("div", { "data-slot": "card-header", className: cn("flex flex-col gap-1.5 p-6", className), ...props });
148
- }
149
- function CardTitle({ className, ...props }) {
150
- return /* @__PURE__ */ jsx("div", { "data-slot": "card-title", className: cn("leading-none font-semibold font-display", className), ...props });
151
- }
152
- function CardDescription({ className, ...props }) {
153
- return /* @__PURE__ */ jsx("div", { "data-slot": "card-description", className: cn("text-bp-elements-textSecondary text-sm", className), ...props });
154
- }
155
- function CardContent({ className, ...props }) {
156
- return /* @__PURE__ */ jsx("div", { "data-slot": "card-content", className: cn("px-6 pb-6", className), ...props });
157
- }
158
- function CardFooter({ className, ...props }) {
159
- return /* @__PURE__ */ jsx("div", { "data-slot": "card-footer", className: cn("flex items-center px-6 pb-6", className), ...props });
160
- }
161
-
162
- // src/components/ui/badge.tsx
163
- import { Slot } from "@radix-ui/react-slot";
164
- import { cva } from "class-variance-authority";
165
- import { jsx as jsx2 } from "react/jsx-runtime";
166
- var badgeVariants = cva(
167
- "inline-flex items-center justify-center rounded-md border px-2.5 py-0.5 text-xs font-semibold font-data uppercase tracking-wider w-fit whitespace-nowrap shrink-0 gap-1 transition-colors",
168
- {
169
- variants: {
170
- variant: {
171
- default: "border-bp-elements-borderColor bg-bp-elements-background-depth-3 text-bp-elements-textPrimary",
172
- secondary: "border-bp-elements-dividerColor bg-bp-elements-background-depth-2 text-bp-elements-textSecondary",
173
- destructive: "border-crimson-500/20 bg-crimson-500/10 text-bp-elements-icon-error",
174
- success: "border-teal-500/20 bg-teal-500/10 text-bp-elements-icon-success",
175
- outline: "text-bp-elements-textPrimary border-bp-elements-borderColor bg-transparent",
176
- accent: "border-violet-500/20 bg-violet-500/10 text-violet-700 dark:text-violet-400",
177
- amber: "border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-400",
178
- running: "border-teal-500/20 bg-teal-500/10 text-teal-600 dark:text-teal-400",
179
- stopped: "border-amber-500/20 bg-amber-500/10 text-amber-600 dark:text-amber-400",
180
- cold: "border-blue-500/20 bg-blue-500/10 text-blue-600 dark:text-blue-400"
181
- }
182
- },
183
- defaultVariants: { variant: "default" }
184
- }
185
- );
186
- function Badge({
187
- className,
188
- variant,
189
- asChild = false,
190
- ...props
191
- }) {
192
- const Comp = asChild ? Slot : "span";
193
- return /* @__PURE__ */ jsx2(Comp, { "data-slot": "badge", className: cn(badgeVariants({ variant }), className), ...props });
194
- }
195
-
196
- // src/components/ui/button.tsx
197
- import { Slot as Slot2 } from "@radix-ui/react-slot";
198
- import { cva as cva2 } from "class-variance-authority";
199
- import { jsx as jsx3 } from "react/jsx-runtime";
200
- var buttonVariants = cva2(
201
- 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium font-display transition-all duration-200 disabled:pointer-events-none disabled:opacity-40 [&_svg]:pointer-events-none [&_svg:not([class*="size-"])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-violet-400/50 focus-visible:ring-offset-2 focus-visible:ring-offset-bp-elements-background-depth-1',
202
- {
203
- variants: {
204
- variant: {
205
- default: "bg-violet-600 text-white font-semibold hover:bg-violet-500 shadow-[0_0_20px_rgba(142,89,255,0.25)] hover:shadow-[0_0_30px_rgba(142,89,255,0.35)]",
206
- destructive: "bg-crimson-500/15 text-crimson-400 border border-crimson-500/20 hover:bg-crimson-500/25 hover:border-crimson-500/30",
207
- outline: "glass glass-hover text-bp-elements-textPrimary",
208
- secondary: "bg-bp-elements-background-depth-3 text-bp-elements-textSecondary border border-bp-elements-borderColor hover:bg-bp-elements-background-depth-4 hover:text-bp-elements-textPrimary",
209
- ghost: "text-bp-elements-textSecondary hover:text-bp-elements-textPrimary hover:bg-bp-elements-item-backgroundHover",
210
- link: "text-violet-700 dark:text-violet-400 underline-offset-4 hover:underline",
211
- success: "bg-teal-600/15 text-teal-400 border border-teal-500/20 hover:bg-teal-600/25"
212
- },
213
- size: {
214
- default: "h-9 px-4 py-2 has-[>svg]:px-3",
215
- sm: "h-8 rounded-md gap-1.5 px-3 text-xs has-[>svg]:px-2.5",
216
- lg: "h-11 rounded-xl px-7 text-base has-[>svg]:px-5",
217
- icon: "size-9",
218
- "icon-sm": "size-8"
219
- }
220
- },
221
- defaultVariants: {
222
- variant: "default",
223
- size: "default"
224
- }
225
- }
226
- );
227
- function Button({
228
- className,
229
- variant = "default",
230
- size = "default",
231
- asChild = false,
232
- ...props
233
- }) {
234
- const Comp = asChild ? Slot2 : "button";
235
- return /* @__PURE__ */ jsx3(
236
- Comp,
237
- {
238
- "data-slot": "button",
239
- className: cn(buttonVariants({ variant, size, className })),
240
- ...props
241
- }
242
- );
243
- }
244
-
245
- // src/host/components/BlueprintHostHero.tsx
246
- import { jsx as jsx4, jsxs } from "react/jsx-runtime";
247
- function BlueprintHostHero({
248
- title,
249
- tagline,
250
- description,
251
- badges = [],
252
- actions = [],
253
- children,
254
- className
255
- }) {
256
- return /* @__PURE__ */ jsxs(Card, { className: cn("rounded-3xl border-bp-elements-borderColor/70 bg-bp-elements-background-depth-2", className), children: [
257
- /* @__PURE__ */ jsxs(CardHeader, { className: "space-y-4", children: [
258
- badges.length > 0 ? /* @__PURE__ */ jsx4("div", { className: "flex flex-wrap gap-2", children: badges.map((badge) => /* @__PURE__ */ jsx4(Badge, { variant: "secondary", children: badge }, badge)) }) : null,
259
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
260
- /* @__PURE__ */ jsx4(CardTitle, { className: "text-3xl", children: title }),
261
- tagline ? /* @__PURE__ */ jsx4(CardDescription, { className: "text-base text-bp-elements-textPrimary/80", children: tagline }) : null
262
- ] }),
263
- description ? /* @__PURE__ */ jsx4("p", { className: "max-w-3xl text-sm leading-6 text-bp-elements-textSecondary", children: description }) : null
264
- ] }),
265
- (actions.length > 0 || children) && /* @__PURE__ */ jsxs(CardContent, { className: "space-y-4", children: [
266
- actions.length > 0 ? /* @__PURE__ */ jsx4("div", { className: "flex flex-wrap gap-3", children: actions.map((action) => {
267
- const button = /* @__PURE__ */ jsx4(
268
- Button,
269
- {
270
- variant: action.variant ?? "default",
271
- onClick: action.onClick,
272
- disabled: action.disabled,
273
- children: action.label
274
- },
275
- action.label
276
- );
277
- return action.href ? /* @__PURE__ */ jsx4("a", { href: action.href, children: button }, action.label) : button;
278
- }) }) : null,
279
- children
280
- ] })
281
- ] });
282
- }
283
-
284
- // src/host/components/BlueprintHostPanel.tsx
285
- import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
286
- function BlueprintHostPanel({
287
- title,
288
- children,
289
- className
290
- }) {
291
- return /* @__PURE__ */ jsxs2(Card, { className: cn("rounded-3xl border-bp-elements-borderColor/70 bg-bp-elements-background-depth-2", className), children: [
292
- /* @__PURE__ */ jsx5(CardHeader, { children: /* @__PURE__ */ jsx5(CardTitle, { className: "text-xl", children: title }) }),
293
- /* @__PURE__ */ jsx5(CardContent, { children })
294
- ] });
295
- }
296
-
297
- export {
298
- cn,
299
- buildCanonicalBlueprintSlug,
300
- resolveBlueprintAppView,
301
- toBlueprintAppEntry,
302
- getBlueprintExperienceTierLabel,
303
- getBlueprintSlugPolicyLabel,
304
- getBlueprintSurfaceLabel,
305
- getBlueprintPublisherVerificationLabel,
306
- getExternalAppTrustLabel,
307
- isVerifiedBlueprintPublisher,
308
- canPublisherClaimSlug,
309
- isTrustedExternalAppHost,
310
- getBlueprintPath,
311
- getBlueprintServicePath,
312
- sanitizeBlueprintSlugPart,
313
- deriveBlueprintRequestedSlug,
314
- Card,
315
- CardHeader,
316
- CardTitle,
317
- CardDescription,
318
- CardContent,
319
- CardFooter,
320
- badgeVariants,
321
- Badge,
322
- buttonVariants,
323
- Button,
324
- BlueprintHostHero,
325
- BlueprintHostPanel
326
- };
327
- //# sourceMappingURL=chunk-GD3AZEJL.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/host/resolver.ts","../src/utils.ts","../src/components/ui/card.tsx","../src/components/ui/badge.tsx","../src/components/ui/button.tsx","../src/host/components/BlueprintHostHero.tsx","../src/host/components/BlueprintHostPanel.tsx"],"sourcesContent":["import type {\n BlueprintAppEntry,\n BlueprintAppResolvedView,\n BlueprintExperienceTier,\n BlueprintExternalAppTrust,\n BlueprintPublisher,\n BlueprintPublisherVerification,\n BlueprintSlugPolicy,\n BlueprintUiSurface,\n} from './types';\n\nconst EXPERIENCE_TIER_LABELS: Record<BlueprintExperienceTier, string> = {\n generic: 'Protocol fallback',\n declarative: 'Declarative blueprint UI',\n 'curated-module': 'Curated app module',\n 'external-app': 'External app handoff',\n};\n\nconst SLUG_POLICY_LABELS: Record<BlueprintSlugPolicy, string> = {\n reserved: 'Reserved slug',\n 'publisher-scoped': 'Publisher-scoped slug',\n 'public-requested': 'Public requested slug',\n};\n\nconst SURFACE_LABELS: Record<BlueprintUiSurface, string> = {\n 'generic-overview': 'Generic overview',\n 'service-explorer': 'Service explorer',\n 'service-console': 'Service console',\n 'actions-panel': 'Actions panel',\n resources: 'Resources',\n chat: 'Chat',\n vaults: 'Vaults',\n metrics: 'Metrics',\n permissions: 'Permissions',\n};\n\nconst PUBLISHER_VERIFICATION_LABELS: Record<\n BlueprintPublisherVerification,\n string\n> = {\n 'first-party': 'First-party publisher',\n verified: 'Verified publisher',\n unverified: 'Unverified publisher',\n};\n\nconst EXTERNAL_APP_TRUST_LABELS: Record<BlueprintExternalAppTrust, string> = {\n trusted: 'Trusted external app',\n restricted: 'Restricted external app',\n};\n\nexport function buildCanonicalBlueprintSlug(entry: BlueprintAppEntry): string {\n if (entry.canonicalSlug) {\n return entry.canonicalSlug;\n }\n\n if (entry.slugPolicy === 'reserved' || !entry.publisher.namespace) {\n return entry.slug;\n }\n\n return `@${entry.publisher.namespace}/${entry.slug}`;\n}\n\nexport function resolveBlueprintAppView(\n entry: BlueprintAppEntry,\n): BlueprintAppResolvedView {\n return {\n slug: entry.slug,\n canonicalSlug: buildCanonicalBlueprintSlug(entry),\n blueprintId: entry.blueprintId,\n publisher: entry.publisher,\n tier: entry.tier,\n slugPolicy: entry.slugPolicy,\n manifest: entry.manifest,\n module: entry.module,\n fallbackEnabled: true,\n };\n}\n\nexport function toBlueprintAppEntry(\n view: BlueprintAppResolvedView,\n): BlueprintAppEntry {\n return {\n slug: view.slug,\n canonicalSlug: view.canonicalSlug,\n blueprintId: view.blueprintId,\n publisher: view.publisher,\n tier: view.tier,\n slugPolicy: view.slugPolicy,\n manifest: view.manifest,\n module: view.module,\n };\n}\n\nexport function getBlueprintExperienceTierLabel(\n tier: BlueprintExperienceTier,\n): string {\n return EXPERIENCE_TIER_LABELS[tier];\n}\n\nexport function getBlueprintSlugPolicyLabel(policy: BlueprintSlugPolicy): string {\n return SLUG_POLICY_LABELS[policy];\n}\n\nexport function getBlueprintSurfaceLabel(surface: BlueprintUiSurface): string {\n return SURFACE_LABELS[surface];\n}\n\nexport function getBlueprintPublisherVerificationLabel(\n verification: BlueprintPublisherVerification,\n): string {\n return PUBLISHER_VERIFICATION_LABELS[verification];\n}\n\nexport function getExternalAppTrustLabel(\n trust: BlueprintExternalAppTrust,\n): string {\n return EXTERNAL_APP_TRUST_LABELS[trust];\n}\n\nexport function isVerifiedBlueprintPublisher(\n publisher: BlueprintPublisher,\n): boolean {\n return (\n publisher.verification === 'first-party' ||\n publisher.verification === 'verified'\n );\n}\n\nexport function canPublisherClaimSlug(\n slug: string,\n publisher?: Pick<BlueprintPublisher, 'namespace' | 'verification'>,\n reservedSlugs: Set<string> = new Set(),\n): boolean {\n if (reservedSlugs.has(slug)) {\n return false;\n }\n\n return (\n publisher?.namespace !== undefined &&\n publisher.namespace.trim().length > 0 &&\n (publisher.verification === 'verified' ||\n publisher.verification === 'first-party')\n );\n}\n\nexport function isTrustedExternalAppHost(\n host: string,\n trustedHosts: readonly string[] = [],\n): boolean {\n const normalizedHost = host.trim().toLowerCase();\n\n return trustedHosts.some(\n (trustedHost) =>\n normalizedHost === trustedHost || normalizedHost.endsWith(`.${trustedHost}`),\n );\n}\n\nexport function getBlueprintPath(view: BlueprintAppResolvedView): string {\n if (view.tier === 'curated-module' || view.tier === 'external-app') {\n return `/blueprints/${view.canonicalSlug}`;\n }\n\n if (view.blueprintId !== undefined) {\n return `/blueprints/${view.blueprintId.toString()}`;\n }\n\n return `/blueprints/${view.slug}`;\n}\n\nexport function getBlueprintServicePath(\n view: BlueprintAppResolvedView,\n serviceId: string,\n): string {\n if (view.tier === 'curated-module' || view.tier === 'external-app') {\n return `${getBlueprintPath(view)}/${serviceId}`;\n }\n\n return `${getBlueprintPath(view)}/services/${serviceId}`;\n}\n\nexport function sanitizeBlueprintSlugPart(value: string): string {\n return value\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n .replace(/-{2,}/g, '-');\n}\n\nexport function deriveBlueprintRequestedSlug(\n blueprint: Pick<{ name: string; author: string; id: bigint }, 'name' | 'author' | 'id'>,\n): string {\n const fromName = sanitizeBlueprintSlugPart(blueprint.name);\n if (fromName.length > 0) {\n return fromName;\n }\n\n const fromAuthor = sanitizeBlueprintSlugPart(blueprint.author);\n if (fromAuthor.length > 0) {\n return `${fromAuthor}-${blueprint.id.toString()}`;\n }\n\n return `blueprint-${blueprint.id.toString()}`;\n}\n","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import * as React from 'react';\nimport { cn } from '../../utils';\n\nfunction Card({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card\"\n className={cn('glass-card rounded-xl text-bp-elements-textPrimary', className)}\n {...props}\n />\n );\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"card-header\" className={cn('flex flex-col gap-1.5 p-6', className)} {...props} />;\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"card-title\" className={cn('leading-none font-semibold font-display', className)} {...props} />;\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"card-description\" className={cn('text-bp-elements-textSecondary text-sm', className)} {...props} />;\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"card-content\" className={cn('px-6 pb-6', className)} {...props} />;\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"card-footer\" className={cn('flex items-center px-6 pb-6', className)} {...props} />;\n}\n\nexport { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter };\n","import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils';\n\nconst badgeVariants = cva(\n 'inline-flex items-center justify-center rounded-md border px-2.5 py-0.5 text-xs font-semibold font-data uppercase tracking-wider w-fit whitespace-nowrap shrink-0 gap-1 transition-colors',\n {\n variants: {\n variant: {\n default: 'border-bp-elements-borderColor bg-bp-elements-background-depth-3 text-bp-elements-textPrimary',\n secondary: 'border-bp-elements-dividerColor bg-bp-elements-background-depth-2 text-bp-elements-textSecondary',\n destructive: 'border-crimson-500/20 bg-crimson-500/10 text-bp-elements-icon-error',\n success: 'border-teal-500/20 bg-teal-500/10 text-bp-elements-icon-success',\n outline: 'text-bp-elements-textPrimary border-bp-elements-borderColor bg-transparent',\n accent: 'border-violet-500/20 bg-violet-500/10 text-violet-700 dark:text-violet-400',\n amber: 'border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-400',\n running: 'border-teal-500/20 bg-teal-500/10 text-teal-600 dark:text-teal-400',\n stopped: 'border-amber-500/20 bg-amber-500/10 text-amber-600 dark:text-amber-400',\n cold: 'border-blue-500/20 bg-blue-500/10 text-blue-600 dark:text-blue-400',\n },\n },\n defaultVariants: { variant: 'default' },\n },\n);\n\nfunction Badge({\n className,\n variant,\n asChild = false,\n ...props\n}: React.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & { asChild?: boolean }) {\n const Comp = asChild ? Slot : 'span';\n return <Comp data-slot=\"badge\" className={cn(badgeVariants({ variant }), className)} {...props} />;\n}\n\nexport { Badge, badgeVariants };\n","import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils';\n\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium font-display transition-all duration-200 disabled:pointer-events-none disabled:opacity-40 [&_svg]:pointer-events-none [&_svg:not([class*=\"size-\"])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-violet-400/50 focus-visible:ring-offset-2 focus-visible:ring-offset-bp-elements-background-depth-1',\n {\n variants: {\n variant: {\n default:\n 'bg-violet-600 text-white font-semibold hover:bg-violet-500 shadow-[0_0_20px_rgba(142,89,255,0.25)] hover:shadow-[0_0_30px_rgba(142,89,255,0.35)]',\n destructive:\n 'bg-crimson-500/15 text-crimson-400 border border-crimson-500/20 hover:bg-crimson-500/25 hover:border-crimson-500/30',\n outline:\n 'glass glass-hover text-bp-elements-textPrimary',\n secondary:\n 'bg-bp-elements-background-depth-3 text-bp-elements-textSecondary border border-bp-elements-borderColor hover:bg-bp-elements-background-depth-4 hover:text-bp-elements-textPrimary',\n ghost:\n 'text-bp-elements-textSecondary hover:text-bp-elements-textPrimary hover:bg-bp-elements-item-backgroundHover',\n link:\n 'text-violet-700 dark:text-violet-400 underline-offset-4 hover:underline',\n success:\n 'bg-teal-600/15 text-teal-400 border border-teal-500/20 hover:bg-teal-600/25',\n },\n size: {\n default: 'h-9 px-4 py-2 has-[>svg]:px-3',\n sm: 'h-8 rounded-md gap-1.5 px-3 text-xs has-[>svg]:px-2.5',\n lg: 'h-11 rounded-xl px-7 text-base has-[>svg]:px-5',\n icon: 'size-9',\n 'icon-sm': 'size-8',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n },\n);\n\nfunction Button({\n className,\n variant = 'default',\n size = 'default',\n asChild = false,\n ...props\n}: React.ComponentProps<'button'> &\n VariantProps<typeof buttonVariants> & {\n asChild?: boolean;\n }) {\n const Comp = asChild ? Slot : 'button';\n return (\n <Comp\n data-slot=\"button\"\n className={cn(buttonVariants({ variant, size, className }))}\n {...props}\n />\n );\n}\n\nexport { Button, buttonVariants };\n","import * as React from 'react';\nimport { Card, CardContent, CardHeader, CardTitle, CardDescription } from '../../components/ui/card';\nimport { Badge } from '../../components/ui/badge';\nimport { Button } from '../../components/ui/button';\nimport { cn } from '../../utils';\n\ntype Action = {\n label: string;\n href?: string;\n onClick?: () => void;\n variant?: React.ComponentProps<typeof Button>['variant'];\n disabled?: boolean;\n};\n\nexport type BlueprintHostHeroProps = {\n title: string;\n tagline?: string;\n description?: string;\n badges?: string[];\n actions?: Action[];\n children?: React.ReactNode;\n className?: string;\n};\n\nexport function BlueprintHostHero({\n title,\n tagline,\n description,\n badges = [],\n actions = [],\n children,\n className,\n}: BlueprintHostHeroProps) {\n return (\n <Card className={cn('rounded-3xl border-bp-elements-borderColor/70 bg-bp-elements-background-depth-2', className)}>\n <CardHeader className=\"space-y-4\">\n {badges.length > 0 ? (\n <div className=\"flex flex-wrap gap-2\">\n {badges.map((badge) => (\n <Badge key={badge} variant=\"secondary\">\n {badge}\n </Badge>\n ))}\n </div>\n ) : null}\n <div className=\"space-y-2\">\n <CardTitle className=\"text-3xl\">{title}</CardTitle>\n {tagline ? (\n <CardDescription className=\"text-base text-bp-elements-textPrimary/80\">\n {tagline}\n </CardDescription>\n ) : null}\n </div>\n {description ? (\n <p className=\"max-w-3xl text-sm leading-6 text-bp-elements-textSecondary\">\n {description}\n </p>\n ) : null}\n </CardHeader>\n {(actions.length > 0 || children) && (\n <CardContent className=\"space-y-4\">\n {actions.length > 0 ? (\n <div className=\"flex flex-wrap gap-3\">\n {actions.map((action) => {\n const button = (\n <Button\n key={action.label}\n variant={action.variant ?? 'default'}\n onClick={action.onClick}\n disabled={action.disabled}\n >\n {action.label}\n </Button>\n );\n\n return action.href ? (\n <a key={action.label} href={action.href}>\n {button}\n </a>\n ) : (\n button\n );\n })}\n </div>\n ) : null}\n {children}\n </CardContent>\n )}\n </Card>\n );\n}\n","import * as React from 'react';\nimport { Card, CardContent, CardHeader, CardTitle } from '../../components/ui/card';\nimport { cn } from '../../utils';\n\nexport type BlueprintHostPanelProps = {\n title: string;\n children: React.ReactNode;\n className?: string;\n};\n\nexport function BlueprintHostPanel({\n title,\n children,\n className,\n}: BlueprintHostPanelProps) {\n return (\n <Card className={cn('rounded-3xl border-bp-elements-borderColor/70 bg-bp-elements-background-depth-2', className)}>\n <CardHeader>\n <CardTitle className=\"text-xl\">{title}</CardTitle>\n </CardHeader>\n <CardContent>{children}</CardContent>\n </Card>\n );\n}\n"],"mappings":";AAWA,IAAM,yBAAkE;AAAA,EACtE,SAAS;AAAA,EACT,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,gBAAgB;AAClB;AAEA,IAAM,qBAA0D;AAAA,EAC9D,UAAU;AAAA,EACV,oBAAoB;AAAA,EACpB,oBAAoB;AACtB;AAEA,IAAM,iBAAqD;AAAA,EACzD,oBAAoB;AAAA,EACpB,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,aAAa;AACf;AAEA,IAAM,gCAGF;AAAA,EACF,eAAe;AAAA,EACf,UAAU;AAAA,EACV,YAAY;AACd;AAEA,IAAM,4BAAuE;AAAA,EAC3E,SAAS;AAAA,EACT,YAAY;AACd;AAEO,SAAS,4BAA4B,OAAkC;AAC5E,MAAI,M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