fraim-hub 2.0.204

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 (120) hide show
  1. package/README.md +467 -0
  2. package/bin/fraim-hub.js +17 -0
  3. package/dist/src/ai-hub/brand-store.js +17 -0
  4. package/dist/src/ai-hub/catalog.js +412 -0
  5. package/dist/src/ai-hub/cert-store.js +70 -0
  6. package/dist/src/ai-hub/cli.js +212 -0
  7. package/dist/src/ai-hub/configured-agents.js +283 -0
  8. package/dist/src/ai-hub/conversation-store.js +428 -0
  9. package/dist/src/ai-hub/desktop-main.js +449 -0
  10. package/dist/src/ai-hub/hosts.js +1669 -0
  11. package/dist/src/ai-hub/hub-latest-version.js +52 -0
  12. package/dist/src/ai-hub/hub-launch-decision.js +57 -0
  13. package/dist/src/ai-hub/hub-runtime-file.js +43 -0
  14. package/dist/src/ai-hub/managed-browser.js +269 -0
  15. package/dist/src/ai-hub/manager-turns.js +64 -0
  16. package/dist/src/ai-hub/office-sideload.js +156 -0
  17. package/dist/src/ai-hub/openclaw-bridge.js +250 -0
  18. package/dist/src/ai-hub/preferences.js +201 -0
  19. package/dist/src/ai-hub/remote-hub-gateway.js +88 -0
  20. package/dist/src/ai-hub/server.js +4013 -0
  21. package/dist/src/ai-hub/types.js +2 -0
  22. package/dist/src/ai-hub/url-safety.js +19 -0
  23. package/dist/src/api/admin/payments.js +33 -0
  24. package/dist/src/api/admin/sales-leads.js +21 -0
  25. package/dist/src/api/payment/create-session.js +338 -0
  26. package/dist/src/api/payment/dashboard-link.js +149 -0
  27. package/dist/src/api/payment/session-details.js +31 -0
  28. package/dist/src/api/payment/webhook.js +587 -0
  29. package/dist/src/api/sales/contact.js +44 -0
  30. package/dist/src/cli/api/get-provider-client.js +41 -0
  31. package/dist/src/cli/api/provider-client.js +107 -0
  32. package/dist/src/cli/commands/add-ide.js +462 -0
  33. package/dist/src/cli/fraim-hub.js +50 -0
  34. package/dist/src/cli/internal/device-flow-service.js +83 -0
  35. package/dist/src/cli/mcp/command-resolution.js +81 -0
  36. package/dist/src/cli/mcp/fraim-mcp-latest-launcher.js +136 -0
  37. package/dist/src/cli/mcp/ide-formats.js +317 -0
  38. package/dist/src/cli/mcp/mcp-server-builder.js +48 -0
  39. package/dist/src/cli/mcp/mcp-server-registry.js +173 -0
  40. package/dist/src/cli/providers/local-provider-registry.js +165 -0
  41. package/dist/src/cli/providers/provider-registry.js +230 -0
  42. package/dist/src/cli/setup/claude-code-telemetry.js +59 -0
  43. package/dist/src/cli/setup/codex-local-config.js +37 -0
  44. package/dist/src/cli/setup/ide-detector.js +383 -0
  45. package/dist/src/cli/setup/ide-global-integration.js +100 -0
  46. package/dist/src/cli/setup/ide-invocation-surfaces.js +160 -0
  47. package/dist/src/cli/setup/mcp-config-generator.js +225 -0
  48. package/dist/src/cli/setup/provider-prompts.js +339 -0
  49. package/dist/src/cli/utils/managed-agent-paths.js +118 -0
  50. package/dist/src/cli/utils/script-sync-utils.js +221 -0
  51. package/dist/src/cli/utils/user-config.js +100 -0
  52. package/dist/src/cli/utils/version-utils.js +35 -0
  53. package/dist/src/config/ai-manager-hiring.js +121 -0
  54. package/dist/src/config/feature-flags.js +25 -0
  55. package/dist/src/config/persona-capability-bundles.js +277 -0
  56. package/dist/src/config/persona-hiring.js +270 -0
  57. package/dist/src/config/portfolio-slug-overrides.js +17 -0
  58. package/dist/src/config/pricing.js +37 -0
  59. package/dist/src/config/stripe.js +43 -0
  60. package/dist/src/core/brand-store.js +232 -0
  61. package/dist/src/core/quality-evidence.js +331 -0
  62. package/dist/src/core/utils/git-utils.js +194 -0
  63. package/dist/src/core/utils/ports.js +32 -0
  64. package/dist/src/core/utils/project-fraim-paths.js +220 -0
  65. package/dist/src/db/payment-repository.js +61 -0
  66. package/dist/src/first-run/types.js +93 -0
  67. package/dist/src/fraim/db-service.js +2409 -0
  68. package/dist/src/local-mcp-server/agent-token-prices.js +167 -0
  69. package/dist/src/local-mcp-server/learning-context-builder.js +975 -0
  70. package/dist/src/middleware/rate-limit.js +110 -0
  71. package/dist/src/models/payment.js +2 -0
  72. package/dist/src/routes/payment-routes.js +186 -0
  73. package/dist/src/routes/persona-catalog-routes.js +84 -0
  74. package/dist/src/services/dashboard-access.js +27 -0
  75. package/dist/src/services/email-service.js +951 -0
  76. package/dist/src/services/persona-entitlement-service.js +352 -0
  77. package/dist/src/services/workspace-identity.js +21 -0
  78. package/dist/src/types/analytics.js +2 -0
  79. package/dist/src/utils/payment-calculator.js +52 -0
  80. package/extensions/office-word/favicon.ico +0 -0
  81. package/extensions/office-word/icon-64.png +0 -0
  82. package/extensions/office-word/manifest.xml +33 -0
  83. package/extensions/office-word/taskpane.html +242 -0
  84. package/index.js +85 -0
  85. package/package.json +106 -0
  86. package/public/ai-hub/index.html +910 -0
  87. package/public/ai-hub/powerpoint-taskpane/icon-64.png +0 -0
  88. package/public/ai-hub/powerpoint-taskpane/index.html +236 -0
  89. package/public/ai-hub/powerpoint-taskpane/manifest.xml +30 -0
  90. package/public/ai-hub/review.css +444 -0
  91. package/public/ai-hub/script.js +11737 -0
  92. package/public/ai-hub/styles.css +5102 -0
  93. package/public/first-run/error-frame.js +100 -0
  94. package/public/first-run/index.html +35 -0
  95. package/public/first-run/script.js +739 -0
  96. package/public/first-run/styles.css +929 -0
  97. package/public/portfolio/ashley.html +523 -0
  98. package/public/portfolio/auditya.html +83 -0
  99. package/public/portfolio/banke.html +83 -0
  100. package/public/portfolio/beza.html +659 -0
  101. package/public/portfolio/careena.html +632 -0
  102. package/public/portfolio/casey.html +568 -0
  103. package/public/portfolio/celia.html +490 -0
  104. package/public/portfolio/deidre.html +642 -0
  105. package/public/portfolio/gautam.html +597 -0
  106. package/public/portfolio/hari.html +469 -0
  107. package/public/portfolio/huxley.html +1354 -0
  108. package/public/portfolio/index.html +741 -0
  109. package/public/portfolio/maestro.html +518 -0
  110. package/public/portfolio/mandy.html +590 -0
  111. package/public/portfolio/mona.html +597 -0
  112. package/public/portfolio/pam.html +887 -0
  113. package/public/portfolio/procella.html +107 -0
  114. package/public/portfolio/qasm.html +569 -0
  115. package/public/portfolio/ricardo.html +489 -0
  116. package/public/portfolio/sade.html +560 -0
  117. package/public/portfolio/sam.html +654 -0
  118. package/public/portfolio/sechar.html +580 -0
  119. package/public/portfolio/sreya.html +599 -0
  120. package/public/portfolio/swen.html +601 -0
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ /**
3
+ * Static price table for converting per-agent token counters to USD.
4
+ *
5
+ * Issue #330 / R1.3 / C4 (ISO 27001 A.5.31).
6
+ *
7
+ * Each entry MUST carry `source` (a citation pointing back to the vendor's
8
+ * published pricing page) and `verifiedOn` (an ISO date string). The
9
+ * `agent-token-prices.test.ts` lint fails CI if any entry exceeds 180 days
10
+ * since `verifiedOn` so this table is reviewed at least quarterly.
11
+ *
12
+ * Prices are USD per million tokens.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.AGENT_TOKEN_PRICES = void 0;
16
+ exports.lookupPrice = lookupPrice;
17
+ exports.computeCostUsd = computeCostUsd;
18
+ exports.AGENT_TOKEN_PRICES = [
19
+ // Anthropic — Claude (used by Claude Code).
20
+ // Note: when Claude Code emits cost via OTLP we read it directly; this
21
+ // table backstops cost computation for legacy/no-cost-metric snapshots
22
+ // and lets per-agent comparison panels report a model-attributed cost
23
+ // even when a snapshot lacks a costUsd field.
24
+ {
25
+ agent: 'claude-code',
26
+ model: 'claude-opus-4-7',
27
+ inputPerMTok: 15.00,
28
+ outputPerMTok: 75.00,
29
+ cacheReadPerMTok: 1.50,
30
+ cacheCreationPerMTok: 18.75,
31
+ source: 'https://www.anthropic.com/pricing',
32
+ verifiedOn: '2026-04-29',
33
+ },
34
+ {
35
+ agent: 'claude-code',
36
+ model: 'claude-sonnet-4-6',
37
+ inputPerMTok: 3.00,
38
+ outputPerMTok: 15.00,
39
+ cacheReadPerMTok: 0.30,
40
+ cacheCreationPerMTok: 3.75,
41
+ source: 'https://www.anthropic.com/pricing',
42
+ verifiedOn: '2026-04-29',
43
+ },
44
+ {
45
+ agent: 'claude-code',
46
+ model: 'claude-haiku-4-5',
47
+ inputPerMTok: 1.00,
48
+ outputPerMTok: 5.00,
49
+ cacheReadPerMTok: 0.10,
50
+ cacheCreationPerMTok: 1.25,
51
+ source: 'https://www.anthropic.com/pricing',
52
+ verifiedOn: '2026-04-29',
53
+ },
54
+ // OpenAI — GPT-5 Codex (used by Codex CLI).
55
+ {
56
+ agent: 'codex',
57
+ model: 'gpt-5-codex',
58
+ inputPerMTok: 5.00,
59
+ outputPerMTok: 15.00,
60
+ cacheReadPerMTok: 0.50,
61
+ cacheCreationPerMTok: 0,
62
+ source: 'https://openai.com/api/pricing/',
63
+ verifiedOn: '2026-04-29',
64
+ },
65
+ {
66
+ agent: 'codex',
67
+ model: 'gpt-5',
68
+ inputPerMTok: 5.00,
69
+ outputPerMTok: 15.00,
70
+ cacheReadPerMTok: 0.50,
71
+ cacheCreationPerMTok: 0,
72
+ source: 'https://openai.com/api/pricing/',
73
+ verifiedOn: '2026-04-29',
74
+ },
75
+ // Real Codex CLI 0.125.0 emits `gpt-5.5` on turn_context.payload.model.
76
+ // Treated as the gpt-5 family for pricing until OpenAI publishes a
77
+ // distinct rate card. Conservative estimate; refresh on next quarterly
78
+ // verification pass.
79
+ {
80
+ agent: 'codex',
81
+ model: 'gpt-5.5',
82
+ inputPerMTok: 5.00,
83
+ outputPerMTok: 15.00,
84
+ cacheReadPerMTok: 0.50,
85
+ cacheCreationPerMTok: 0,
86
+ source: 'https://openai.com/api/pricing/ (gpt-5 row, applied to gpt-5.5 as nearest published rate)',
87
+ verifiedOn: '2026-04-30',
88
+ },
89
+ // Google — Gemini CLI. Standard paid-tier text/image/video token rates.
90
+ // Context caching maps to cache reads; the published storage-hour price
91
+ // cannot be derived from the CLI token stats and is intentionally omitted.
92
+ {
93
+ agent: 'gemini',
94
+ model: 'gemini-3.1-flash-lite',
95
+ inputPerMTok: 0.25,
96
+ outputPerMTok: 1.50,
97
+ cacheReadPerMTok: 0.025,
98
+ cacheCreationPerMTok: 0,
99
+ source: 'https://ai.google.dev/gemini-api/docs/pricing',
100
+ verifiedOn: '2026-06-02',
101
+ },
102
+ {
103
+ agent: 'gemini',
104
+ model: 'gemini-3-flash-preview',
105
+ inputPerMTok: 0.50,
106
+ outputPerMTok: 3.00,
107
+ cacheReadPerMTok: 0.05,
108
+ cacheCreationPerMTok: 0,
109
+ source: 'https://ai.google.dev/gemini-api/docs/pricing',
110
+ verifiedOn: '2026-06-02',
111
+ },
112
+ // GitHub Copilot CLI. The CLI's agentic mode uses GPT-4.1 (also branded
113
+ // "gpt-4.1" in the Copilot API stream). GitHub charges for Copilot via
114
+ // premium-request quota rather than per-token billing on most plans; the
115
+ // per-token rates below apply to the Copilot API / enterprise API billing
116
+ // path (pay-per-token, not included-requests) as published at
117
+ // https://docs.github.com/en/copilot/about-github-copilot/plans-for-github-copilot
118
+ // and the underlying OpenAI model pricing for gpt-4.1 at openai.com/api/pricing/.
119
+ // Coverage is 'partial' for Copilot runs where the CLI does not emit a cost
120
+ // field — the table backstops cost computation when a token count is present
121
+ // but no direct costUsd is in the stream.
122
+ {
123
+ agent: 'copilot',
124
+ model: 'gpt-4.1',
125
+ inputPerMTok: 2.00,
126
+ outputPerMTok: 8.00,
127
+ cacheReadPerMTok: 0.50,
128
+ cacheCreationPerMTok: 0,
129
+ source: 'https://openai.com/api/pricing/ (gpt-4.1 row; GitHub Copilot CLI agentic mode)',
130
+ verifiedOn: '2026-06-09',
131
+ },
132
+ {
133
+ agent: 'copilot',
134
+ model: 'gpt-4o',
135
+ inputPerMTok: 2.50,
136
+ outputPerMTok: 10.00,
137
+ cacheReadPerMTok: 1.25,
138
+ cacheCreationPerMTok: 0,
139
+ source: 'https://openai.com/api/pricing/ (gpt-4o row; GitHub Copilot CLI fallback model)',
140
+ verifiedOn: '2026-06-09',
141
+ },
142
+ ];
143
+ /**
144
+ * Look up the price entry for an agent + model. Agent is matched
145
+ * case-insensitively. Returns null when no matching entry exists — the
146
+ * adapter is then expected to skip cost computation rather than guess.
147
+ */
148
+ function lookupPrice(agent, model) {
149
+ if (!agent || !model)
150
+ return null;
151
+ const a = agent.toLowerCase();
152
+ return exports.AGENT_TOKEN_PRICES.find(e => e.agent === a && e.model === model) || null;
153
+ }
154
+ /**
155
+ * Compute USD cost from cumulative token counts. Returns 0 when no price
156
+ * entry exists for the agent/model — the caller decides whether to drop
157
+ * the snapshot entirely or surface a partial-coverage warning.
158
+ */
159
+ function computeCostUsd(agent, model, counts) {
160
+ const price = lookupPrice(agent, model);
161
+ if (!price)
162
+ return 0;
163
+ return ((counts.inputTokens / 1_000_000) * price.inputPerMTok +
164
+ (counts.outputTokens / 1_000_000) * price.outputPerMTok +
165
+ (counts.cacheReadTokens / 1_000_000) * price.cacheReadPerMTok +
166
+ (counts.cacheCreationTokens / 1_000_000) * price.cacheCreationPerMTok);
167
+ }