segreant 0.0.0-stage → 0.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 (349) hide show
  1. package/LICENSE +116 -0
  2. package/LICENSING.md +62 -0
  3. package/README.md +315 -2
  4. package/baselines/lift-baselines.json +22 -0
  5. package/bin/publication-lock.mjs +748 -0
  6. package/bin/runtime-snapshot.mjs +266 -0
  7. package/bin/segreant-statusline.mjs +20 -0
  8. package/bin/segreant.mjs +96 -0
  9. package/dist/alerts/detect.js +245 -0
  10. package/dist/alerts/notify.js +66 -0
  11. package/dist/alloc/apply.js +0 -0
  12. package/dist/alloc/epistemic.js +154 -0
  13. package/dist/alloc/exact.js +714 -0
  14. package/dist/alloc/rules.js +0 -0
  15. package/dist/billing/countermodels.js +123 -0
  16. package/dist/billing/epistemic.js +636 -0
  17. package/dist/billing/importer.js +75 -0
  18. package/dist/billing/mapping.js +239 -0
  19. package/dist/billing/openaiCosts.js +352 -0
  20. package/dist/billing/openaiCostsCoverage.js +108 -0
  21. package/dist/billing/readiness.js +68 -0
  22. package/dist/billing/reconcile.js +414 -0
  23. package/dist/billing/scope.js +68 -0
  24. package/dist/billing/types.js +180 -0
  25. package/dist/budget/allocate.js +100 -0
  26. package/dist/budget/capDecision.js +457 -0
  27. package/dist/budget/controlLock.js +71 -0
  28. package/dist/budget/enforceability.js +39 -0
  29. package/dist/budget/guard.js +313 -0
  30. package/dist/budget/onlineControl.js +404 -0
  31. package/dist/budget/recommend.js +153 -0
  32. package/dist/capital.js +220 -0
  33. package/dist/causal/assignment.js +179 -0
  34. package/dist/causal/design.js +161 -0
  35. package/dist/causal/epistemic.js +428 -0
  36. package/dist/causal/estimand.js +64 -0
  37. package/dist/causal/estimate.js +237 -0
  38. package/dist/causal/family.js +61 -0
  39. package/dist/causal/identity.js +18 -0
  40. package/dist/causal/inference-ledger.js +400 -0
  41. package/dist/causal/ledger.js +201 -0
  42. package/dist/causal/measurement.js +150 -0
  43. package/dist/causal/ope.js +297 -0
  44. package/dist/causal/precision.js +206 -0
  45. package/dist/causal/producer.js +774 -0
  46. package/dist/causal/protocol.js +962 -0
  47. package/dist/causal/qualification.js +260 -0
  48. package/dist/causal/records.js +416 -0
  49. package/dist/causal/registry.js +58 -0
  50. package/dist/causal/sequential.js +679 -0
  51. package/dist/causal/transport.js +138 -0
  52. package/dist/causal/types.js +10 -0
  53. package/dist/cli/allocCmd.js +340 -0
  54. package/dist/cli/askModelPrices.js +59 -0
  55. package/dist/cli/backupCmd.js +100 -0
  56. package/dist/cli/basisLines.js +45 -0
  57. package/dist/cli/billingCmd.js +1007 -0
  58. package/dist/cli/capitalCmd.js +65 -0
  59. package/dist/cli/causalCmd.js +340 -0
  60. package/dist/cli/connectCmd.js +466 -0
  61. package/dist/cli/controlCmd.js +341 -0
  62. package/dist/cli/diagnosticsCmd.js +41 -0
  63. package/dist/cli/economicCmd.js +384 -0
  64. package/dist/cli/egressCmd.js +248 -0
  65. package/dist/cli/evidenceCmd.js +157 -0
  66. package/dist/cli/featuresCmd.js +53 -0
  67. package/dist/cli/flags.js +128 -0
  68. package/dist/cli/homeCmd.js +117 -0
  69. package/dist/cli/importCmd.js +657 -0
  70. package/dist/cli/launchCmd.js +90 -0
  71. package/dist/cli/marketCmd.js +178 -0
  72. package/dist/cli/opsCmd.js +335 -0
  73. package/dist/cli/outcomeCmd.js +120 -0
  74. package/dist/cli/packCmd.js +172 -0
  75. package/dist/cli/planCmd.js +181 -0
  76. package/dist/cli/pluginCmd.js +145 -0
  77. package/dist/cli/pricingDeclareCmd.js +178 -0
  78. package/dist/cli/quotaCmd.js +190 -0
  79. package/dist/cli/retention.js +28 -0
  80. package/dist/cli/runCmd.js +591 -0
  81. package/dist/cli/showCmd.js +500 -0
  82. package/dist/cli/teamCmd.js +760 -0
  83. package/dist/cli/ui.js +128 -0
  84. package/dist/cli/valueCmd.js +1001 -0
  85. package/dist/cli.js +628 -0
  86. package/dist/config.js +677 -0
  87. package/dist/connect/antigravity.js +310 -0
  88. package/dist/connect/claudeCode.js +218 -0
  89. package/dist/connect/codex.js +320 -0
  90. package/dist/connect/connectors.js +285 -0
  91. package/dist/connect/importShared.js +283 -0
  92. package/dist/connect/opencode.js +214 -0
  93. package/dist/connect/protobuf.js +126 -0
  94. package/dist/connect/registry.js +46 -0
  95. package/dist/connect/repoRoot.js +112 -0
  96. package/dist/cost/basis.js +168 -0
  97. package/dist/cost/coverage.js +53 -0
  98. package/dist/cost/declarations.js +37 -0
  99. package/dist/cost/exactPricing.js +132 -0
  100. package/dist/cost/firstSight.js +98 -0
  101. package/dist/cost/overrides.js +230 -0
  102. package/dist/cost/pricing.js +997 -0
  103. package/dist/cost/reprice.js +130 -0
  104. package/dist/dashboard/claim-support.js +271 -0
  105. package/dist/dashboard/contracts.js +211 -0
  106. package/dist/dashboard/routes.js +2004 -0
  107. package/dist/dashboard/server.js +76 -0
  108. package/dist/dashboard/sessions.js +345 -0
  109. package/dist/dashboard/settings.js +109 -0
  110. package/dist/dashboard/shared-types.js +6 -0
  111. package/dist/dashboard/static.js +111 -0
  112. package/dist/dashboard/value-cache.js +105 -0
  113. package/dist/dashboard/web/app/components/claimInspector.js +138 -0
  114. package/dist/dashboard/web/app/components/drawer.js +284 -0
  115. package/dist/dashboard/web/app/components/ruleFields.js +144 -0
  116. package/dist/dashboard/web/app/components/spine.js +163 -0
  117. package/dist/dashboard/web/app/components/workflow.js +82 -0
  118. package/dist/dashboard/web/app/core/actions.js +1021 -0
  119. package/dist/dashboard/web/app/core/api.js +164 -0
  120. package/dist/dashboard/web/app/core/chain.js +40 -0
  121. package/dist/dashboard/web/app/core/claimLayers.js +392 -0
  122. package/dist/dashboard/web/app/core/claimTypes.js +222 -0
  123. package/dist/dashboard/web/app/core/dom.js +138 -0
  124. package/dist/dashboard/web/app/core/fmt.js +159 -0
  125. package/dist/dashboard/web/app/core/focus.js +10 -0
  126. package/dist/dashboard/web/app/core/generated-contract.js +211 -0
  127. package/dist/dashboard/web/app/core/generated-payload-contract.js +4579 -0
  128. package/dist/dashboard/web/app/core/generated-types.js +8 -0
  129. package/dist/dashboard/web/app/core/griffin.js +10 -0
  130. package/dist/dashboard/web/app/core/jobs.js +12 -0
  131. package/dist/dashboard/web/app/core/period.js +35 -0
  132. package/dist/dashboard/web/app/core/periodWords.js +10 -0
  133. package/dist/dashboard/web/app/core/periods.js +32 -0
  134. package/dist/dashboard/web/app/core/pricingActions.js +264 -0
  135. package/dist/dashboard/web/app/core/privacyText.js +78 -0
  136. package/dist/dashboard/web/app/core/reconcileWords.js +63 -0
  137. package/dist/dashboard/web/app/core/registry.js +337 -0
  138. package/dist/dashboard/web/app/core/signal.js +140 -0
  139. package/dist/dashboard/web/app/core/slug.js +9 -0
  140. package/dist/dashboard/web/app/core/theme.js +48 -0
  141. package/dist/dashboard/web/app/core/view.js +69 -0
  142. package/dist/dashboard/web/app/main.js +362 -0
  143. package/dist/dashboard/web/app/views/allocation.js +278 -0
  144. package/dist/dashboard/web/app/views/control.js +249 -0
  145. package/dist/dashboard/web/app/views/data.js +136 -0
  146. package/dist/dashboard/web/app/views/evidence.js +553 -0
  147. package/dist/dashboard/web/app/views/privacy.js +13 -0
  148. package/dist/dashboard/web/app/views/spend.js +143 -0
  149. package/dist/dashboard/web/app/views/statement.js +189 -0
  150. package/dist/dashboard/web/app/views/system.js +80 -0
  151. package/dist/dashboard/web/app/views/value.js +534 -0
  152. package/dist/dashboard/web/app/views/workbench.js +312 -0
  153. package/dist/dashboard/web/classic.html +2151 -0
  154. package/dist/dashboard/web/index.html +51 -0
  155. package/dist/dashboard/web/styles/app.css +1336 -0
  156. package/dist/decision/assurance.js +425 -0
  157. package/dist/decision/control.js +336 -0
  158. package/dist/decision/countermodels.js +118 -0
  159. package/dist/decision/engine.js +382 -0
  160. package/dist/decision/epistemic.js +546 -0
  161. package/dist/demo/seed.js +741 -0
  162. package/dist/diagnostics.js +236 -0
  163. package/dist/economics/attribution.js +201 -0
  164. package/dist/economics/close.js +133 -0
  165. package/dist/economics/corrections.js +120 -0
  166. package/dist/economics/epistemic.js +164 -0
  167. package/dist/economics/events.js +294 -0
  168. package/dist/economics/fx.js +245 -0
  169. package/dist/economics/ledger.js +1516 -0
  170. package/dist/economics/money.js +177 -0
  171. package/dist/economics/rate.js +331 -0
  172. package/dist/economics/request.js +89 -0
  173. package/dist/economics/serialization.js +99 -0
  174. package/dist/egress/policy.js +192 -0
  175. package/dist/egress/proxyHealth.js +36 -0
  176. package/dist/egress/receipts.js +871 -0
  177. package/dist/egress/ruleValidation.js +127 -0
  178. package/dist/egress/transport.js +395 -0
  179. package/dist/epistemic/abstract.js +432 -0
  180. package/dist/epistemic/admissibility.js +213 -0
  181. package/dist/epistemic/assumption.js +134 -0
  182. package/dist/epistemic/claim-uses.js +202 -0
  183. package/dist/epistemic/claim.js +264 -0
  184. package/dist/epistemic/countermodel.js +278 -0
  185. package/dist/epistemic/dag.js +421 -0
  186. package/dist/epistemic/derivation.js +391 -0
  187. package/dist/epistemic/evidence.js +254 -0
  188. package/dist/epistemic/grain.js +82 -0
  189. package/dist/epistemic/issuance-map.js +260 -0
  190. package/dist/epistemic/ledger.js +1489 -0
  191. package/dist/epistemic/obligation.js +149 -0
  192. package/dist/epistemic/preservation.js +178 -0
  193. package/dist/epistemic/profile.js +61 -0
  194. package/dist/epistemic/revocation.js +65 -0
  195. package/dist/epistemic/scope.js +66 -0
  196. package/dist/epistemic/serialization.js +171 -0
  197. package/dist/epistemic/state.js +46 -0
  198. package/dist/epistemic/time.js +37 -0
  199. package/dist/epistemic/ux.js +104 -0
  200. package/dist/epistemic/witness.js +176 -0
  201. package/dist/export/allocationCsv.js +70 -0
  202. package/dist/export/billingCsv.js +36 -0
  203. package/dist/export/csv.js +52 -0
  204. package/dist/export/economic.js +105 -0
  205. package/dist/export/focusBilling.js +66 -0
  206. package/dist/export/statementCsv.js +104 -0
  207. package/dist/git/completeness.js +78 -0
  208. package/dist/git/contribution.js +598 -0
  209. package/dist/git/correlate.js +286 -0
  210. package/dist/git/quality.js +467 -0
  211. package/dist/git/repoScope.js +207 -0
  212. package/dist/git/survivalStore.js +186 -0
  213. package/dist/githubActionsEvidence.js +234 -0
  214. package/dist/guide.js +159 -0
  215. package/dist/judge/call.js +161 -0
  216. package/dist/judge/orchestrate.js +127 -0
  217. package/dist/judge/payload.js +47 -0
  218. package/dist/judge/tier.js +107 -0
  219. package/dist/judge/transcript.js +324 -0
  220. package/dist/market/consensus.js +181 -0
  221. package/dist/market/market.js +323 -0
  222. package/dist/market/refresh.js +119 -0
  223. package/dist/market/sources.js +236 -0
  224. package/dist/market/zip.js +98 -0
  225. package/dist/measurement/completeness.js +125 -0
  226. package/dist/measurement/model.js +113 -0
  227. package/dist/measurement/registry.js +166 -0
  228. package/dist/measurement/surrogate.js +325 -0
  229. package/dist/outcomes/contract.js +107 -0
  230. package/dist/outcomes/registry.js +259 -0
  231. package/dist/outcomes/work-unit.js +42 -0
  232. package/dist/pack/canonical.js +63 -0
  233. package/dist/pack/export.js +120 -0
  234. package/dist/pack/index.js +5 -0
  235. package/dist/pack/manifest.js +77 -0
  236. package/dist/pack/signature.js +69 -0
  237. package/dist/pack/types.js +455 -0
  238. package/dist/pack/verifier.js +275 -0
  239. package/dist/plans/detect.js +147 -0
  240. package/dist/plugins/contract.js +497 -0
  241. package/dist/plugins/host.js +333 -0
  242. package/dist/plugins/index.js +4 -0
  243. package/dist/plugins/intake.js +137 -0
  244. package/dist/plugins/invocation.js +158 -0
  245. package/dist/plugins/isolation.js +203 -0
  246. package/dist/proxy/server.js +891 -0
  247. package/dist/proxy/stream-proposals.js +249 -0
  248. package/dist/proxy/usage.js +213 -0
  249. package/dist/quota/limits.js +138 -0
  250. package/dist/quota/statusline.js +68 -0
  251. package/dist/quota/view.js +122 -0
  252. package/dist/research/complexity/calibration.js +110 -0
  253. package/dist/research/complexity/lab.js +134 -0
  254. package/dist/research/complexity/profile.js +78 -0
  255. package/dist/research/economics/budgetRisk.js +100 -0
  256. package/dist/research/economics/capital.js +101 -0
  257. package/dist/research/economics/decisionLedger.js +103 -0
  258. package/dist/research/economics/decomposition.js +106 -0
  259. package/dist/research/economics/execution.js +42 -0
  260. package/dist/research/economics/frontier.js +113 -0
  261. package/dist/research/economics/metricSafety.js +74 -0
  262. package/dist/research/economics/offPolicy.js +120 -0
  263. package/dist/research/economics/promotion.js +85 -0
  264. package/dist/scan/knownApps.js +113 -0
  265. package/dist/scan/scan.js +220 -0
  266. package/dist/store/allocation.js +543 -0
  267. package/dist/store/backup.js +368 -0
  268. package/dist/store/billing.js +919 -0
  269. package/dist/store/causal.js +2547 -0
  270. package/dist/store/causalLineage.js +912 -0
  271. package/dist/store/causalProducer.js +462 -0
  272. package/dist/store/db.js +2726 -0
  273. package/dist/store/economicReadModel.js +270 -0
  274. package/dist/store/ope.js +67 -0
  275. package/dist/store/realization.js +379 -0
  276. package/dist/store/rows.js +52 -0
  277. package/dist/store/schema.js +2218 -0
  278. package/dist/store/scopeEvidence.js +67 -0
  279. package/dist/team/ledger-evidence.js +82 -0
  280. package/dist/team/rollup.js +496 -0
  281. package/dist/team/standardize.js +115 -0
  282. package/dist/util/json.js +24 -0
  283. package/dist/util/pool.js +19 -0
  284. package/dist/util/quiet.js +18 -0
  285. package/dist/util/resource-limits.js +113 -0
  286. package/dist/util/statements.js +61 -0
  287. package/dist/util/time.js +7 -0
  288. package/dist/util/transaction.js +68 -0
  289. package/dist/value/anytime.js +106 -0
  290. package/dist/value/characterization.js +77 -0
  291. package/dist/value/cohort.js +212 -0
  292. package/dist/value/drift.js +211 -0
  293. package/dist/value/epistemic.js +448 -0
  294. package/dist/value/frontier.js +513 -0
  295. package/dist/value/gates.js +276 -0
  296. package/dist/value/instrumentationSensitivity.js +76 -0
  297. package/dist/value/lenses.js +398 -0
  298. package/dist/value/lift.js +206 -0
  299. package/dist/value/liftBaseline.js +355 -0
  300. package/dist/value/liftEfficiency.js +68 -0
  301. package/dist/value/marginal.js +154 -0
  302. package/dist/value/proposals.js +263 -0
  303. package/dist/value/realization.js +1159 -0
  304. package/dist/value/receipt.js +222 -0
  305. package/dist/value/receiptReconciliation.js +117 -0
  306. package/dist/value/reliability.js +101 -0
  307. package/dist/value/report.js +338 -0
  308. package/dist/value/selfReported.js +224 -0
  309. package/dist/value/sourceDepth.js +25 -0
  310. package/dist/value/taskType.js +46 -0
  311. package/dist/value/timeReclaimed.js +90 -0
  312. package/dist/value/usage.js +281 -0
  313. package/dist/version.js +20 -0
  314. package/docs/ALLOCATION.md +263 -0
  315. package/docs/ARCHITECTURE.md +452 -0
  316. package/docs/BILLING-EVIDENCE-IMPORT.md +274 -0
  317. package/docs/CAPABILITY-EVIDENCE-CONTRACT.md +220 -0
  318. package/docs/CAUSAL-EVIDENCE-PROTOCOL.md +295 -0
  319. package/docs/CAUSAL-PRODUCER-CONTRACT.md +128 -0
  320. package/docs/CLI-JSON-CONTRACT.md +38 -0
  321. package/docs/COMPATIBILITY.md +64 -0
  322. package/docs/DATA-BOUNDARIES.md +300 -0
  323. package/docs/EVIDENCE-PROVENANCE.md +40 -0
  324. package/docs/FAQ.md +275 -0
  325. package/docs/FOCUS-COMPATIBILITY.md +15 -0
  326. package/docs/GETTING-STARTED.md +236 -0
  327. package/docs/GUIDE.md +830 -0
  328. package/docs/INTEGRATIONS.md +233 -0
  329. package/docs/MARKET-SOURCES.md +142 -0
  330. package/docs/METHODOLOGY.md +166 -0
  331. package/docs/NEUTRALITY.md +95 -0
  332. package/docs/PRIVACY.md +51 -0
  333. package/docs/PROVIDER-RECONCILIATION.md +260 -0
  334. package/docs/README.md +52 -0
  335. package/docs/REAL-PROVIDER-RECONCILIATION-RUNBOOK.md +44 -0
  336. package/docs/RELEASE-GATE.md +682 -0
  337. package/docs/RELEASE-PROCESS.md +68 -0
  338. package/docs/RELIABILITY-PERFORMANCE.md +149 -0
  339. package/docs/RETURN-ON-INTELLIGENCE.md +808 -0
  340. package/docs/SUPPORT.md +37 -0
  341. package/docs/THE-STANDARD.md +235 -0
  342. package/docs/THREAT-MODEL.md +114 -0
  343. package/market/consensus-fits.json +1 -0
  344. package/market/snapshot.json +1 -0
  345. package/package.json +79 -4
  346. package/pricing/models.json +1400 -0
  347. package/standalone/segreantpack-verifier.d.mts +61 -0
  348. package/standalone/segreantpack-verifier.mjs +715 -0
  349. package/web/assets/brand/mark-256.png +0 -0
package/LICENSE ADDED
@@ -0,0 +1,116 @@
1
+ Business Source License 1.1
2
+
3
+ Parameters
4
+
5
+ Licensor: GamingDragonwastaken (https://github.com/GamingDragonwastaken)
6
+
7
+ Licensed Work: Segreant
8
+ The Licensed Work is (c) 2026 GamingDragonwastaken.
9
+
10
+ Additional Use Grant: You may make production use of the Licensed Work,
11
+ including inside a company, for paid work, and as part
12
+ of another product or service that you build and sell,
13
+ provided that you do not:
14
+
15
+ (a) offer the Licensed Work, or a modified version of
16
+ it, to third parties as a hosted, managed or
17
+ software-as-a-service offering; or
18
+
19
+ (b) sell, rent, sublicense or otherwise charge a fee for
20
+ the Licensed Work itself or a modified version of
21
+ it, including a product that is substantially the
22
+ Licensed Work offered under another name.
23
+
24
+ Charging for your own product or service that uses or
25
+ includes the Licensed Work is permitted when that
26
+ product or service is not substantially the Licensed
27
+ Work. Running the Licensed Work for your own
28
+ organization, its employees and its contractors is not
29
+ an offering to third parties.
30
+
31
+ Change Date: For each version of the Licensed Work, two years after
32
+ the date that version is first publicly distributed.
33
+
34
+ Change License: Apache License, Version 2.0
35
+
36
+ For information about alternative licensing arrangements for the Licensed Work,
37
+ please contact the Licensor through
38
+ https://github.com/GamingDragonwastaken/Segreant/discussions.
39
+
40
+ Notice
41
+
42
+ The Business Source License (this document, or the "License") is not an Open
43
+ Source license. However, the Licensed Work will eventually be made available
44
+ under an Open Source License, as stated in this License.
45
+
46
+ -----------------------------------------------------------------------------
47
+
48
+ License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
49
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
50
+
51
+ Terms
52
+
53
+ The Licensor hereby grants you the right to copy, modify, create derivative
54
+ works, redistribute, and make non-production use of the Licensed Work. The
55
+ Licensor may make an Additional Use Grant, above, permitting limited
56
+ production use.
57
+
58
+ Effective on the Change Date, or the fourth anniversary of the first publicly
59
+ available distribution of a specific version of the Licensed Work under this
60
+ License, whichever comes first, the Licensor hereby grants you rights under
61
+ the terms of the Change License, and the rights granted in the paragraph
62
+ above terminate.
63
+
64
+ If your use of the Licensed Work does not comply with the requirements
65
+ currently in effect as described in this License, you must purchase a
66
+ commercial license from the Licensor, its affiliated entities, or authorized
67
+ resellers, or you must refrain from using the Licensed Work.
68
+
69
+ All copies of the original and modified Licensed Work, and derivative works
70
+ of the Licensed Work, are subject to this License. This License applies
71
+ separately for each version of the Licensed Work and the Change Date may vary
72
+ for each version of the Licensed Work released by Licensor.
73
+
74
+ You must conspicuously display this License on each original or modified copy
75
+ of the Licensed Work. If you receive the Licensed Work in original or
76
+ modified form from a third party, the terms and conditions set forth in this
77
+ License apply to your use of that work.
78
+
79
+ Any use of the Licensed Work in violation of this License will automatically
80
+ terminate your rights under this License for the current and all other
81
+ versions of the Licensed Work.
82
+
83
+ This License does not grant you any right in any trademark or logo of
84
+ Licensor or its affiliates (provided that you may use a trademark or logo of
85
+ Licensor as expressly required by this License).
86
+
87
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
88
+ AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
89
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
90
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
91
+ TITLE.
92
+
93
+ MariaDB hereby grants you permission to use this License’s text to license
94
+ your works, and to refer to it using the trademark “Business Source License”,
95
+ as long as you comply with the Covenants of Licensor below.
96
+
97
+ Covenants of Licensor
98
+
99
+ In consideration of the right to use this License’s text and the “Business
100
+ Source License” name and trademark, Licensor covenants to MariaDB, and to all
101
+ other recipients of the licensed work to be provided by Licensor:
102
+
103
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
104
+ or a license that is compatible with GPL Version 2.0 or a later version,
105
+ where “compatible” means that software provided under the Change License can
106
+ be included in a program with software provided under GPL Version 2.0 or a
107
+ later version. Licensor may specify additional Change Licenses without
108
+ limitation.
109
+
110
+ 2. To either: (a) specify an additional grant of rights to use that does not
111
+ impose any additional restriction on the right granted in this License, as
112
+ the Additional Use Grant; or (b) insert the text “None”.
113
+
114
+ 3. To specify a Change Date.
115
+
116
+ 4. Not to modify this License in any other way.
package/LICENSING.md ADDED
@@ -0,0 +1,62 @@
1
+ # Licensing, in plain words
2
+
3
+ Segreant is published under the [Business Source License 1.1](LICENSE) with an
4
+ Additional Use Grant. The LICENSE file is the binding text; this page explains
5
+ what it means.
6
+
7
+ ## What you can do, free
8
+
9
+ - **Use it for anything**, as a person or as a company: on your own projects,
10
+ at work, on paid client work, across your whole organization, with a team
11
+ server for your own staff.
12
+ - **Change it, share it and contribute** to it.
13
+ - **Build your own product on it and sell that product**, as long as your
14
+ product is more than Segreant under another name.
15
+
16
+ No account, key, payment or permission is needed for any of that.
17
+
18
+ ## The two things you may not do
19
+
20
+ 1. **Offer Segreant as a service.** You may not run it, or a modified version
21
+ of it, as a hosted or managed service for other people or other companies.
22
+ Running it for your own organization is fine.
23
+ 2. **Sell Segreant itself.** You may not sell, rent, sublicense or otherwise
24
+ charge a fee for Segreant or a modified version of it, including a copy
25
+ relabelled under another name.
26
+
27
+ ## Every version becomes fully open source
28
+
29
+ Two years after a version of Segreant is first published, that version
30
+ switches to the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0),
31
+ an Open Source license, and both limits above end for it. Each later version
32
+ follows on its own two-year clock.
33
+
34
+ Until then, Segreant is *source-available*, not *open source* in the strict
35
+ (OSI) sense. We say so plainly rather than borrow a label it has not earned yet.
36
+
37
+ ## Why these terms
38
+
39
+ The goal of Segreant is to move AI from paying for tokens to paying for value,
40
+ and that needs as many people and organizations as possible measuring their own
41
+ AI work, building on the measurement and improving it. The only thing these
42
+ terms hold back is someone else turning this project into a paid service or a
43
+ resold copy before it is fully open.
44
+
45
+ ## Something else in mind
46
+
47
+ If you want to do something the two limits forbid, or you need different
48
+ terms, open a
49
+ [discussion](https://github.com/GamingDragonwastaken/Segreant/discussions).
50
+
51
+ ## Earlier versions
52
+
53
+ - Commits up to `28dc6dd` on `main` were published under the MIT license and
54
+ remain available under it.
55
+ - Commits after that and before the change to this license were published
56
+ under the PolyForm Noncommercial License 1.0.0 (from 2026-10-08 with an
57
+ individual use permission). Those copies keep the terms they were published
58
+ with; every later version is under the terms above.
59
+ - The npm package `segreant` 0.1.0 (2026-10-08) is under this license
60
+ (`BUSL-1.1` in its package metadata and LICENSE file).
61
+
62
+ *This page explains the license; it is not legal advice.*
package/README.md CHANGED
@@ -1,3 +1,316 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <img src="web/assets/brand/mark-256.png" alt="The Segreant mark: a gold griffin rearing, on black" width="112" />
4
+
5
+ # Segreant
6
+
7
+ **Govern the spend. Not the developer.**
8
+
9
+ The financial control layer for AI coding agents, running on your own machine.
10
+ Your agents' spend is metered, capped before a loop runs away with it, checked
11
+ against the provider's bill, assigned to the budget it belongs to, and traced to
12
+ the work it produced. And every number tells you exactly how much it can be trusted.
13
+
14
+ `local-first` · `zero runtime dependencies` · `3,000+ tests` · `Node 24+` · `free to use, including at work (BUSL-1.1)`
15
+
16
+ [![CI](https://github.com/GamingDragonwastaken/Segreant/actions/workflows/ci.yml/badge.svg)](https://github.com/GamingDragonwastaken/Segreant/actions/workflows/ci.yml)
17
+
18
+ </div>
19
+
20
+ ---
21
+
22
+ ## The problem
23
+
24
+ Coding agents bill by the token, and they fail expensively. An agent stuck in a
25
+ loop overnight doesn't raise an error; it sends an invoice. Your monitoring
26
+ can't see it, because a `$0.002` request and a `$0.40` retry loop look
27
+ identical when all you measure is latency and errors.
28
+
29
+ Then finance asks a simple question, *"what is AI costing us, and is it worth
30
+ it?"*, and every tool answers with one confident number. That number is
31
+ usually an estimate dressed as a bill, or a bill with no owner, or a value
32
+ figure nobody can defend.
33
+
34
+ ## Four numbers, never one
35
+
36
+ Segreant is built on a single refusal: **it will not collapse four different
37
+ questions into one number.**
38
+
39
+ | | The question | Where the answer comes from |
40
+ |---|---|---|
41
+ | **Metered usage** | What did the traffic use, at list price? | Segreant's proxy or your tools' own logs, priced from a versioned local rate card |
42
+ | **Provider-billed cost** | What did the provider actually charge? | The provider's cost export or Costs API (OpenAI today), imported and kept separate |
43
+ | **Allocated cost** | Whose budget does it belong to? | Allocation rules you write, reported together with what they left unallocated |
44
+ | **Value** | Did the spend become shipped, kept work? | Outcome evidence from git, tests and your reports |
45
+
46
+ Every figure on every screen says which of the four it is. When the evidence
47
+ for a number is missing, Segreant shows **unknown**. It never fills in a guess.
48
+
49
+ ## What makes it different
50
+
51
+ Most cost tools are dashboards. Segreant is an accounting system with an
52
+ evidence model underneath, and it behaves like one.
53
+
54
+ - **Every row carries its provenance.** Each priced request records the exact
55
+ rate-card SHA-256 and whether the price was an exact, family or fallback
56
+ match. Repricing appends a before/after event; nothing is silently
57
+ overwritten.
58
+ - **Budgets fail closed.** If the budget config is malformed or the ledger
59
+ can't be read, Segreant stops forwarding. A broken meter never becomes an
60
+ unlimited one.
61
+ - **Reconciliation shows its residual.** When metered spend and the
62
+ provider's bill disagree, the gap is reported with the conditions that
63
+ explain it and what it can and cannot bound. It is never forced to zero.
64
+ - **Allocation conserves money.** Allocated plus unallocated equals the ledger
65
+ total to the microdollar, checked on every run. A run that doesn't balance
66
+ is refused.
67
+ - **Model comparisons know when they're confounded.** Cheaper-model trials use
68
+ anytime-valid intervals, correct for multiple comparisons, and flag
69
+ themselves when the work sizes differ, the sample spans a price change, or
70
+ the commits came from too few sessions.
71
+ - **Evidence you can hand to someone else.** Realized work produces
72
+ ed25519-signed value receipts. The whole evidence ledger exports as a
73
+ `.segreantpack` that a standalone verifier checks offline, without trusting
74
+ Segreant.
75
+ - **A kernel that can't be talked into certainty.** Claims live in a small
76
+ trusted core that tracks four evidence states: unknown, supported, refuted
77
+ and conflicted. It refuses derivations that would strengthen a claim beyond
78
+ its evidence, and revoking a source revokes everything built on it.
79
+ - **Zero runtime dependencies.** Node's built-in SQLite and nothing else. CI
80
+ proves it with a CycloneDX SBOM on every build.
81
+
82
+ ## See it in 30 seconds
83
+
84
+ No API key, no account, no setup. With Node 24 or newer:
85
+
86
+ ```bash
87
+ npx segreant demo --serve # labelled synthetic data; opens the dashboard
88
+ ```
89
+
90
+ Open **http://localhost:8091**. You'll see a month's statement with all four
91
+ figures, spend by project and model with each session and what its commits
92
+ came to, caps and alerts, a comparison with a generated provider bill,
93
+ cost-centre splits, and what the spend produced, with a review-only
94
+ cheaper-model comparison. It all runs on an isolated `demo.db` and is
95
+ labelled as synthetic. Clear it with `segreant demo --clear`.
96
+
97
+ ## Use it on your real work
98
+
99
+ Install the `segreant` command (it has no runtime dependencies):
100
+
101
+ ```bash
102
+ npm install -g segreant
103
+ ```
104
+
105
+ On Windows, a project-local install (`npm install segreant`) inside a folder
106
+ whose path contains `&` cannot start through `npx` or `node_modules\.bin`:
107
+ npm's generated `.cmd` shim does not quote that path. The global install above
108
+ and `npx segreant` from any folder are not affected. For a local install there,
109
+ run `node node_modules/segreant/bin/segreant.mjs` instead.
110
+
111
+ **Option A: no wiring at all.** If you use Claude Code, Codex or opencode,
112
+ Segreant reads the usage those tools already log on your machine, including
113
+ subscription usage a proxy never sees. Antigravity is read from 0.2.0, which is
114
+ unreleased and not yet on npm:
115
+
116
+ ```bash
117
+ segreant scan # finds your AI tools and git repos; changes nothing
118
+ segreant scan --setup # imports that usage and groups it by project
119
+ segreant today # what today cost, by model, project and tool
120
+ ```
121
+
122
+ **Option B: route traffic through Segreant** to meter it live and enforce budgets:
123
+
124
+ ```bash
125
+ segreant start # proxy on :8090, dashboard on :8091
126
+ ```
127
+
128
+ ```bash
129
+ segreant launch -- claude # or codex, opencode, aider, ...
130
+ ```
131
+
132
+ `launch` points only that one tool at the proxy, and only while the proxy is
133
+ running. If the proxy is stopped, the tool starts unmetered with a warning, or
134
+ not at all when a budget cap is set. To point a shell at it yourself instead:
135
+
136
+ ```bash
137
+ export ANTHROPIC_BASE_URL="http://localhost:8090"
138
+ export OPENAI_BASE_URL="http://localhost:8090/v1"
139
+ ```
140
+
141
+ A tool pointed at the proxy this way cannot connect while Segreant is stopped.
142
+
143
+ Requests to OpenAI's and Anthropic's official APIs go through as soon as Segreant
144
+ starts: that traffic was already going to your provider, and Segreant meters it
145
+ on the way. Everything Segreant would send on its own (webhooks, team rollups,
146
+ hosted judging) stays off until you allow it, and another provider or gateway
147
+ needs one rule, which a refused request prints
148
+ ([GETTING-STARTED.md](docs/GETTING-STARTED.md)). Then set a cap:
149
+
150
+ ```bash
151
+ segreant budget --daily 25 --soft 18 --runaway 2 # hard cap, warning, loop guard
152
+ ```
153
+
154
+ Caps are opt-in. A fresh install meters but never blocks. Unset the two
155
+ variables and Segreant is out of the path.
156
+
157
+ Per-tool recipes (Cursor, aider, opencode, Antigravity, your own SDK scripts):
158
+ [docs/INTEGRATIONS.md](docs/INTEGRATIONS.md).
159
+
160
+ ## What you can do with it
161
+
162
+ - **See the spend.** By day, project, model, tool and developer, in the
163
+ terminal (`segreant today`, `week`, `month`) or the dashboard. Export CSV for
164
+ your own BI.
165
+ - **Stop runaway agents.** Daily, per-session and velocity caps on proxied
166
+ traffic.
167
+ - **Check against the real bill.** Import an OpenAI cost export, or pull
168
+ OpenAI's Costs API read-only, and reconcile it against what Segreant metered
169
+ at project-day level. See [PROVIDER-RECONCILIATION.md](docs/PROVIDER-RECONCILIATION.md).
170
+ - **Allocate to cost centres.** Versioned, effective-dated rules, reported as
171
+ showback. See [ALLOCATION.md](docs/ALLOCATION.md).
172
+ - **Measure what the spend produced.** Return on Intelligence follows each
173
+ commit through tested, merged, shipped and survived. See
174
+ [RETURN-ON-INTELLIGENCE.md](docs/RETURN-ON-INTELLIGENCE.md).
175
+ - **Try a cheaper model, carefully.** `segreant frontier` compares models on the
176
+ same kind of task. It never changes your routing for you.
177
+ - **Keep your data yours.** SQLite on your disk, verified backup and restore,
178
+ and evidence packs you can sign and verify.
179
+
180
+ ### In the dashboard, without the terminal
181
+
182
+ `segreant start` serves a local dashboard organised by job:
183
+
184
+ - **Statement**: one calendar month, side by side. What was measured, what the
185
+ provider billed, how it was split, and what it produced. The four are never
186
+ added together, and the month downloads as a CSV.
187
+ - **Spend**: where the measured spend went, by project, model and source.
188
+ - **Protect**: caps and alerts that stop spend before it happens.
189
+ - **Close**: declare the OpenAI project, bring in the cost export, and record
190
+ the comparison with what Segreant measured.
191
+ - **Allocate**: cost centres, the rules that assign spend to them, and the
192
+ monthly split, previewed before it is recorded.
193
+ - **Value**: what the spend produced, with the limits stated.
194
+
195
+ - **Settings**: choose what you see, from density to which jobs sit in the top
196
+ bar, and a map of everything Segreant can do. Each capability the dashboard
197
+ runs opens from that map in one click.
198
+
199
+ Splits, bill comparisons, imports, adoptions and budget changes show a preview
200
+ before anything is saved. The dashboard follows your system's light or dark
201
+ setting, works at phone width, and loads nothing from the internet.
202
+
203
+ Every command, flag and design detail is in the **[Segreant guide](docs/GUIDE.md)**.
204
+
205
+ ## For teams and enterprises
206
+
207
+ The same local tool scales up without sending prompts or code to any Segreant-run service:
208
+
209
+ - **Team rollups.** Each machine signs and pushes per-project value and spend
210
+ summaries to a team server *you* run. Per-developer views are opt-in,
211
+ distribution-only and k-anonymous.
212
+ - **Finance-ready output.** Cost-centre allocation with conservation checks,
213
+ provider-billed evidence with digests and coverage declarations, and a
214
+ [FOCUS](docs/FOCUS-COMPATIBILITY.md)-compatible billing export.
215
+ - **Identity and storage.** The team server supports OIDC sign-in and
216
+ PostgreSQL.
217
+
218
+ The team server is implemented and tested, but it has not yet been validated in
219
+ a production deployment; see [team-server/README.md](team-server/README.md)
220
+ before exposing it to a network.
221
+
222
+ ## What Segreant will not claim
223
+
224
+ Built to be believed, so it is strict about what it says.
225
+
226
+ - **A local estimate is not a bill.** Metered amounts are list-price estimates.
227
+ Provider figures are imported separately, and reconciled cost never feeds
228
+ budgets or recommendations.
229
+ - **Value is not causation.** The dollar figure in the value view is an
230
+ **Observed value scenario**: manual-equivalent value under assumptions you
231
+ set. It is not a causal return. A causal net benefit result is separate and
232
+ requires a registered randomized study (see
233
+ [CAUSAL-EVIDENCE-PROTOCOL.md](docs/CAUSAL-EVIDENCE-PROTOCOL.md)).
234
+ - **Attribution labels are declarations, not verified identity.** Each label
235
+ records how it was obtained, and a missing one stays missing.
236
+ - **Not surveillance.** Personal views are for self-improvement. Team views
237
+ are opt-in and aggregate-only.
238
+
239
+ The complete, test-enforced list of what is supported, intended and not
240
+ offered is [CAPABILITY-EVIDENCE-CONTRACT.md](docs/CAPABILITY-EVIDENCE-CONTRACT.md).
241
+
242
+ ## Privacy
243
+
244
+ Segreant has no hosted service and sends no telemetry by default. The ledger
245
+ lives under `~/.segreant`, and the dashboard loads nothing from third parties:
246
+ no CDNs, fonts or analytics. Requests you route through the proxy still go to
247
+ the AI provider you configured, and your API keys pass through without being
248
+ stored. Segreant also downloads the public price list when it meets a model
249
+ its rate card does not know; that download sends nothing about you, and
250
+ `segreant pricing --auto off` stops it. Every other outbound path (alert
251
+ webhooks, team rollups) is opt-in. The privacy statement is [PRIVACY.md](docs/PRIVACY.md), also
252
+ one click from every dashboard page; every path in detail is in
253
+ [DATA-BOUNDARIES.md](docs/DATA-BOUNDARIES.md).
254
+
255
+ ## Status
256
+
257
+ Segreant is **pre-release (0.1.0)**, published on npm as `segreant`. CI covers Linux, macOS and Windows, including a packaged-install
258
+ smoke test, real-browser tests and supply-chain checks.
259
+ Reconciliation and outcome measurement are implemented and tested but have not
260
+ yet been validated against real provider accounts or with outside users. That
261
+ is what the first users will prove.
262
+
263
+ If you try it, what confused you or what broke is the most useful thing you
264
+ can send: [open an issue](https://github.com/GamingDragonwastaken/Segreant/issues)
265
+ or [start a discussion](https://github.com/GamingDragonwastaken/Segreant/discussions).
266
+
267
+ ## Documentation
268
+
269
+ | Start here | Go deeper | Trust and boundaries |
270
+ |---|---|---|
271
+ | [Getting started](docs/GETTING-STARTED.md) | [Segreant guide](docs/GUIDE.md) | [Data boundaries](docs/DATA-BOUNDARIES.md) |
272
+ | [Integrations](docs/INTEGRATIONS.md) | [Architecture](docs/ARCHITECTURE.md) | [Capability contract](docs/CAPABILITY-EVIDENCE-CONTRACT.md) |
273
+ | [FAQ](docs/FAQ.md) | [Methodology (plain language)](docs/METHODOLOGY.md) | [Threat model](docs/THREAT-MODEL.md) |
274
+
275
+ The full index is in [docs/README.md](docs/README.md).
276
+
277
+ ## By the numbers
278
+
279
+ | | |
280
+ |---|---|
281
+ | Product code | ~105,000 lines of strict TypeScript |
282
+ | Tests | ~81,000 lines, 3,000+ test cases across the CLI, dashboard, team server and a real browser |
283
+ | Runtime dependencies | 0 |
284
+ | CI | 14 checks on every pull request: three operating systems, install paths with spaces and `&`, the team server against real PostgreSQL, a packaged install, supply chain, real-browser tests, and exact-head verification |
285
+
286
+ ## Development
287
+
288
+ ```bash
289
+ npm install # dev-only: typescript + @types/node
290
+ npm run build # compile to dist/
291
+ npm test # the full suite
292
+ npm run typecheck # strict TypeScript
293
+ npm run demo # rebuilds, then the demo dashboard from this checkout
294
+ npm run start # rebuilds, then the proxy and dashboard from this checkout
295
+ ```
296
+
297
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for how changes are verified,
298
+ [GOVERNANCE.md](GOVERNANCE.md) for who decides what, [SECURITY.md](SECURITY.md)
299
+ for reporting a vulnerability, [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md)
300
+ for what stays stable, and [docs/RELEASE-PROCESS.md](docs/RELEASE-PROCESS.md)
301
+ for how a release is gated.
302
+
303
+ ## Supporting Segreant
304
+
305
+ Segreant is built independently and is free to use for everyone, people and
306
+ organizations alike ([LICENSING.md](LICENSING.md)). Paying never unlocks features
307
+ ([docs/NEUTRALITY.md](docs/NEUTRALITY.md) makes that a checkable commitment).
308
+
309
+ ## License
310
+
311
+ [Business Source License 1.1](LICENSE) with an Additional Use Grant: **anyone,
312
+ person or company, may use, change and build on Segreant for free**, including
313
+ selling their own products built on it. The two things not allowed are
314
+ offering Segreant as a hosted service and selling Segreant itself. Two years
315
+ after each version is published, it becomes Apache 2.0 open source. Plain
316
+ words: [LICENSING.md](LICENSING.md).
@@ -0,0 +1,22 @@
1
+ {
2
+ "schema_version": 1,
3
+ "curated": "2026-07-10",
4
+ "unit": "minutes",
5
+ "source": {
6
+ "title": "Task-Completion Time Horizons of Frontier AI Models (METR, Time Horizon 1.1)",
7
+ "url": "https://metr.org/time-horizons/",
8
+ "arxiv": "https://arxiv.org/abs/2503.14499",
9
+ "asOf": "2026-05-08",
10
+ "note": "METR times skilled professional software engineers (~5 years' experience) completing real software tasks, using the geometric mean of successful completion times, then reports the task LENGTH (in that human-timed unit) at which frontier models succeed 50%/80% of the time. As of Time Horizon 1.1 (page updated 2026-05-08, benchmark METR-Horizon-v1.1 released 2026-04-07), the highest 80%-reliability horizon among tested models is ~186 minutes (Claude Mythos Preview Early) — verified against METR's own published benchmark data, not estimated. METR does NOT publish a breakdown of their task suite by category matching this table's task-type taxonomy (feature/fix/refactor/...) — the per-task-type minutes below are this project's own calibration against that published human-timed scale, not a METR output. These values are unchanged from this project's earlier illustrative defaults; the METR anchor (feature=240min sits modestly above the current ~186min frontier-model horizon) is an order-of-magnitude sanity check on them, not a re-derivation from METR data. Treat this as a cited industry anchor, not a precise measurement. Refreshable via `segreant baseline --refresh --url <manifest>` (no default source — you must supply one you trust; see docs/RETURN-ON-INTELLIGENCE.md §7.1) and, per project, blended with your own git history when enough pre-tracking commits exist — see src/value/liftBaseline.ts."
11
+ },
12
+ "baselineMinutes": {
13
+ "feature": 240,
14
+ "fix": 90,
15
+ "refactor": 120,
16
+ "test": 60,
17
+ "docs": 45,
18
+ "perf": 120,
19
+ "chore": 30,
20
+ "other": 90
21
+ }
22
+ }