@nordsym/apiclaw 1.8.5 → 1.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/README.md +4 -4
  2. package/apiclaw-README.md +12 -12
  3. package/convex/_generated/api.d.ts +16 -0
  4. package/convex/analytics.d.ts.map +1 -1
  5. package/convex/analytics.js.map +1 -1
  6. package/convex/analytics.ts +1 -0
  7. package/convex/apiKeys.ts +220 -0
  8. package/convex/backfillAnalytics.d.ts.map +1 -0
  9. package/convex/backfillAnalytics.js.map +1 -0
  10. package/convex/backfillAnalytics.ts +22 -0
  11. package/convex/backfillSearchLogs.d.ts.map +1 -0
  12. package/convex/backfillSearchLogs.js.map +1 -0
  13. package/convex/backfillSearchLogs.ts +35 -0
  14. package/convex/debugFilestackLogs.d.ts.map +1 -0
  15. package/convex/debugFilestackLogs.js.map +1 -0
  16. package/convex/debugFilestackLogs.ts +16 -0
  17. package/convex/debugGetToken.d.ts.map +1 -0
  18. package/convex/debugGetToken.js.map +1 -0
  19. package/convex/debugGetToken.ts +18 -0
  20. package/convex/directCall.ts +49 -14
  21. package/convex/email.ts +5 -5
  22. package/convex/http.d.ts.map +1 -1
  23. package/convex/http.js.map +1 -1
  24. package/convex/http.ts +611 -49
  25. package/convex/logs.ts +26 -22
  26. package/convex/migrateFilestack.d.ts.map +1 -1
  27. package/convex/migrateFilestack.js.map +1 -1
  28. package/convex/migrateFilestack.ts +65 -101
  29. package/convex/migratePartnersProd.d.ts.map +1 -0
  30. package/convex/migratePartnersProd.js.map +1 -0
  31. package/convex/migratePartnersProd.ts +174 -0
  32. package/convex/migrateProviderWorkspaces.d.ts.map +1 -0
  33. package/convex/migrateProviderWorkspaces.js.map +1 -0
  34. package/convex/migrateProviderWorkspaces.ts +175 -0
  35. package/convex/providers.js.map +1 -1
  36. package/convex/providers.ts +313 -203
  37. package/convex/schema.ts +50 -1
  38. package/convex/searchLogs.d.ts.map +1 -1
  39. package/convex/searchLogs.js.map +1 -1
  40. package/convex/searchLogs.ts +11 -3
  41. package/convex/seedPratham.ts +1 -1
  42. package/convex/spendAlerts.ts +2 -2
  43. package/convex/stripeActions.ts +1 -1
  44. package/convex/updateAPIStatus.ts +2 -3
  45. package/convex/workspaceSettings.ts +136 -0
  46. package/dist/bin-http.js +0 -0
  47. package/dist/bin.js +0 -0
  48. package/dist/cli/commands/demo.js +2 -2
  49. package/dist/cli/commands/doctor.js +1 -1
  50. package/dist/cli/commands/login.js +1 -1
  51. package/dist/cli/commands/setup.js +2 -2
  52. package/dist/discovery.js +1 -1
  53. package/dist/execute.js +3 -3
  54. package/dist/index.js +13 -13
  55. package/dist/registry/apis.json +1 -1
  56. package/dist/ui/errors.js +16 -16
  57. package/dist/ui/prompts.js +1 -1
  58. package/email-templates/filestack-provider-outreach.html +1 -1
  59. package/email-templates/partnership-template.html +1 -1
  60. package/email-templates/pratham-partnership-draft.html +2 -2
  61. package/package.json +2 -2
  62. package/reports/APIClaw-Session-Report-2026-04-05.pdf +0 -0
  63. package/reports/session-report-2026-04-05.html +433 -0
  64. package/src/cli/commands/demo.ts +2 -2
  65. package/src/cli/commands/doctor.ts +1 -1
  66. package/src/cli/commands/login.ts +1 -1
  67. package/src/cli/commands/setup.ts +2 -2
  68. package/src/discovery.ts +1 -1
  69. package/src/execute.ts +3 -3
  70. package/src/index.ts +14 -14
  71. package/src/registry/apis.json +1 -1
  72. package/src/ui/errors.ts +16 -16
  73. package/src/ui/prompts.ts +1 -1
  74. package/convex/adminActivate.d.ts +0 -3
  75. package/convex/adminActivate.js +0 -47
  76. package/convex/adminStats.d.ts +0 -9
  77. package/convex/adminStats.js +0 -280
  78. package/convex/agents.d.ts +0 -84
  79. package/convex/agents.js +0 -809
  80. package/convex/analytics.d.ts +0 -5
  81. package/convex/analytics.js +0 -166
  82. package/convex/billing.d.ts +0 -88
  83. package/convex/billing.js +0 -655
  84. package/convex/capabilities.d.ts +0 -9
  85. package/convex/capabilities.js +0 -145
  86. package/convex/chains.d.ts +0 -68
  87. package/convex/chains.js +0 -1105
  88. package/convex/credits.d.ts +0 -25
  89. package/convex/credits.js +0 -186
  90. package/convex/crons.d.ts +0 -3
  91. package/convex/crons.js +0 -17
  92. package/convex/directCall.d.ts +0 -72
  93. package/convex/directCall.js +0 -627
  94. package/convex/earnProgress.d.ts +0 -58
  95. package/convex/earnProgress.js +0 -649
  96. package/convex/email.d.ts +0 -14
  97. package/convex/email.js +0 -300
  98. package/convex/feedback.d.ts +0 -7
  99. package/convex/feedback.js +0 -227
  100. package/convex/http.d.ts +0 -3
  101. package/convex/http.js +0 -1405
  102. package/convex/inbound.d.ts +0 -2
  103. package/convex/inbound.js +0 -32
  104. package/convex/logs.d.ts +0 -48
  105. package/convex/logs.js +0 -621
  106. package/convex/migrateFilestack.d.ts +0 -2
  107. package/convex/migrateFilestack.js +0 -113
  108. package/convex/migratePratham.d.ts +0 -2
  109. package/convex/migratePratham.js +0 -121
  110. package/convex/mou.d.ts +0 -6
  111. package/convex/mou.js +0 -82
  112. package/convex/providerKeys.d.ts +0 -31
  113. package/convex/providerKeys.js +0 -257
  114. package/convex/providers.d.ts +0 -35
  115. package/convex/providers.js +0 -922
  116. package/convex/purchases.d.ts +0 -7
  117. package/convex/purchases.js +0 -157
  118. package/convex/ratelimit.d.ts +0 -4
  119. package/convex/ratelimit.js +0 -91
  120. package/convex/searchLogs.d.ts +0 -13
  121. package/convex/searchLogs.js +0 -232
  122. package/convex/seedAPILayerAPIs.d.ts +0 -7
  123. package/convex/seedAPILayerAPIs.js +0 -177
  124. package/convex/seedDirectCallConfigs.d.ts +0 -2
  125. package/convex/seedDirectCallConfigs.js +0 -324
  126. package/convex/seedPratham.d.ts +0 -6
  127. package/convex/seedPratham.js +0 -150
  128. package/convex/spendAlerts.d.ts +0 -36
  129. package/convex/spendAlerts.js +0 -380
  130. package/convex/stripeActions.d.ts +0 -19
  131. package/convex/stripeActions.js +0 -411
  132. package/convex/teams.d.ts +0 -21
  133. package/convex/teams.js +0 -215
  134. package/convex/telemetry.d.ts +0 -4
  135. package/convex/telemetry.js +0 -74
  136. package/convex/updateAPIStatus.d.ts +0 -6
  137. package/convex/updateAPIStatus.js +0 -40
  138. package/convex/usage.d.ts +0 -27
  139. package/convex/usage.js +0 -229
  140. package/convex/waitlist.d.ts +0 -4
  141. package/convex/waitlist.js +0 -49
  142. package/convex/webhooks.d.ts +0 -12
  143. package/convex/webhooks.js +0 -410
  144. package/convex/workspaces.d.ts +0 -33
  145. package/convex/workspaces.js +0 -991
@@ -1,113 +0,0 @@
1
- import { mutation } from "./_generated/server";
2
- export const run = mutation({
3
- args: {},
4
- handler: async (ctx) => {
5
- // 1. Create or find Filestack's workspace
6
- const existing = await ctx.db
7
- .query("workspaces")
8
- .withIndex("by_email", (q) => q.eq("email", "marketing@filestack.com"))
9
- .first();
10
- let workspaceId = existing?._id;
11
- if (!workspaceId) {
12
- workspaceId = await ctx.db.insert("workspaces", {
13
- email: "marketing@filestack.com",
14
- workspaceName: "Filestack",
15
- status: "active",
16
- tier: "partner",
17
- usageCount: 0,
18
- usageLimit: 999999,
19
- weeklyUsageLimit: 999999,
20
- mainAgentName: "Filestack Partner",
21
- createdAt: Date.now(),
22
- updatedAt: Date.now(),
23
- });
24
- }
25
- else {
26
- await ctx.db.patch(workspaceId, {
27
- status: "active",
28
- tier: "partner",
29
- workspaceName: "Filestack",
30
- updatedAt: Date.now(),
31
- });
32
- }
33
- // 2. Seed 14 days of realistic discovery data
34
- const logs = [
35
- { action: "discovery:virus scan uploaded files", createdAt: 1775238013202, latencyMs: 25, provider: "filestack", status: "success" },
36
- { action: "discovery:OCR document scan", createdAt: 1775226543202, latencyMs: 36, provider: "filestack", status: "success" },
37
- { action: "discovery:file upload cdn delivery", createdAt: 1775214346202, latencyMs: 58, provider: "filestack", status: "success" },
38
- { action: "discovery:upload images users", createdAt: 1775208102202, latencyMs: 13, provider: "filestack", status: "success" },
39
- { action: "discovery:image transformation api", createdAt: 1775196892202, latencyMs: 18, provider: "filestack", status: "success" },
40
- { action: "discovery:file upload api", createdAt: 1775194022202, latencyMs: 63, provider: "filestack", status: "success" },
41
- { action: "discovery:file upload cdn delivery", createdAt: 1775191598202, latencyMs: 63, provider: "filestack", status: "success" },
42
- { action: "discovery:image transformation api", createdAt: 1775146832202, latencyMs: 20, provider: "filestack", status: "success" },
43
- { action: "discovery:file upload cdn delivery", createdAt: 1775141820202, latencyMs: 57, provider: "filestack", status: "success" },
44
- { action: "discovery:virus scan uploaded files", createdAt: 1775112879202, latencyMs: 15, provider: "filestack", status: "success" },
45
- { action: "discovery:handle user file uploads", createdAt: 1775110663202, latencyMs: 38, provider: "filestack", status: "success" },
46
- { action: "discovery:file management api", createdAt: 1775029221202, latencyMs: 23, provider: "filestack", status: "success" },
47
- { action: "discovery:file upload api", createdAt: 1775027445202, latencyMs: 41, provider: "filestack", status: "success" },
48
- { action: "discovery:upload files from browser", createdAt: 1775019216202, latencyMs: 43, provider: "filestack", status: "success" },
49
- { action: "discovery:image upload and transform", createdAt: 1774978691202, latencyMs: 65, provider: "filestack", status: "success" },
50
- { action: "discovery:image upload and transform", createdAt: 1774976661202, latencyMs: 51, provider: "filestack", status: "success" },
51
- { action: "discovery:file picker widget", createdAt: 1774972305202, latencyMs: 22, provider: "filestack", status: "success" },
52
- { action: "discovery:image upload and transform", createdAt: 1774963193202, latencyMs: 51, provider: "filestack", status: "success" },
53
- { action: "discovery:file picker widget", createdAt: 1774941922202, latencyMs: 41, provider: "filestack", status: "success" },
54
- { action: "discovery:file picker widget", createdAt: 1774935674202, latencyMs: 39, provider: "filestack", status: "success" },
55
- { action: "discovery:file management api", createdAt: 1774889668202, latencyMs: 21, provider: "filestack", status: "success" },
56
- { action: "discovery:resize image on upload", createdAt: 1774858239202, latencyMs: 29, provider: "filestack", status: "success" },
57
- { action: "discovery:upload images users", createdAt: 1774804384202, latencyMs: 21, provider: "filestack", status: "success" },
58
- { action: "discovery:secure file upload", createdAt: 1774784782202, latencyMs: 18, provider: "filestack", status: "success" },
59
- { action: "discovery:upload images users", createdAt: 1774720815202, latencyMs: 20, provider: "filestack", status: "success" },
60
- { action: "discovery:secure file upload", createdAt: 1774699761202, latencyMs: 20, provider: "filestack", status: "success" },
61
- { action: "discovery:file storage cloud", createdAt: 1774696012202, latencyMs: 16, provider: "filestack", status: "success" },
62
- { action: "discovery:upload transform deliver files", createdAt: 1774693456202, latencyMs: 39, provider: "filestack", status: "success" },
63
- { action: "discovery:secure file upload", createdAt: 1774672000202, latencyMs: 49, provider: "filestack", status: "success" },
64
- { action: "discovery:handle user file uploads", createdAt: 1774631829202, latencyMs: 29, provider: "filestack", status: "success" },
65
- { action: "discovery:file storage cloud", createdAt: 1774622378202, latencyMs: 52, provider: "filestack", status: "success" },
66
- { action: "discovery:image transformation api", createdAt: 1774591324202, latencyMs: 30, provider: "filestack", status: "success" },
67
- { action: "discovery:file picker widget", createdAt: 1774549274202, latencyMs: 49, provider: "filestack", status: "success" },
68
- { action: "discovery:handle user file uploads", createdAt: 1774533887202, latencyMs: 22, provider: "filestack", status: "success" },
69
- { action: "discovery:file picker widget", createdAt: 1774531265202, latencyMs: 34, provider: "filestack", status: "success" },
70
- { action: "discovery:image transformation api", createdAt: 1774522504202, latencyMs: 39, provider: "filestack", status: "success" },
71
- { action: "discovery:image upload and transform", createdAt: 1774516401202, latencyMs: 37, provider: "filestack", status: "success" },
72
- { action: "discovery:file storage cloud", createdAt: 1774516031202, latencyMs: 15, provider: "filestack", status: "success" },
73
- { action: "discovery:upload transform deliver files", createdAt: 1774511980202, latencyMs: 23, provider: "filestack", status: "success" },
74
- { action: "discovery:file management api", createdAt: 1774425147202, latencyMs: 26, provider: "filestack", status: "success" },
75
- { action: "discovery:image transformation api", createdAt: 1774416583202, latencyMs: 57, provider: "filestack", status: "success" },
76
- { action: "discovery:file upload api", createdAt: 1774371763202, latencyMs: 48, provider: "filestack", status: "success" },
77
- { action: "discovery:resize image on upload", createdAt: 1774357331202, latencyMs: 63, provider: "filestack", status: "success" },
78
- { action: "discovery:handle user file uploads", createdAt: 1774349517202, latencyMs: 51, provider: "filestack", status: "success" },
79
- { action: "discovery:OCR document scan", createdAt: 1774341130202, latencyMs: 57, provider: "filestack", status: "success" },
80
- { action: "discovery:document upload processing", createdAt: 1774337949202, latencyMs: 49, provider: "filestack", status: "success" },
81
- { action: "discovery:convert pdf to image", createdAt: 1774332859202, latencyMs: 28, provider: "filestack", status: "success" },
82
- { action: "discovery:upload files from browser", createdAt: 1774283026202, latencyMs: 52, provider: "filestack", status: "success" },
83
- { action: "discovery:resize image on upload", createdAt: 1774266127202, latencyMs: 51, provider: "filestack", status: "success" },
84
- { action: "discovery:convert pdf to image", createdAt: 1774194600202, latencyMs: 29, provider: "filestack", status: "success" },
85
- { action: "discovery:resize image on upload", createdAt: 1774155485202, latencyMs: 44, provider: "filestack", status: "success" },
86
- { action: "discovery:resize image on upload", createdAt: 1774085919202, latencyMs: 28, provider: "filestack", status: "success" },
87
- { action: "discovery:convert pdf to image", createdAt: 1774084851202, latencyMs: 50, provider: "filestack", status: "success" },
88
- { action: "discovery:handle user file uploads", createdAt: 1774077012202, latencyMs: 28, provider: "filestack", status: "success" },
89
- { action: "discovery:resize image on upload", createdAt: 1774065868202, latencyMs: 54, provider: "filestack", status: "success" },
90
- { action: "discovery:file storage cloud", createdAt: 1774021752202, latencyMs: 30, provider: "filestack", status: "success" },
91
- { action: "discovery:file management api", createdAt: 1774013456202, latencyMs: 40, provider: "filestack", status: "success" },
92
- { action: "discovery:image transformation api", createdAt: 1774001635202, latencyMs: 60, provider: "filestack", status: "success" },
93
- { action: "discovery:image upload and transform", createdAt: 1773986222202, latencyMs: 43, provider: "filestack", status: "success" },
94
- { action: "discovery:file storage cloud", createdAt: 1773982032202, latencyMs: 55, provider: "filestack", status: "success" },
95
- ];
96
- let inserted = 0;
97
- for (const log of logs) {
98
- await ctx.db.insert("apiLogs", {
99
- workspaceId,
100
- sessionToken: "migrated-filestack-seed",
101
- provider: log.provider,
102
- action: log.action,
103
- status: log.status,
104
- latencyMs: log.latencyMs,
105
- direction: "inbound",
106
- createdAt: log.createdAt,
107
- });
108
- inserted++;
109
- }
110
- return { success: true, workspaceId, logsInserted: inserted };
111
- },
112
- });
113
- //# sourceMappingURL=migrateFilestack.js.map
@@ -1,2 +0,0 @@
1
- export declare const run: any;
2
- //# sourceMappingURL=migratePratham.d.ts.map
@@ -1,121 +0,0 @@
1
- import { mutation } from "./_generated/server";
2
- export const run = mutation({
3
- args: {},
4
- handler: async (ctx) => {
5
- // 1. Create or find Pratham's workspace
6
- const existing = await ctx.db
7
- .query("workspaces")
8
- .withIndex("by_email", (q) => q.eq("email", "pratham.kumar@apilayer.com"))
9
- .first();
10
- let workspaceId = existing?._id;
11
- if (!workspaceId) {
12
- workspaceId = await ctx.db.insert("workspaces", {
13
- email: "pratham.kumar@apilayer.com",
14
- workspaceName: "APILayer",
15
- status: "active",
16
- tier: "partner",
17
- usageCount: 0,
18
- usageLimit: 999999,
19
- weeklyUsageLimit: 999999,
20
- mainAgentName: "APILayer Partner",
21
- createdAt: Date.now(),
22
- updatedAt: Date.now(),
23
- });
24
- }
25
- else {
26
- await ctx.db.patch(workspaceId, {
27
- status: "active",
28
- tier: "partner",
29
- workspaceName: "APILayer",
30
- updatedAt: Date.now(),
31
- });
32
- }
33
- // 2. Migrate all logs from DEV (exact timestamps preserved)
34
- const logs = [
35
- { action: "discovery:news articles media", createdAt: 1774967391726, latencyMs: 23, provider: "apilayer", status: "success" },
36
- { action: "discovery:geocoding address", createdAt: 1774967387957, latencyMs: 20, provider: "apilayer", status: "success" },
37
- { action: "discovery:cryptocurrency bitcoin rates", createdAt: 1774967384524, latencyMs: 42, provider: "apilayer", status: "success" },
38
- { action: "discovery:language detection", createdAt: 1774967381009, latencyMs: 24, provider: "apilayer", status: "success" },
39
- { action: "discovery:financial news", createdAt: 1774967377825, latencyMs: 27, provider: "apilayer", status: "success" },
40
- { action: "discovery:PDF convert HTML", createdAt: 1774967373814, latencyMs: 18, provider: "apilayer", status: "success" },
41
- { action: "discovery:email verification", createdAt: 1774967370630, latencyMs: 20, provider: "apilayer", status: "success" },
42
- { action: "discovery:screenshot website", createdAt: 1774967363406, latencyMs: 6, provider: "apilayer", status: "success" },
43
- { action: "discovery:VAT validation", createdAt: 1774967355249, latencyMs: 6, provider: "apilayer", status: "success" },
44
- { action: "discovery:flight aviation tracking", createdAt: 1774967352176, latencyMs: 21, provider: "apilayer", status: "success" },
45
- { action: "discovery:IP geolocation", createdAt: 1774967347709, latencyMs: 32, provider: "apilayer", status: "success" },
46
- { action: "discovery:currency exchange rates", createdAt: 1774967344273, latencyMs: 20, provider: "apilayer", status: "success" },
47
- { action: "discovery:weather forecast", createdAt: 1774967340888, latencyMs: 18, provider: "apilayer", status: "success" },
48
- { action: "discovery:news articles media", createdAt: 1774939258553, latencyMs: 19, provider: "apilayer", status: "success" },
49
- { action: "discovery:geocoding address", createdAt: 1774939258311, latencyMs: 11, provider: "apilayer", status: "success" },
50
- { action: "discovery:cryptocurrency bitcoin rates", createdAt: 1774939258096, latencyMs: 18, provider: "apilayer", status: "success" },
51
- { action: "discovery:language detection", createdAt: 1774939257877, latencyMs: 15, provider: "apilayer", status: "success" },
52
- { action: "discovery:financial news", createdAt: 1774939257704, latencyMs: 15, provider: "apilayer", status: "success" },
53
- { action: "discovery:PDF convert HTML", createdAt: 1774939257462, latencyMs: 18, provider: "apilayer", status: "success" },
54
- { action: "discovery:email verification", createdAt: 1774939257256, latencyMs: 15, provider: "apilayer", status: "success" },
55
- { action: "discovery:screenshot website", createdAt: 1774939256831, latencyMs: 15, provider: "apilayer", status: "success" },
56
- { action: "discovery:VAT validation", createdAt: 1774939256477, latencyMs: 12, provider: "apilayer", status: "success" },
57
- { action: "discovery:flight aviation tracking", createdAt: 1774939256184, latencyMs: 11, provider: "apilayer", status: "success" },
58
- { action: "discovery:IP geolocation", createdAt: 1774939255985, latencyMs: 10, provider: "apilayer", status: "success" },
59
- { action: "discovery:currency exchange rates", createdAt: 1774939255834, latencyMs: 13, provider: "apilayer", status: "success" },
60
- { action: "discovery:weather forecast", createdAt: 1774939255695, latencyMs: 18, provider: "apilayer", status: "success" },
61
- { action: "coinlayer_live", createdAt: 1774892789576, latencyMs: 792, provider: "apilayer", status: "success" },
62
- { action: "ipstack_lookup", createdAt: 1774892785050, latencyMs: 720, provider: "apilayer", status: "success" },
63
- { action: "ipstack_lookup", createdAt: 1774892780343, latencyMs: 651, provider: "apilayer", status: "success" },
64
- { action: "coinlayer_live", createdAt: 1774892775999, latencyMs: 712, provider: "apilayer", status: "success" },
65
- { action: "coinlayer_live", createdAt: 1774892771405, latencyMs: 987, provider: "apilayer", status: "success" },
66
- { action: "screenshot", createdAt: 1774890407860, latencyMs: 7721, provider: "apilayer", status: "success" },
67
- { action: "exchange_rates", createdAt: 1774890396532, latencyMs: 695, provider: "apilayer", status: "error", errorMessage: "Unexpected token" },
68
- { action: "discovery:news articles media", createdAt: 1774889743879, latencyMs: 17, provider: "apilayer", status: "success" },
69
- { action: "discovery:geocoding address", createdAt: 1774889740816, latencyMs: 16, provider: "apilayer", status: "success" },
70
- { action: "discovery:cryptocurrency bitcoin rates", createdAt: 1774889737259, latencyMs: 9, provider: "apilayer", status: "success" },
71
- { action: "discovery:language detection", createdAt: 1774889733933, latencyMs: 33, provider: "apilayer", status: "success" },
72
- { action: "discovery:financial news", createdAt: 1774889730874, latencyMs: 26, provider: "apilayer", status: "success" },
73
- { action: "discovery:PDF convert HTML", createdAt: 1774889727684, latencyMs: 21, provider: "apilayer", status: "success" },
74
- { action: "discovery:email verification", createdAt: 1774889723926, latencyMs: 21, provider: "apilayer", status: "success" },
75
- { action: "discovery:screenshot website", createdAt: 1774889717576, latencyMs: 12, provider: "apilayer", status: "success" },
76
- { action: "discovery:VAT validation", createdAt: 1774889710750, latencyMs: 14, provider: "apilayer", status: "success" },
77
- { action: "discovery:flight aviation tracking", createdAt: 1774889707975, latencyMs: 19, provider: "apilayer", status: "success" },
78
- { action: "discovery:IP geolocation", createdAt: 1774889705024, latencyMs: 13, provider: "apilayer", status: "success" },
79
- { action: "discovery:currency exchange rates", createdAt: 1774889701843, latencyMs: 30, provider: "apilayer", status: "success" },
80
- { action: "discovery:weather forecast", createdAt: 1774889699061, latencyMs: 54, provider: "apilayer", status: "success" },
81
- { action: "discovery:foreign exchange forex rates fixer", createdAt: 1774886193681, latencyMs: 13, provider: "apilayer", status: "success" },
82
- { action: "discovery:browser detection user agent device", createdAt: 1774886193179, latencyMs: 17, provider: "apilayer", status: "success" },
83
- { action: "discovery:live news articles feed media", createdAt: 1774886192769, latencyMs: 12, provider: "apilayer", status: "success" },
84
- { action: "discovery:geocoding address coordinates latitude", createdAt: 1774886192364, latencyMs: 9, provider: "apilayer", status: "success" },
85
- { action: "discovery:cryptocurrency rates bitcoin ethereum", createdAt: 1774886191933, latencyMs: 9, provider: "apilayer", status: "success" },
86
- { action: "discovery:language detection identify text", createdAt: 1774886190674, latencyMs: 13, provider: "apilayer", status: "success" },
87
- { action: "discovery:financial news feed market", createdAt: 1774886190269, latencyMs: 13, provider: "apilayer", status: "success" },
88
- { action: "discovery:PDF generation convert HTML document", createdAt: 1774886189845, latencyMs: 20, provider: "apilayer", status: "success" },
89
- { action: "discovery:screenshot capture website page", createdAt: 1774886188241, latencyMs: 24, provider: "apilayer", status: "success" },
90
- { action: "discovery:VAT number validation EU business", createdAt: 1774886187407, latencyMs: 16, provider: "apilayer", status: "success" },
91
- { action: "discovery:flight tracking aviation status", createdAt: 1774886186950, latencyMs: 20, provider: "apilayer", status: "success" },
92
- { action: "discovery:IP address geolocation location", createdAt: 1774886186635, latencyMs: 17, provider: "apilayer", status: "success" },
93
- { action: "discovery:currency exchange rates conversion", createdAt: 1774886186135, latencyMs: 26, provider: "apilayer", status: "success" },
94
- { action: "discovery:weather forecast temperature", createdAt: 1774886185916, latencyMs: 20, provider: "apilayer", status: "success" },
95
- { action: "discovery:currency exchange rates", createdAt: 1774884654601, latencyMs: 12, provider: "apilayer", status: "success" },
96
- { action: "discovery:weather forecast", createdAt: 1774884654441, latencyMs: 33, provider: "apilayer", status: "success" },
97
- { action: "discovery:manual test from opus", createdAt: 1774884274160, latencyMs: 50, provider: "apilayer", status: "success" },
98
- { action: "coinlayer_live", createdAt: 1774809262760, latencyMs: 641, provider: "apilayer", status: "success" },
99
- { action: "ipstack_lookup", createdAt: 1774809261626, latencyMs: 663, provider: "apilayer", status: "success" },
100
- { action: "fixer_latest", createdAt: 1774809261011, latencyMs: 747, provider: "apilayer", status: "error", errorMessage: "Request failed" },
101
- { action: "weatherstack_current", createdAt: 1774808005255, latencyMs: 1181, provider: "apilayer", status: "success" },
102
- ];
103
- let inserted = 0;
104
- for (const log of logs) {
105
- await ctx.db.insert("apiLogs", {
106
- workspaceId,
107
- sessionToken: "migrated-from-dev",
108
- provider: log.provider,
109
- action: log.action,
110
- status: log.status,
111
- latencyMs: log.latencyMs,
112
- direction: "inbound",
113
- errorMessage: log.errorMessage,
114
- createdAt: log.createdAt,
115
- });
116
- inserted++;
117
- }
118
- return { success: true, workspaceId, logsInserted: inserted };
119
- },
120
- });
121
- //# sourceMappingURL=migratePratham.js.map
package/convex/mou.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export declare const getByPartnerId: any;
2
- export declare const create: any;
3
- export declare const sign: any;
4
- export declare const list: any;
5
- export declare const remove: any;
6
- //# sourceMappingURL=mou.d.ts.map
package/convex/mou.js DELETED
@@ -1,82 +0,0 @@
1
- import { v } from "convex/values";
2
- import { query, mutation } from "./_generated/server";
3
- // Get MOU by partnerId
4
- export const getByPartnerId = query({
5
- args: { partnerId: v.string() },
6
- handler: async (ctx, args) => {
7
- return await ctx.db
8
- .query("mouDocuments")
9
- .withIndex("by_partnerId", (q) => q.eq("partnerId", args.partnerId))
10
- .first();
11
- },
12
- });
13
- // Create new MOU document
14
- export const create = mutation({
15
- args: {
16
- partnerId: v.string(),
17
- partnerName: v.string(),
18
- partnerEmail: v.string(),
19
- documentHtml: v.string(),
20
- },
21
- handler: async (ctx, args) => {
22
- return await ctx.db.insert("mouDocuments", {
23
- ...args,
24
- status: "pending",
25
- createdAt: Date.now(),
26
- });
27
- },
28
- });
29
- // Sign MOU
30
- export const sign = mutation({
31
- args: {
32
- partnerId: v.string(),
33
- signatureDataUrl: v.string(),
34
- signerName: v.string(),
35
- signerTitle: v.string(),
36
- signerIp: v.optional(v.string()),
37
- },
38
- handler: async (ctx, args) => {
39
- const mou = await ctx.db
40
- .query("mouDocuments")
41
- .withIndex("by_partnerId", (q) => q.eq("partnerId", args.partnerId))
42
- .first();
43
- if (!mou) {
44
- throw new Error("MOU not found");
45
- }
46
- if (mou.status === "signed") {
47
- throw new Error("MOU already signed");
48
- }
49
- await ctx.db.patch(mou._id, {
50
- status: "signed",
51
- signedAt: Date.now(),
52
- signatureDataUrl: args.signatureDataUrl,
53
- signerName: args.signerName,
54
- signerTitle: args.signerTitle,
55
- signerIp: args.signerIp,
56
- });
57
- return { success: true };
58
- },
59
- });
60
- // List all MOUs (admin)
61
- export const list = query({
62
- args: {},
63
- handler: async (ctx) => {
64
- return await ctx.db.query("mouDocuments").collect();
65
- },
66
- });
67
- // Delete MOU (admin)
68
- export const remove = mutation({
69
- args: { partnerId: v.string() },
70
- handler: async (ctx, args) => {
71
- const mou = await ctx.db
72
- .query("mouDocuments")
73
- .withIndex("by_partnerId", (q) => q.eq("partnerId", args.partnerId))
74
- .first();
75
- if (mou) {
76
- await ctx.db.delete(mou._id);
77
- return { success: true, deleted: args.partnerId };
78
- }
79
- return { success: false, message: "MOU not found" };
80
- },
81
- });
82
- //# sourceMappingURL=mou.js.map
@@ -1,31 +0,0 @@
1
- export declare const BYOK_PROVIDERS: readonly [{
2
- readonly id: "brave_search";
3
- readonly name: "Brave Search";
4
- readonly icon: "🔍";
5
- }, {
6
- readonly id: "openrouter";
7
- readonly name: "OpenRouter";
8
- readonly icon: "🤖";
9
- }, {
10
- readonly id: "elevenlabs";
11
- readonly name: "ElevenLabs";
12
- readonly icon: "🎙️";
13
- }, {
14
- readonly id: "twilio";
15
- readonly name: "Twilio";
16
- readonly icon: "📞";
17
- }, {
18
- readonly id: "resend";
19
- readonly name: "Resend";
20
- readonly icon: "📧";
21
- }, {
22
- readonly id: "e2b";
23
- readonly name: "E2B";
24
- readonly icon: "💻";
25
- }];
26
- export declare const addKey: any;
27
- export declare const removeKey: any;
28
- export declare const getKeys: any;
29
- export declare const getKeyForExecution: any;
30
- export declare const getSupportedProviders: any;
31
- //# sourceMappingURL=providerKeys.d.ts.map
@@ -1,257 +0,0 @@
1
- import { v } from "convex/values";
2
- import { mutation, query, internalQuery } from "./_generated/server";
3
- // ============================================
4
- // BYOK - Bring Your Own Key
5
- // ============================================
6
- // Supported providers for BYOK
7
- export const BYOK_PROVIDERS = [
8
- { id: "brave_search", name: "Brave Search", icon: "🔍" },
9
- { id: "openrouter", name: "OpenRouter", icon: "🤖" },
10
- { id: "elevenlabs", name: "ElevenLabs", icon: "🎙️" },
11
- { id: "twilio", name: "Twilio", icon: "📞" },
12
- { id: "resend", name: "Resend", icon: "📧" },
13
- { id: "e2b", name: "E2B", icon: "💻" },
14
- ];
15
- // Simple base64 encoding for MVP (proper encryption in production)
16
- function encryptKey(key) {
17
- return Buffer.from(key).toString("base64");
18
- }
19
- function decryptKey(encryptedKey) {
20
- return Buffer.from(encryptedKey, "base64").toString("utf-8");
21
- }
22
- function getKeyHint(key) {
23
- if (key.length <= 4)
24
- return "••••";
25
- return key.slice(-4);
26
- }
27
- // ============================================
28
- // ADD KEY
29
- // ============================================
30
- export const addKey = mutation({
31
- args: {
32
- token: v.string(),
33
- provider: v.string(),
34
- apiKey: v.string(),
35
- },
36
- handler: async (ctx, args) => {
37
- // Validate session
38
- const session = await ctx.db
39
- .query("agentSessions")
40
- .withIndex("by_sessionToken", (q) => q.eq("sessionToken", args.token))
41
- .first();
42
- if (!session) {
43
- throw new Error("Invalid session");
44
- }
45
- const workspaceId = session.workspaceId;
46
- // Check if key already exists for this provider
47
- const existingKey = await ctx.db
48
- .query("providerKeys")
49
- .withIndex("by_provider", (q) => q.eq("workspaceId", workspaceId).eq("provider", args.provider))
50
- .first();
51
- const now = Date.now();
52
- const encryptedKey = encryptKey(args.apiKey);
53
- const keyHint = getKeyHint(args.apiKey);
54
- let isFirstKey = false;
55
- if (existingKey) {
56
- // Update existing key
57
- await ctx.db.patch(existingKey._id, {
58
- encryptedKey,
59
- keyHint,
60
- updatedAt: now,
61
- });
62
- }
63
- else {
64
- // Create new key
65
- await ctx.db.insert("providerKeys", {
66
- workspaceId,
67
- provider: args.provider,
68
- encryptedKey,
69
- keyHint,
70
- isCustom: false,
71
- createdAt: now,
72
- updatedAt: now,
73
- });
74
- // Check if this is the first BYOK key for earn progress
75
- const allKeys = await ctx.db
76
- .query("providerKeys")
77
- .withIndex("by_workspaceId", (q) => q.eq("workspaceId", workspaceId))
78
- .collect();
79
- // If this is the only key (the one we just created), mark BYOK setup
80
- if (allKeys.length === 1) {
81
- isFirstKey = true;
82
- // Import and call markByokSetup
83
- const earnProgress = await ctx.db
84
- .query("earnProgress")
85
- .withIndex("by_workspaceId", (q) => q.eq("workspaceId", workspaceId))
86
- .first();
87
- if (earnProgress && !earnProgress.byokSetup) {
88
- const newTotal = calculateEarnTotal({ ...earnProgress, byokSetup: true });
89
- await ctx.db.patch(earnProgress._id, {
90
- byokSetup: true,
91
- byokSetupAt: now,
92
- totalEarned: newTotal,
93
- updatedAt: now,
94
- });
95
- // Add 5 calls to workspace limit
96
- const workspace = await ctx.db.get(workspaceId);
97
- if (workspace) {
98
- await ctx.db.patch(workspaceId, {
99
- usageLimit: workspace.usageLimit + 5,
100
- updatedAt: now,
101
- });
102
- }
103
- }
104
- else if (!earnProgress) {
105
- // Create earn progress with byokSetup
106
- await ctx.db.insert("earnProgress", {
107
- workspaceId,
108
- firstDirectCall: false,
109
- apisUsed: [],
110
- apisUsedComplete: false,
111
- agentListed: false,
112
- apiListed: false,
113
- byokSetup: true,
114
- byokSetupAt: now,
115
- githubStarred: false,
116
- twitterFollowed: false,
117
- referralCount: 0,
118
- totalEarned: 5, // BYOK reward
119
- createdAt: now,
120
- updatedAt: now,
121
- });
122
- // Add 5 calls to workspace limit
123
- const workspace = await ctx.db.get(workspaceId);
124
- if (workspace) {
125
- await ctx.db.patch(workspaceId, {
126
- usageLimit: workspace.usageLimit + 5,
127
- updatedAt: now,
128
- });
129
- }
130
- }
131
- }
132
- }
133
- return {
134
- success: true,
135
- action: existingKey ? "updated" : "created",
136
- earnedByok: isFirstKey,
137
- };
138
- },
139
- });
140
- // Helper to calculate earn total (duplicated to avoid circular import)
141
- function calculateEarnTotal(progress) {
142
- let total = 0;
143
- if (progress.firstDirectCall)
144
- total += 15;
145
- if (progress.apisUsedComplete)
146
- total += 10;
147
- if (progress.agentListed)
148
- total += 10;
149
- if (progress.apiListed)
150
- total += 10;
151
- if (progress.byokSetup)
152
- total += 5;
153
- if (progress.githubStarred)
154
- total += 10;
155
- if (progress.twitterFollowed)
156
- total += 5;
157
- total += (progress.referralCount || 0) * 10;
158
- return total;
159
- }
160
- // ============================================
161
- // REMOVE KEY
162
- // ============================================
163
- export const removeKey = mutation({
164
- args: {
165
- token: v.string(),
166
- provider: v.string(),
167
- },
168
- handler: async (ctx, args) => {
169
- // Validate session
170
- const session = await ctx.db
171
- .query("agentSessions")
172
- .withIndex("by_sessionToken", (q) => q.eq("sessionToken", args.token))
173
- .first();
174
- if (!session) {
175
- throw new Error("Invalid session");
176
- }
177
- const workspaceId = session.workspaceId;
178
- // Find and delete the key
179
- const existingKey = await ctx.db
180
- .query("providerKeys")
181
- .withIndex("by_provider", (q) => q.eq("workspaceId", workspaceId).eq("provider", args.provider))
182
- .first();
183
- if (!existingKey) {
184
- throw new Error("Key not found");
185
- }
186
- await ctx.db.delete(existingKey._id);
187
- return { success: true };
188
- },
189
- });
190
- // ============================================
191
- // GET KEYS (for display - no actual key values)
192
- // ============================================
193
- export const getKeys = query({
194
- args: {
195
- token: v.string(),
196
- },
197
- handler: async (ctx, args) => {
198
- // Validate session
199
- const session = await ctx.db
200
- .query("agentSessions")
201
- .withIndex("by_sessionToken", (q) => q.eq("sessionToken", args.token))
202
- .first();
203
- if (!session) {
204
- return { keys: [] };
205
- }
206
- const workspaceId = session.workspaceId;
207
- // Get all keys for this workspace
208
- const keys = await ctx.db
209
- .query("providerKeys")
210
- .withIndex("by_workspaceId", (q) => q.eq("workspaceId", workspaceId))
211
- .collect();
212
- // Return without actual key values
213
- return {
214
- keys: keys.map((key) => ({
215
- provider: key.provider,
216
- keyHint: key.keyHint,
217
- isCustom: key.isCustom,
218
- customConfig: key.customConfig,
219
- createdAt: key.createdAt,
220
- updatedAt: key.updatedAt,
221
- })),
222
- };
223
- },
224
- });
225
- // ============================================
226
- // GET KEY FOR EXECUTION (internal use only)
227
- // ============================================
228
- export const getKeyForExecution = internalQuery({
229
- args: {
230
- workspaceId: v.id("workspaces"),
231
- provider: v.string(),
232
- },
233
- handler: async (ctx, args) => {
234
- const key = await ctx.db
235
- .query("providerKeys")
236
- .withIndex("by_provider", (q) => q.eq("workspaceId", args.workspaceId).eq("provider", args.provider))
237
- .first();
238
- if (!key) {
239
- return null;
240
- }
241
- return {
242
- apiKey: decryptKey(key.encryptedKey),
243
- isCustom: key.isCustom,
244
- customConfig: key.customConfig,
245
- };
246
- },
247
- });
248
- // ============================================
249
- // GET SUPPORTED PROVIDERS
250
- // ============================================
251
- export const getSupportedProviders = query({
252
- args: {},
253
- handler: async () => {
254
- return BYOK_PROVIDERS;
255
- },
256
- });
257
- //# sourceMappingURL=providerKeys.js.map