cartethyia 2.5.2 → 2.5.3

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 (96) hide show
  1. package/dist/dashboard/assets/{BannedPage-MsQaeQTs.js → BannedPage-hfCzi-Ux.js} +1 -1
  2. package/dist/dashboard/assets/BannedPage-hfCzi-Ux.js.gz +0 -0
  3. package/dist/dashboard/assets/{CliToolDetailPage-BO9nKg9w.js → CliToolDetailPage-DLGqYEwI.js} +1 -1
  4. package/dist/dashboard/assets/CliToolDetailPage-DLGqYEwI.js.gz +0 -0
  5. package/dist/dashboard/assets/{CliToolsPage-DfWHTJ7v.js → CliToolsPage-DEDyKBlC.js} +1 -1
  6. package/dist/dashboard/assets/CliToolsPage-DEDyKBlC.js.gz +0 -0
  7. package/dist/dashboard/assets/{CombosPage-BrCBQDAc.js → CombosPage-CfuYiQ8Z.js} +1 -1
  8. package/dist/dashboard/assets/CombosPage-CfuYiQ8Z.js.gz +0 -0
  9. package/dist/dashboard/assets/{ConsoleLogPage-C6Uh33er.js → ConsoleLogPage-bsLuZmYH.js} +1 -1
  10. package/dist/dashboard/assets/ConsoleLogPage-bsLuZmYH.js.gz +0 -0
  11. package/dist/dashboard/assets/{CustomizationPage-8aS9hyJu.js → CustomizationPage-_UWhwziJ.js} +1 -1
  12. package/dist/dashboard/assets/CustomizationPage-_UWhwziJ.js.gz +0 -0
  13. package/dist/dashboard/assets/{HealthEventsModal-qomXThxX.js → HealthEventsModal-Cjfc5WFS.js} +1 -1
  14. package/dist/dashboard/assets/HealthEventsModal-Cjfc5WFS.js.gz +0 -0
  15. package/dist/dashboard/assets/{LoginPage-C8hKyXBe.js → LoginPage-DDVIfZGW.js} +1 -1
  16. package/dist/dashboard/assets/LoginPage-DDVIfZGW.js.gz +0 -0
  17. package/dist/dashboard/assets/{OverviewPage-C-ExCy1V.js → OverviewPage-B53YYMng.js} +1 -1
  18. package/dist/dashboard/assets/OverviewPage-B53YYMng.js.gz +0 -0
  19. package/dist/dashboard/assets/ProviderDetailPage-B0KaAQf0.js +3 -0
  20. package/dist/dashboard/assets/ProviderDetailPage-B0KaAQf0.js.gz +0 -0
  21. package/dist/dashboard/assets/{ProvidersPage-BS9IEpvv.js → ProvidersPage-Dx31DgIO.js} +1 -1
  22. package/dist/dashboard/assets/ProvidersPage-Dx31DgIO.js.gz +0 -0
  23. package/dist/dashboard/assets/{ProxyPage-Rn_qXScb.js → ProxyPage-BpnR4kXT.js} +1 -1
  24. package/dist/dashboard/assets/ProxyPage-BpnR4kXT.js.gz +0 -0
  25. package/dist/dashboard/assets/{QuotaPage-BihkgQSq.js → QuotaPage-BpOQCnun.js} +1 -1
  26. package/dist/dashboard/assets/QuotaPage-BpOQCnun.js.gz +0 -0
  27. package/dist/dashboard/assets/SettingsPage-DV1eo2J_.js +1 -0
  28. package/dist/dashboard/assets/SettingsPage-DV1eo2J_.js.gz +0 -0
  29. package/dist/dashboard/assets/{SetupPage-CXjUlfqr.js → SetupPage-D6pmQ86L.js} +1 -1
  30. package/dist/dashboard/assets/SetupPage-D6pmQ86L.js.gz +0 -0
  31. package/dist/dashboard/assets/{SortableList-C-_oD3F2.js → SortableList-DWvKiuSl.js} +1 -1
  32. package/dist/dashboard/assets/SortableList-DWvKiuSl.js.gz +0 -0
  33. package/dist/dashboard/assets/{StudioPage-u9IxmYOI.js → StudioPage-CmkUrgdj.js} +1 -1
  34. package/dist/dashboard/assets/StudioPage-CmkUrgdj.js.gz +0 -0
  35. package/dist/dashboard/assets/{UsagePage-BEVLVrwP.js → UsagePage-B47uOydr.js} +1 -1
  36. package/dist/dashboard/assets/UsagePage-B47uOydr.js.gz +0 -0
  37. package/dist/dashboard/assets/{entry-Dj9AR0gY.js → entry-CkryrIea.js} +3 -3
  38. package/dist/dashboard/assets/entry-CkryrIea.js.gz +0 -0
  39. package/dist/dashboard/assets/{index-DCBtROoK.js → index-BydyKaDz.js} +2 -2
  40. package/dist/dashboard/assets/index-BydyKaDz.js.gz +0 -0
  41. package/dist/dashboard/assets/{select-DsX5QT8K.js → select-BO6h8yNv.js} +1 -1
  42. package/dist/dashboard/assets/select-BO6h8yNv.js.gz +0 -0
  43. package/dist/dashboard/index.html +1 -1
  44. package/dist/dashboard/index.html.gz +0 -0
  45. package/dist/dashboard/precompressed-assets.json +21 -21
  46. package/package.json +1 -1
  47. package/scripts/cli/command/console-menu.ts +248 -246
  48. package/scripts/cli/command/tray.ts +208 -204
  49. package/src/config/spec.ts +26 -2
  50. package/src/console/backup/routes.ts +52 -1
  51. package/src/console/backup/service.ts +60 -4
  52. package/src/console/share/share-router.ts +6 -9
  53. package/src/observability/payload-capture.ts +366 -344
  54. package/src/observability/payload-store.ts +12 -2
  55. package/src/observability/telemetry-status.ts +28 -16
  56. package/src/persistence/stores/api-key-store.ts +6 -0
  57. package/src/persistence/stores/share-store.ts +583 -556
  58. package/src/persistence/stores/telemetry-store.ts +1 -1
  59. package/src/protocol/response/gemini.ts +18 -4
  60. package/src/providers/integrations/antigravity/antigravity-quota.ts +11 -3
  61. package/src/providers/integrations/buddy/buddy-catalog-shared.ts +4 -4
  62. package/src/providers/integrations/buddy/workbuddy/shared.ts +201 -200
  63. package/src/providers/integrations/cline/cline-quota.ts +8 -11
  64. package/src/providers/integrations/opencode/provider.ts +532 -532
  65. package/src/providers/integrations/tokenharbor.ts +2 -2
  66. package/src/providers/integrations/trae/trae-catalog.ts +5 -3
  67. package/src/providers/operations/account-health-service.ts +23 -0
  68. package/src/providers/operations/client-versions.ts +9 -2
  69. package/src/providers/provider-metadata.ts +7 -1
  70. package/src/transport/dispatch/attempt-finalize.ts +46 -5
  71. package/src/transport/dispatch/proxy-request.ts +9 -0
  72. package/src/transport/dispatch/streaming/stream.ts +16 -2
  73. package/src/transport/routing/route-catalog.ts +806 -799
  74. package/dist/dashboard/assets/BannedPage-MsQaeQTs.js.gz +0 -0
  75. package/dist/dashboard/assets/CliToolDetailPage-BO9nKg9w.js.gz +0 -0
  76. package/dist/dashboard/assets/CliToolsPage-DfWHTJ7v.js.gz +0 -0
  77. package/dist/dashboard/assets/CombosPage-BrCBQDAc.js.gz +0 -0
  78. package/dist/dashboard/assets/ConsoleLogPage-C6Uh33er.js.gz +0 -0
  79. package/dist/dashboard/assets/CustomizationPage-8aS9hyJu.js.gz +0 -0
  80. package/dist/dashboard/assets/HealthEventsModal-qomXThxX.js.gz +0 -0
  81. package/dist/dashboard/assets/LoginPage-C8hKyXBe.js.gz +0 -0
  82. package/dist/dashboard/assets/OverviewPage-C-ExCy1V.js.gz +0 -0
  83. package/dist/dashboard/assets/ProviderDetailPage-tr811uaF.js +0 -3
  84. package/dist/dashboard/assets/ProviderDetailPage-tr811uaF.js.gz +0 -0
  85. package/dist/dashboard/assets/ProvidersPage-BS9IEpvv.js.gz +0 -0
  86. package/dist/dashboard/assets/ProxyPage-Rn_qXScb.js.gz +0 -0
  87. package/dist/dashboard/assets/QuotaPage-BihkgQSq.js.gz +0 -0
  88. package/dist/dashboard/assets/SettingsPage-DhiEjm6T.js +0 -1
  89. package/dist/dashboard/assets/SettingsPage-DhiEjm6T.js.gz +0 -0
  90. package/dist/dashboard/assets/SetupPage-CXjUlfqr.js.gz +0 -0
  91. package/dist/dashboard/assets/SortableList-C-_oD3F2.js.gz +0 -0
  92. package/dist/dashboard/assets/StudioPage-u9IxmYOI.js.gz +0 -0
  93. package/dist/dashboard/assets/UsagePage-BEVLVrwP.js.gz +0 -0
  94. package/dist/dashboard/assets/entry-Dj9AR0gY.js.gz +0 -0
  95. package/dist/dashboard/assets/index-DCBtROoK.js.gz +0 -0
  96. package/dist/dashboard/assets/select-DsX5QT8K.js.gz +0 -0
@@ -157,12 +157,22 @@ async function appendFrameToPath(
157
157
  };
158
158
  }
159
159
 
160
+ /**
161
+ * The frame's body keys, in the same order `buildPayloadRecord` serializes
162
+ * them.
163
+ *
164
+ * The record hands the writer one string per body already serialized, so the
165
+ * two orders must agree or every body lands under the wrong key. The order is
166
+ * drawer order with the legacy `response_body` alias last, for the same reason
167
+ * the record accounts it last: it names no panel of its own and must not
168
+ * spend the shared byte budget ahead of the provider stages.
169
+ */
160
170
  const FRAME_BODY_KEYS = [
161
171
  "request_body",
162
- "response_body",
163
- "client_response_body",
164
172
  "provider_request_body",
165
173
  "provider_response_body",
174
+ "client_response_body",
175
+ "response_body",
166
176
  ] as const;
167
177
 
168
178
  /**
@@ -32,12 +32,18 @@
32
32
  * - **`503`** is capacity or availability: the gateway *correctly* refusing work
33
33
  * it cannot do right now (`admission_unavailable`, `accounts_unavailable`,
34
34
  * `shutting_down`, `restart_for_update`, `platform_unavailable`). Retryable,
35
- * self-inflicted, and an
36
- * operator-capacity signal rather than a defect. It is the one `5xx` that is
37
- * not a gateway defect, so it is named explicitly.
38
- * - **`500`, `502`, `504`** — an internal error, a stream that ended before
39
- * completion, a deadline that expired — are the gateway failing at its job.
40
- * These count.
35
+ * self-inflicted, and an operator-capacity signal rather than a defect.
36
+ * - **`504`** is a timeout, not a malfunction. It represents a deadline that
37
+ * expired: the request deadline, the stream-stall
38
+ * watchdog, an HTTP/2 read-idle or WebSocket receive timer, an upstream that
39
+ * stopped sending mid-stream. The gateway *did* its job — it stopped waiting
40
+ * — and the wait may have been the upstream or network. Counting a slow
41
+ * provider as a gateway defect makes the error rate track provider
42
+ * latency rather than gateway health, and a caller can inflate it for free
43
+ * by requesting a window nobody can fill in time.
44
+ * - **`529`** is the upstream's own overload signal, not this gateway's.
45
+ * - **`500`, `502`** — an internal error, a stream that ended before
46
+ * completion — are the gateway failing at its job. These count.
41
47
  *
42
48
  * Excluded requests are still recorded, still rendered in the Requests table,
43
49
  * still filterable, and still openable in the detail drawer. "Not an error"
@@ -59,12 +65,18 @@ export const GATEWAY_ERROR_STATUSES = ["failed", "truncated"] as const;
59
65
  export const GATEWAY_ERROR_HTTP_MIN = 500;
60
66
 
61
67
  /**
62
- * The `5xx` statuses that represent provider capacity/availability rather than
63
- * a gateway defect. Named explicitly so error-rate rollups exclude both cases.
68
+ * The `5xx` statuses that are *not* a gateway defect: capacity and
69
+ * availability (`503`, `529`) and deadlines (`504`). Named explicitly so
70
+ * error-rate rollups exclude all of them.
71
+ *
72
+ * `504` belongs here even though it is not capacity. The name covers the
73
+ * shared property — the gateway behaved correctly and the outcome belongs to
74
+ * somebody else — because listing it under "capacity" invites a later reader
75
+ * to prune a code that does not look like one.
64
76
  */
65
- export const CAPACITY_HTTP_STATUSES = [503, 529] as const;
77
+ export const NON_DEFECT_HTTP_STATUSES = [503, 504, 529] as const;
66
78
 
67
- const CAPACITY_HTTP_STATUS_SET: ReadonlySet<number> = new Set(CAPACITY_HTTP_STATUSES);
79
+ const NON_DEFECT_HTTP_STATUS_SET: ReadonlySet<number> = new Set(NON_DEFECT_HTTP_STATUSES);
68
80
 
69
81
  /**
70
82
  * Whether a terminal lifecycle status represents a gateway failure, before the
@@ -86,10 +98,10 @@ export function isGatewayErrorStatus(status: string | null | undefined): boolean
86
98
 
87
99
  /**
88
100
  * Whether an HTTP status is a gateway defect: a `5xx` that is not one of the
89
- * capacity/availability statuses.
101
+ * non-defect statuses (capacity, availability, or a deadline).
90
102
  */
91
103
  export function isGatewayErrorHttpStatus(httpStatus: number): boolean {
92
- return httpStatus >= GATEWAY_ERROR_HTTP_MIN && !CAPACITY_HTTP_STATUS_SET.has(httpStatus);
104
+ return httpStatus >= GATEWAY_ERROR_HTTP_MIN && !NON_DEFECT_HTTP_STATUS_SET.has(httpStatus);
93
105
  }
94
106
 
95
107
  /**
@@ -116,7 +128,7 @@ export function isGatewayError(
116
128
  *
117
129
  * Derived from the same constants `isGatewayError` reads — the status list from
118
130
  * `GATEWAY_ERROR_STATUSES`, the floor from `GATEWAY_ERROR_HTTP_MIN`, the
119
- * exceptions from `CAPACITY_HTTP_STATUSES` — so the two forms cannot drift:
131
+ * exceptions from `NON_DEFECT_HTTP_STATUSES` — so the two forms cannot drift:
120
132
  * an unknown status must be classified the same way row-level and in SQL, or
121
133
  * the durable rollup disagrees with every read-side count.
122
134
  */
@@ -125,9 +137,9 @@ export function gatewayErrorSql(status: AnyColumn, httpStatus: AnyColumn): SQL {
125
137
  GATEWAY_ERROR_STATUSES.map((value) => sql`${value}`),
126
138
  sql`, `,
127
139
  );
128
- const capacity = sql.join(
129
- CAPACITY_HTTP_STATUSES.map((code) => sql`${code}`),
140
+ const nonDefect = sql.join(
141
+ NON_DEFECT_HTTP_STATUSES.map((code) => sql`${code}`),
130
142
  sql`, `,
131
143
  );
132
- return sql`(${status} in (${included}) and (${httpStatus} is null or (${httpStatus} >= ${GATEWAY_ERROR_HTTP_MIN} and ${httpStatus} not in (${capacity}))))`;
144
+ return sql`(${status} in (${included}) and (${httpStatus} is null or (${httpStatus} >= ${GATEWAY_ERROR_HTTP_MIN} and ${httpStatus} not in (${nonDefect}))))`;
133
145
  }
@@ -411,6 +411,12 @@ export class DrizzleApiKeyStore implements ApiKeyStore {
411
411
  ...(patch.clientRouterDenylist !== undefined
412
412
  ? { clientRouterDenylist: patch.clientRouterDenylist }
413
413
  : {}),
414
+ // Scopes are validated once, in `validateApiKeyRequest`, against the
415
+ // tenant scope set; the store writes what it is handed. Omitting the
416
+ // field here meant an update was type-checked, accepted, and then
417
+ // silently dropped — a grant like `routing:cli_mapping` could be
418
+ // turned on and never stick.
419
+ ...(patch.scopes === undefined ? {} : { scopes: patch.scopes }),
414
420
  })
415
421
  .where(and(eq(apiKeys.tenantId, tenantId), eq(apiKeys.id, keyId)))
416
422
  .returning();