frontier-os-app-builder 1.0.0 → 1.2.0

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.
Files changed (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -14
  3. package/agents/fos-executor.md +105 -39
  4. package/agents/fos-plan-checker.md +62 -25
  5. package/agents/fos-planner.md +80 -72
  6. package/agents/fos-researcher.md +26 -15
  7. package/agents/fos-verifier.md +96 -27
  8. package/bin/fos-tools.cjs +146 -42
  9. package/bin/install.js +8 -5
  10. package/commands/fos/add-feature.md +1 -2
  11. package/commands/fos/discuss.md +0 -1
  12. package/commands/fos/new-app.md +2 -4
  13. package/commands/fos/new-milestone.md +1 -1
  14. package/commands/fos/plan.md +0 -2
  15. package/package.json +7 -1
  16. package/references/app-patterns.md +128 -21
  17. package/references/deployment.md +40 -124
  18. package/references/module-index.md +32 -0
  19. package/references/sdk/chain.md +92 -0
  20. package/references/sdk/communities.md +159 -0
  21. package/references/sdk/events.md +212 -0
  22. package/references/sdk/init.md +126 -0
  23. package/references/sdk/navigation.md +49 -0
  24. package/references/sdk/offices.md +76 -0
  25. package/references/sdk/partnerships.md +111 -0
  26. package/references/sdk/storage.md +44 -0
  27. package/references/sdk/thirdparty.md +240 -0
  28. package/references/sdk/token-amount.md +99 -0
  29. package/references/sdk/types.md +27 -0
  30. package/references/sdk/ui-utils.md +39 -0
  31. package/references/sdk/user.md +208 -0
  32. package/references/sdk/wallet.md +334 -0
  33. package/references/verification-rules.md +111 -50
  34. package/templates/app/frontier-services.tsx +871 -0
  35. package/templates/app/layout-standalone.tsx +8 -0
  36. package/templates/app/layout.tsx +19 -9
  37. package/templates/app/package-standalone.json +35 -0
  38. package/templates/app/package.json +2 -1
  39. package/templates/app/public/favicon.svg +3 -0
  40. package/templates/app/sdk-context.tsx +7 -9
  41. package/templates/app/sdk-services.tsx +98 -0
  42. package/templates/app/vercel-standalone.json +5 -0
  43. package/templates/app/vercel.json +8 -95
  44. package/templates/state/plan.md +32 -14
  45. package/templates/state/requirements.md +1 -1
  46. package/templates/state/roadmap.md +57 -24
  47. package/templates/state/summary.md +27 -30
  48. package/workflows/add-feature.md +6 -1
  49. package/workflows/discuss.md +126 -11
  50. package/workflows/execute-plan.md +21 -14
  51. package/workflows/execute.md +204 -24
  52. package/workflows/new-app.md +64 -23
  53. package/workflows/new-milestone.md +10 -3
  54. package/workflows/plan.md +16 -5
  55. package/workflows/ship.md +91 -34
  56. package/workflows/status.md +1 -2
  57. package/references/module-inference.md +0 -349
  58. package/references/sdk-surface.md +0 -1622
  59. package/templates/app/main-simple.tsx +0 -19
  60. package/templates/state/manifest.json +0 -11
@@ -0,0 +1,208 @@
1
+ # User Module
2
+
3
+ **Trigger keywords:** user, profile, account, member, membership, auth, login, referral, invite, refer, signup, register, kyc, verify, identity, access control, gate, permission, name, person
4
+
5
+ Access via `sdk.getUser()`. Query user info, profiles, referrals, KYC, and access controls.
6
+
7
+ ---
8
+
9
+ ## Methods
10
+
11
+ ```typescript
12
+ getDetails(): Promise<User>
13
+ ```
14
+ Returns basic user info (id, email, name, active/superuser status). Permission: `user:getDetails`
15
+
16
+ ```typescript
17
+ getProfile(): Promise<UserProfile>
18
+ ```
19
+ Returns detailed profile (social handles, preferences, community, notification settings). Permission: `user:getProfile`
20
+
21
+ ```typescript
22
+ getReferralOverview(): Promise<ReferralOverview>
23
+ ```
24
+ Returns referral statistics (count, ranking, referral link/code). Permission: `user:getReferralOverview`
25
+
26
+ ```typescript
27
+ getReferralDetails(page?: number): Promise<PaginatedResponse<ReferralDetails>>
28
+ ```
29
+ Returns paginated referral details. Permission: `user:getReferralDetails`
30
+
31
+ ```typescript
32
+ addUserContact(data: UserContactPayload): Promise<void>
33
+ ```
34
+ Submit contact information for the current user. Permission: `user:addUserContact`
35
+
36
+ ```typescript
37
+ getOrCreateKyc(redirectUri?: string): Promise<KycStatusResponse>
38
+ ```
39
+ Get or initiate KYC verification. Returns status and a KYC link if verification has been started. Permission: `user:getOrCreateKyc`
40
+
41
+ ```typescript
42
+ createSignupRequest(payload: CreateSignupRequestPayload): Promise<CreateSignupRequestResponse>
43
+ ```
44
+ Submit a new membership signup request with crypto payment. Permission: `user:createSignupRequest`
45
+
46
+ ```typescript
47
+ getVerifiedAccessControls(): Promise<AccessControlsPayload>
48
+ ```
49
+ Returns cryptographically verified access controls signed by the Frontier API server. The SDK verifies an ECDSA secp256k1 signature against hardcoded per-environment public keys inside the iframe. **Use this for all access-gating decisions** -- unsigned data from other SDK methods should not be trusted for feature gating. Throws if signature verification fails. Permission: `user:getVerifiedAccessControls`
50
+
51
+ ---
52
+
53
+ ## Types
54
+
55
+ ```typescript
56
+ interface User {
57
+ id: number;
58
+ email: string;
59
+ firstName: string;
60
+ lastName: string;
61
+ isActive: boolean;
62
+ dateJoined: string;
63
+ isSuperuser: boolean;
64
+ }
65
+
66
+ interface UserProfile {
67
+ id: number;
68
+ user: number;
69
+ firstName: string;
70
+ lastName: string;
71
+ nickname: string;
72
+ profilePicture: string;
73
+ phoneNumber: string;
74
+ community: string;
75
+ communityName: string;
76
+ organization: string;
77
+ organizationRole: string;
78
+ socialSite: string;
79
+ socialHandle: string;
80
+ githubHandle: string;
81
+ currentWork: string;
82
+ notableWork: string;
83
+ receiveUpdates: boolean;
84
+ notificationCommunityEvent: boolean;
85
+ notificationTowerEvent: boolean;
86
+ notificationUpcomingEvent: boolean;
87
+ notificationTweetPicked: boolean;
88
+ notifyEventInvites: boolean;
89
+ optInSms: boolean;
90
+ howDidYouHearAboutUs: string;
91
+ braggingStatement: string;
92
+ contributionStatement: string;
93
+ hasUsablePassword: string;
94
+ }
95
+
96
+ interface ReferralOverview {
97
+ referralCount: number;
98
+ ranking: number;
99
+ referralLink: string;
100
+ referralCode: string;
101
+ referredBy: string | null;
102
+ }
103
+
104
+ interface ReferralDetails {
105
+ name: string;
106
+ email: string;
107
+ referralDate: string;
108
+ reward: string;
109
+ status: string;
110
+ }
111
+
112
+ interface UserContact {
113
+ email: string;
114
+ phone: string;
115
+ name: string;
116
+ }
117
+
118
+ interface UserContactPayload {
119
+ contacts: UserContact[];
120
+ }
121
+
122
+ type KycStatus = 'not_started' | 'pending' | 'in_review' | 'approved' | 'rejected';
123
+ type TosStatus = 'pending' | 'approved';
124
+
125
+ interface KycStatusResponse {
126
+ status: KycStatus;
127
+ isApproved: boolean;
128
+ rejectionReason: string | null;
129
+ kycLinkId: string | null;
130
+ kycLink: string | null;
131
+ tosStatus: TosStatus | null;
132
+ tosLink: string | null;
133
+ }
134
+
135
+ interface CreateSignupRequestPayload {
136
+ subscriptionPlan: string;
137
+ subscriptionInterval: string;
138
+ firstName: string;
139
+ lastName: string;
140
+ email: string;
141
+ phoneNumber: string;
142
+ socialSite: string;
143
+ socialHandle: string;
144
+ currentWork: string;
145
+ howDidYouHearAboutUs: string;
146
+ braggingStatement: string;
147
+ contributionStatement: string;
148
+ billingFirstName: string;
149
+ billingLastName: string;
150
+ billingEmail: string;
151
+ billingPhoneNumber: string;
152
+ paymentProvider: 'crypto';
153
+ smartAccount: number;
154
+ community: string;
155
+ githubHandle?: string;
156
+ notableWork?: string;
157
+ referralCode?: string;
158
+ receiveUpdates?: boolean;
159
+ optInSms?: boolean;
160
+ organization?: string;
161
+ organizationRole?: string;
162
+ }
163
+
164
+ interface CreateSignupRequestResponse {
165
+ subscriptionUuid: string;
166
+ paymentProvider: string;
167
+ }
168
+ ```
169
+
170
+ ### Access Controls Types
171
+
172
+ ```typescript
173
+ interface AccessControlsPayload {
174
+ smartAccountAddress: string | null;
175
+ email: string;
176
+ isSuperuser: boolean;
177
+ subscriptionStatus: string | null; // 'active' | 'canceled' | 'awaiting_approval' | null
178
+ subscriptionPlan: string | null;
179
+ subscriptionInterval: string | null;
180
+ subscriptionType: string | null; // 'crypto' | 'stripe' | 'grant' | 'office' | 'internship' | null
181
+ addOns: string[];
182
+ communities: string[];
183
+ managedCommunities: string[];
184
+ timestamp: string;
185
+ kid: string;
186
+ }
187
+
188
+ interface SignedAccessControls {
189
+ accessControls: string; // Base64-encoded canonical JSON payload
190
+ stage: string; // API stage (e.g. 'production', 'sandbox')
191
+ signature: string; // Hex-encoded ECDSA signature (r||s, 128 hex chars)
192
+ }
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Permissions (8)
198
+
199
+ | Permission | Description |
200
+ |---|---|
201
+ | `user:getDetails` | Access current user details |
202
+ | `user:getProfile` | Access current user profile |
203
+ | `user:getReferralOverview` | Access referral statistics |
204
+ | `user:getReferralDetails` | Access detailed referral information |
205
+ | `user:addUserContact` | Add user contact information |
206
+ | `user:getOrCreateKyc` | Get or create KYC verification status |
207
+ | `user:createSignupRequest` | Submit membership signup request with crypto payment |
208
+ | `user:getVerifiedAccessControls` | Get cryptographically verified access controls |
@@ -0,0 +1,334 @@
1
+ # Wallet Module
2
+
3
+ **Trigger keywords:** payment, pay, charge, pos, checkout, purchase, buy, sell, transfer, send money, balance, funds, money, wallet, fnd, swap, exchange, convert, token, deposit, on-ramp, fund, withdraw, off-ramp, bank, fiat, subscription, billing, price, cost, fee, tip, donate, donation
4
+
5
+ Access via `sdk.getWallet()`. All methods use the current chain from the chain manager. Write operations require biometric authentication.
6
+
7
+ ---
8
+
9
+ ## Methods
10
+
11
+ ```typescript
12
+ getBalance(): Promise<WalletBalance>
13
+ ```
14
+ Returns raw balance breakdown (bigint values). To display, format each bigint field with `formatAmount()` from `@frontiertower/frontier-sdk`. Permission: `wallet:getBalance`
15
+
16
+ ```typescript
17
+ getAddress(): Promise<string>
18
+ ```
19
+ Returns the smart account contract address for the current chain. Permission: `wallet:getAddress`
20
+
21
+ ```typescript
22
+ getSmartAccount(): Promise<SmartAccount>
23
+ ```
24
+ Returns detailed smart account info including deployment status. Permission: `wallet:getSmartAccount`
25
+
26
+ ```typescript
27
+ transferERC20(
28
+ tokenAddress: string,
29
+ to: string,
30
+ amount: bigint,
31
+ overrides?: GasOverrides
32
+ ): Promise<UserOperationReceipt>
33
+ ```
34
+ Transfer ERC20 tokens. Amount in token's smallest unit. Permission: `wallet:transferERC20`
35
+
36
+ ```typescript
37
+ approveERC20(
38
+ tokenAddress: string,
39
+ spender: string,
40
+ amount: bigint,
41
+ overrides?: GasOverrides
42
+ ): Promise<UserOperationReceipt>
43
+ ```
44
+ Approve a spender for ERC20 tokens. Permission: `wallet:approveERC20`
45
+
46
+ ```typescript
47
+ transferNative(
48
+ to: string,
49
+ amount: bigint,
50
+ overrides?: GasOverrides
51
+ ): Promise<UserOperationReceipt>
52
+ ```
53
+ Transfer native currency (ETH). Amount in wei. Permission: `wallet:transferNative`
54
+
55
+ ```typescript
56
+ executeCall(
57
+ call: ExecuteCall,
58
+ overrides?: GasOverrides
59
+ ): Promise<UserOperationReceipt>
60
+ ```
61
+ Execute an arbitrary contract call. Permission: `wallet:executeCall`
62
+
63
+ ```typescript
64
+ executeBatchCall(
65
+ calls: ExecuteCall[],
66
+ overrides?: GasOverrides
67
+ ): Promise<UserOperationReceipt>
68
+ ```
69
+ Execute multiple calls atomically in a single transaction. Permission: `wallet:executeBatchCall`
70
+
71
+ ```typescript
72
+ transferFrontierDollar(
73
+ to: string,
74
+ amount: bigint,
75
+ overrides?: GasOverrides
76
+ ): Promise<UserOperationReceipt>
77
+ ```
78
+ Transfer FND (Frontier Network Dollar). Amount in base units — build with `parseAmount('10.5')` from `@frontiertower/frontier-sdk`. Permission: `wallet:transferFrontierDollar`
79
+
80
+ ```typescript
81
+ transferInternalFrontierDollar(
82
+ to: string,
83
+ amount: bigint,
84
+ overrides?: GasOverrides
85
+ ): Promise<UserOperationReceipt>
86
+ ```
87
+ Transfer iFND (Internal Frontier Network Dollar). Amount in base units — build with `parseAmount('10.5')` from `@frontiertower/frontier-sdk`. Permission: `wallet:transferInternalFrontierDollar`
88
+
89
+ ```typescript
90
+ transferOverallFrontierDollar(
91
+ to: string,
92
+ amount: bigint,
93
+ overrides?: GasOverrides
94
+ ): Promise<UserOperationReceipt>
95
+ ```
96
+ Transfer using iFND first, falling back to FND for the remainder. Permission: `wallet:transferOverallFrontierDollar`
97
+
98
+ ```typescript
99
+ getSupportedTokens(): Promise<string[]>
100
+ ```
101
+ Returns token symbols supported for swaps on the current chain (e.g. `['FND', 'USDC', 'WETH']`). Permission: `wallet:getSupportedTokens`
102
+
103
+ ```typescript
104
+ swap(
105
+ sourceToken: string,
106
+ targetToken: string,
107
+ sourceNetwork: string,
108
+ targetNetwork: string,
109
+ amount: bigint
110
+ ): Promise<SwapResult>
111
+ ```
112
+ Execute a token swap (same-chain or cross-chain). Amount in base units — build with `parseAmount('10.5')` from `@frontiertower/frontier-sdk`. Permission: `wallet:swap`
113
+
114
+ ```typescript
115
+ quoteSwap(
116
+ sourceToken: string,
117
+ targetToken: string,
118
+ sourceNetwork: string,
119
+ targetNetwork: string,
120
+ amount: bigint
121
+ ): Promise<SwapQuote>
122
+ ```
123
+ Get a swap quote without executing. Permission: `wallet:quoteSwap`
124
+
125
+ ```typescript
126
+ getUsdDepositInstructions(): Promise<OnRampResponse<UsdDepositInstructions>>
127
+ ```
128
+ Get US bank details for fiat-to-crypto on-ramp. Requires approved KYC. Permission: `wallet:getUsdDepositInstructions`
129
+
130
+ ```typescript
131
+ getEurDepositInstructions(): Promise<OnRampResponse<EurDepositInstructions>>
132
+ ```
133
+ Get SEPA bank details for EUR fiat-to-crypto on-ramp. Requires approved KYC. Permission: `wallet:getEurDepositInstructions`
134
+
135
+ ```typescript
136
+ getLinkedBanks(): Promise<LinkedBanksResponse>
137
+ ```
138
+ Get all linked bank accounts for off-ramp withdrawals. Requires approved KYC. Permission: `wallet:getLinkedBanks`
139
+
140
+ ```typescript
141
+ linkUsBankAccount(
142
+ accountOwnerName: string,
143
+ bankName: string,
144
+ routingNumber: string,
145
+ accountNumber: string,
146
+ checkingOrSavings: 'checking' | 'savings',
147
+ address: BillingAddress
148
+ ): Promise<LinkBankResponse>
149
+ ```
150
+ Link a US bank account for USD withdrawals via ACH. Requires approved KYC. Permission: `wallet:linkUsBankAccount`
151
+
152
+ ```typescript
153
+ linkEuroAccount(
154
+ accountOwnerName: string,
155
+ accountOwnerType: AccountOwnerType,
156
+ firstName: string,
157
+ lastName: string,
158
+ ibanAccountNumber: string,
159
+ bic?: string
160
+ ): Promise<LinkBankResponse>
161
+ ```
162
+ Link a EUR/IBAN bank account for SEPA withdrawals. Requires approved KYC. Permission: `wallet:linkEuroAccount`
163
+
164
+ ```typescript
165
+ deleteLinkedBank(bankId: string): Promise<void>
166
+ ```
167
+ Delete a linked bank account. Permission: `wallet:deleteLinkedBank`
168
+
169
+ ```typescript
170
+ getDeprecatedSmartAccounts(): Promise<DeprecatedSmartAccount[]>
171
+ ```
172
+ Get deprecated smart accounts that still have active gas sponsorship. Permission: `wallet:getDeprecatedSmartAccounts`
173
+
174
+ ---
175
+
176
+ ## Types
177
+
178
+ ```typescript
179
+ interface SmartAccount {
180
+ id: number;
181
+ ownerAddress: string;
182
+ contractAddress: string | null;
183
+ network: string;
184
+ status: string;
185
+ deploymentTransactionHash: string;
186
+ createdAt: string;
187
+ }
188
+
189
+ interface WalletBalance {
190
+ total: bigint;
191
+ fnd: bigint;
192
+ internalFnd: bigint;
193
+ }
194
+
195
+ interface UserOperationReceipt {
196
+ userOpHash: string;
197
+ transactionHash: string;
198
+ blockNumber: bigint;
199
+ success: boolean;
200
+ }
201
+
202
+ interface GasOverrides {
203
+ maxFeePerGas?: bigint;
204
+ maxPriorityFeePerGas?: bigint;
205
+ gasLimit?: bigint;
206
+ }
207
+
208
+ interface ExecuteCall {
209
+ target: string;
210
+ value?: bigint;
211
+ data: string;
212
+ }
213
+
214
+ interface SwapParams {
215
+ sourceToken: string;
216
+ targetToken: string;
217
+ sourceNetwork: string;
218
+ targetNetwork: string;
219
+ amount: bigint;
220
+ }
221
+
222
+ enum SwapResultStatus {
223
+ COMPLETED = 'COMPLETED',
224
+ SUBMITTED = 'SUBMITTED',
225
+ }
226
+
227
+ interface SwapResult {
228
+ sourceChain: object;
229
+ targetChain: object;
230
+ sourceToken: object;
231
+ targetToken: object;
232
+ status: SwapResultStatus;
233
+ }
234
+
235
+ interface SwapQuote {
236
+ sourceChain: object;
237
+ targetChain: object;
238
+ sourceToken: object;
239
+ targetToken: object;
240
+ expectedAmountOut: bigint;
241
+ minAmountOut: bigint;
242
+ }
243
+
244
+ interface UsdDepositInstructions {
245
+ currency: 'usd';
246
+ bankName: string;
247
+ bankAddress: string;
248
+ bankRoutingNumber: string;
249
+ bankAccountNumber: string;
250
+ bankBeneficiaryName: string;
251
+ paymentRail: string;
252
+ }
253
+
254
+ interface EurDepositInstructions {
255
+ currency: 'eur';
256
+ iban: string;
257
+ bic: string;
258
+ accountHolderName: string;
259
+ }
260
+
261
+ interface OnRampResponse<T = UsdDepositInstructions | EurDepositInstructions> {
262
+ currency: 'usd' | 'eur';
263
+ depositInstructions: T;
264
+ destinationAddress: string;
265
+ destinationNetwork: string;
266
+ }
267
+
268
+ interface LinkedBank {
269
+ id: string;
270
+ bankName: string;
271
+ last4: string;
272
+ withdrawalAddress: string;
273
+ network: string;
274
+ }
275
+
276
+ interface LinkedBanksResponse {
277
+ banks: LinkedBank[];
278
+ }
279
+
280
+ interface LinkBankResponse {
281
+ externalAccountId: string;
282
+ bankName: string;
283
+ withdrawalAddress: string;
284
+ network: string;
285
+ }
286
+
287
+ interface BillingAddress {
288
+ streetLine1: string;
289
+ streetLine2?: string;
290
+ city: string;
291
+ state: string;
292
+ postalCode: string;
293
+ country: string;
294
+ }
295
+
296
+ type AccountOwnerType = 'individual' | 'business';
297
+
298
+ interface DeprecatedSmartAccount {
299
+ id: number;
300
+ ownerAddress: string;
301
+ contractAddress: string;
302
+ network: string;
303
+ deprecatedAt: string;
304
+ version: number;
305
+ }
306
+ ```
307
+
308
+ ---
309
+
310
+ ## Permissions (21)
311
+
312
+ | Permission | Description |
313
+ |---|---|
314
+ | `wallet:getBalance` | Access wallet balance (raw bigint) |
315
+ | `wallet:getAddress` | Access wallet address |
316
+ | `wallet:getSmartAccount` | Access smart account details |
317
+ | `wallet:transferERC20` | Transfer ERC20 tokens |
318
+ | `wallet:approveERC20` | Approve ERC20 token spending |
319
+ | `wallet:transferNative` | Transfer native currency (ETH) |
320
+ | `wallet:transferFrontierDollar` | Transfer FND (Frontier Network Dollar) |
321
+ | `wallet:transferInternalFrontierDollar` | Transfer iFND (Internal Frontier Network Dollar) |
322
+ | `wallet:transferOverallFrontierDollar` | Transfer using iFND first, fallback to FND |
323
+ | `wallet:executeCall` | Execute arbitrary contract call |
324
+ | `wallet:executeBatchCall` | Execute multiple contract calls atomically |
325
+ | `wallet:getSupportedTokens` | Get supported token symbols for swaps |
326
+ | `wallet:swap` | Execute token swap (same-chain or cross-chain) |
327
+ | `wallet:quoteSwap` | Get swap quote without executing |
328
+ | `wallet:getUsdDepositInstructions` | Get USD bank deposit instructions (on-ramp) |
329
+ | `wallet:getEurDepositInstructions` | Get EUR/SEPA deposit instructions (on-ramp) |
330
+ | `wallet:getLinkedBanks` | Get linked bank accounts (off-ramp) |
331
+ | `wallet:linkUsBankAccount` | Link US bank account for USD withdrawals |
332
+ | `wallet:linkEuroAccount` | Link EUR/IBAN bank account for EUR withdrawals |
333
+ | `wallet:deleteLinkedBank` | Delete a linked bank account |
334
+ | `wallet:getDeprecatedSmartAccounts` | Get deprecated smart accounts with active gas sponsorship |