@dharta/cli 0.6.77 → 0.6.78

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 (293) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +215 -11
  3. package/dist/agent.js +3 -2
  4. package/dist/agent.js.map +1 -1
  5. package/dist/api-error.js +6 -6
  6. package/dist/api-error.js.map +1 -1
  7. package/dist/cli.d.ts +3 -0
  8. package/dist/cli.js +860 -149
  9. package/dist/cli.js.map +1 -1
  10. package/dist/command-tree.d.ts +3 -0
  11. package/dist/command-tree.js +10 -0
  12. package/dist/command-tree.js.map +1 -0
  13. package/dist/commands/agents.d.ts +54 -17
  14. package/dist/commands/agents.js +246 -136
  15. package/dist/commands/agents.js.map +1 -1
  16. package/dist/commands/analytics.js +6 -5
  17. package/dist/commands/analytics.js.map +1 -1
  18. package/dist/commands/api.js +71 -86
  19. package/dist/commands/api.js.map +1 -1
  20. package/dist/commands/appearance.js +5 -6
  21. package/dist/commands/appearance.js.map +1 -1
  22. package/dist/commands/artifact.js +7 -6
  23. package/dist/commands/artifact.js.map +1 -1
  24. package/dist/commands/audit-log.js +2 -1
  25. package/dist/commands/audit-log.js.map +1 -1
  26. package/dist/commands/auth.js +26 -6
  27. package/dist/commands/auth.js.map +1 -1
  28. package/dist/commands/caps.js +11 -15
  29. package/dist/commands/caps.js.map +1 -1
  30. package/dist/commands/deploy.js +25 -10
  31. package/dist/commands/deploy.js.map +1 -1
  32. package/dist/commands/dev.d.ts +10 -1
  33. package/dist/commands/dev.js +56 -25
  34. package/dist/commands/dev.js.map +1 -1
  35. package/dist/commands/doctor.d.ts +2 -0
  36. package/dist/commands/doctor.js +60 -0
  37. package/dist/commands/doctor.js.map +1 -1
  38. package/dist/commands/embed-keys.js +4 -13
  39. package/dist/commands/embed-keys.js.map +1 -1
  40. package/dist/commands/env.js +4 -7
  41. package/dist/commands/env.js.map +1 -1
  42. package/dist/commands/files.js +3 -4
  43. package/dist/commands/files.js.map +1 -1
  44. package/dist/commands/fleet.d.ts +129 -0
  45. package/dist/commands/fleet.js +408 -0
  46. package/dist/commands/fleet.js.map +1 -0
  47. package/dist/commands/genui.d.ts +2 -0
  48. package/dist/commands/genui.js +53 -0
  49. package/dist/commands/genui.js.map +1 -0
  50. package/dist/commands/git-credential.js +2 -3
  51. package/dist/commands/git-credential.js.map +1 -1
  52. package/dist/commands/kartas.d.ts +9 -0
  53. package/dist/commands/kartas.js +33 -11
  54. package/dist/commands/kartas.js.map +1 -1
  55. package/dist/commands/keys.d.ts +17 -18
  56. package/dist/commands/keys.js +108 -19
  57. package/dist/commands/keys.js.map +1 -1
  58. package/dist/commands/login.js +2 -1
  59. package/dist/commands/login.js.map +1 -1
  60. package/dist/commands/members.d.ts +10 -0
  61. package/dist/commands/members.js +20 -6
  62. package/dist/commands/members.js.map +1 -1
  63. package/dist/commands/model-connections.d.ts +44 -0
  64. package/dist/commands/model-connections.js +435 -0
  65. package/dist/commands/model-connections.js.map +1 -0
  66. package/dist/commands/open.d.ts +2 -2
  67. package/dist/commands/open.js +4 -3
  68. package/dist/commands/open.js.map +1 -1
  69. package/dist/commands/org.d.ts +9 -0
  70. package/dist/commands/org.js +42 -0
  71. package/dist/commands/org.js.map +1 -0
  72. package/dist/commands/organization.d.ts +16 -0
  73. package/dist/commands/organization.js +118 -0
  74. package/dist/commands/organization.js.map +1 -0
  75. package/dist/commands/parity.js +1 -3
  76. package/dist/commands/parity.js.map +1 -1
  77. package/dist/commands/repos.d.ts +4 -0
  78. package/dist/commands/repos.js +17 -0
  79. package/dist/commands/repos.js.map +1 -0
  80. package/dist/commands/rollback.js +2 -3
  81. package/dist/commands/rollback.js.map +1 -1
  82. package/dist/commands/schedules.js +26 -21
  83. package/dist/commands/schedules.js.map +1 -1
  84. package/dist/commands/scopes.js +8 -1
  85. package/dist/commands/scopes.js.map +1 -1
  86. package/dist/commands/sessions.js +9 -3
  87. package/dist/commands/sessions.js.map +1 -1
  88. package/dist/commands/setup.js +5 -4
  89. package/dist/commands/setup.js.map +1 -1
  90. package/dist/commands/update.d.ts +1 -0
  91. package/dist/commands/update.js +24 -11
  92. package/dist/commands/update.js.map +1 -1
  93. package/dist/commands/webhooks.d.ts +4 -1
  94. package/dist/commands/webhooks.js +21 -16
  95. package/dist/commands/webhooks.js.map +1 -1
  96. package/dist/completions.js +24 -13
  97. package/dist/completions.js.map +1 -1
  98. package/dist/config.d.ts +12 -0
  99. package/dist/config.js +121 -7
  100. package/dist/config.js.map +1 -1
  101. package/dist/context.d.ts +2 -0
  102. package/dist/context.js +23 -7
  103. package/dist/context.js.map +1 -1
  104. package/dist/docs/cli-reference.d.ts +2 -0
  105. package/dist/docs/cli-reference.js +191 -0
  106. package/dist/docs/cli-reference.js.map +1 -0
  107. package/dist/exit-codes.d.ts +25 -0
  108. package/dist/exit-codes.js +107 -0
  109. package/dist/exit-codes.js.map +1 -0
  110. package/dist/genui.d.ts +178 -0
  111. package/dist/genui.js +1130 -0
  112. package/dist/genui.js.map +1 -0
  113. package/dist/harnesses.js +2 -1
  114. package/dist/harnesses.js.map +1 -1
  115. package/dist/jq.d.ts +4 -0
  116. package/dist/jq.js +91 -0
  117. package/dist/jq.js.map +1 -0
  118. package/dist/login-offer.js +6 -2
  119. package/dist/login-offer.js.map +1 -1
  120. package/dist/manifest.d.ts +12 -0
  121. package/dist/manifest.js +126 -0
  122. package/dist/manifest.js.map +1 -1
  123. package/dist/model-auth.d.ts +29 -0
  124. package/dist/model-auth.js +117 -0
  125. package/dist/model-auth.js.map +1 -0
  126. package/dist/model-settings.d.ts +23 -0
  127. package/dist/model-settings.js +186 -0
  128. package/dist/model-settings.js.map +1 -0
  129. package/dist/money.js +2 -1
  130. package/dist/money.js.map +1 -1
  131. package/dist/output.d.ts +6 -0
  132. package/dist/output.js +54 -0
  133. package/dist/output.js.map +1 -1
  134. package/dist/runtime.d.ts +1 -1
  135. package/dist/runtime.js +1 -1
  136. package/dist/scaffold.js +2 -1
  137. package/dist/scaffold.js.map +1 -1
  138. package/dist/validators.js +17 -11
  139. package/dist/validators.js.map +1 -1
  140. package/dist/version-check.d.ts +1 -1
  141. package/dist/version-check.js +1 -1
  142. package/dist/version-check.js.map +1 -1
  143. package/node_modules/@dharta/contracts/LICENSE +21 -0
  144. package/node_modules/@dharta/contracts/README.md +45 -0
  145. package/node_modules/@dharta/contracts/artifact-runtime.json +750 -0
  146. package/node_modules/@dharta/contracts/dist/activity.d.ts +62 -0
  147. package/node_modules/@dharta/contracts/dist/activity.d.ts.map +1 -0
  148. package/node_modules/@dharta/contracts/dist/activity.js +178 -0
  149. package/node_modules/@dharta/contracts/dist/activity.js.map +1 -0
  150. package/node_modules/@dharta/contracts/dist/artifact-runtime-formats.d.ts +20 -0
  151. package/node_modules/@dharta/contracts/dist/artifact-runtime-formats.d.ts.map +1 -0
  152. package/node_modules/@dharta/contracts/dist/artifact-runtime-formats.js +53 -0
  153. package/node_modules/@dharta/contracts/dist/artifact-runtime-formats.js.map +1 -0
  154. package/node_modules/@dharta/contracts/dist/artifact-runtime-validators.generated.d.ts +37 -0
  155. package/node_modules/@dharta/contracts/dist/artifact-runtime-validators.generated.d.ts.map +1 -0
  156. package/node_modules/@dharta/contracts/dist/artifact-runtime-validators.generated.js +5107 -0
  157. package/node_modules/@dharta/contracts/dist/artifact-runtime-validators.generated.js.map +1 -0
  158. package/node_modules/@dharta/contracts/dist/artifact-runtime.d.ts +154 -0
  159. package/node_modules/@dharta/contracts/dist/artifact-runtime.d.ts.map +1 -0
  160. package/node_modules/@dharta/contracts/dist/artifact-runtime.generated.d.ts +1670 -0
  161. package/node_modules/@dharta/contracts/dist/artifact-runtime.generated.d.ts.map +1 -0
  162. package/node_modules/@dharta/contracts/dist/artifact-runtime.generated.js +1903 -0
  163. package/node_modules/@dharta/contracts/dist/artifact-runtime.generated.js.map +1 -0
  164. package/node_modules/@dharta/contracts/dist/artifact-runtime.js +377 -0
  165. package/node_modules/@dharta/contracts/dist/artifact-runtime.js.map +1 -0
  166. package/node_modules/@dharta/contracts/dist/index.d.ts +6 -0
  167. package/node_modules/@dharta/contracts/dist/index.d.ts.map +1 -0
  168. package/node_modules/@dharta/contracts/dist/index.js +6 -0
  169. package/node_modules/@dharta/contracts/dist/index.js.map +1 -0
  170. package/node_modules/@dharta/contracts/dist/model-auth.d.ts +31 -0
  171. package/node_modules/@dharta/contracts/dist/model-auth.d.ts.map +1 -0
  172. package/node_modules/@dharta/contracts/dist/model-auth.js +45 -0
  173. package/node_modules/@dharta/contracts/dist/model-auth.js.map +1 -0
  174. package/node_modules/@dharta/contracts/dist/tasks.d.ts +44 -0
  175. package/node_modules/@dharta/contracts/dist/tasks.d.ts.map +1 -0
  176. package/node_modules/@dharta/contracts/dist/tasks.js +127 -0
  177. package/node_modules/@dharta/contracts/dist/tasks.js.map +1 -0
  178. package/node_modules/@dharta/contracts/dist/wire-events.d.ts +71 -0
  179. package/node_modules/@dharta/contracts/dist/wire-events.d.ts.map +1 -0
  180. package/node_modules/@dharta/contracts/dist/wire-events.js +48 -0
  181. package/node_modules/@dharta/contracts/dist/wire-events.js.map +1 -0
  182. package/node_modules/@dharta/contracts/model-auth-capabilities-v1.json +168 -0
  183. package/node_modules/@dharta/contracts/model-auth-reasons-v1.json +38 -0
  184. package/node_modules/@dharta/contracts/package.json +44 -0
  185. package/node_modules/@dharta/contracts/src/activity.ts +215 -0
  186. package/node_modules/@dharta/contracts/src/artifact-runtime-formats.ts +54 -0
  187. package/node_modules/@dharta/contracts/src/artifact-runtime-validators.generated.ts +29 -0
  188. package/node_modules/@dharta/contracts/src/artifact-runtime.generated.ts +2093 -0
  189. package/node_modules/@dharta/contracts/src/artifact-runtime.ts +520 -0
  190. package/node_modules/@dharta/contracts/src/index.ts +5 -0
  191. package/node_modules/@dharta/contracts/src/model-auth.ts +82 -0
  192. package/node_modules/@dharta/contracts/src/tasks.ts +142 -0
  193. package/node_modules/@dharta/contracts/src/wire-events.ts +150 -0
  194. package/node_modules/@dharta/contracts/wire-events.json +29 -0
  195. package/node_modules/@dharta/sdk/LICENSE +1 -1
  196. package/node_modules/@dharta/sdk/README.md +22 -8
  197. package/node_modules/@dharta/sdk/dist/errors.d.ts +9 -7
  198. package/node_modules/@dharta/sdk/dist/errors.d.ts.map +1 -1
  199. package/node_modules/@dharta/sdk/dist/errors.js +36 -18
  200. package/node_modules/@dharta/sdk/dist/errors.js.map +1 -1
  201. package/node_modules/@dharta/sdk/dist/fleet.d.ts +69 -0
  202. package/node_modules/@dharta/sdk/dist/fleet.d.ts.map +1 -0
  203. package/node_modules/@dharta/sdk/dist/fleet.js +240 -0
  204. package/node_modules/@dharta/sdk/dist/fleet.js.map +1 -0
  205. package/node_modules/@dharta/sdk/dist/http.d.ts +6 -2
  206. package/node_modules/@dharta/sdk/dist/http.d.ts.map +1 -1
  207. package/node_modules/@dharta/sdk/dist/http.js +71 -12
  208. package/node_modules/@dharta/sdk/dist/http.js.map +1 -1
  209. package/node_modules/@dharta/sdk/dist/idempotency.d.ts +12 -0
  210. package/node_modules/@dharta/sdk/dist/idempotency.d.ts.map +1 -0
  211. package/node_modules/@dharta/sdk/dist/idempotency.js +72 -0
  212. package/node_modules/@dharta/sdk/dist/idempotency.js.map +1 -0
  213. package/node_modules/@dharta/sdk/dist/index.d.ts +20 -6
  214. package/node_modules/@dharta/sdk/dist/index.d.ts.map +1 -1
  215. package/node_modules/@dharta/sdk/dist/index.js +27 -4
  216. package/node_modules/@dharta/sdk/dist/index.js.map +1 -1
  217. package/node_modules/@dharta/sdk/dist/resources.d.ts +108 -13
  218. package/node_modules/@dharta/sdk/dist/resources.d.ts.map +1 -1
  219. package/node_modules/@dharta/sdk/dist/resources.js +403 -57
  220. package/node_modules/@dharta/sdk/dist/resources.js.map +1 -1
  221. package/node_modules/@dharta/sdk/dist/types.d.ts +436 -16
  222. package/node_modules/@dharta/sdk/dist/types.d.ts.map +1 -1
  223. package/node_modules/@dharta/sdk/dist/types.js +31 -2
  224. package/node_modules/@dharta/sdk/dist/types.js.map +1 -1
  225. package/node_modules/@dharta/sdk/package.json +9 -3
  226. package/node_modules/@dharta/sdk/src/errors.ts +41 -18
  227. package/node_modules/@dharta/sdk/src/fleet.ts +339 -0
  228. package/node_modules/@dharta/sdk/src/http.ts +110 -17
  229. package/node_modules/@dharta/sdk/src/idempotency.ts +101 -0
  230. package/node_modules/@dharta/sdk/src/index.ts +50 -11
  231. package/node_modules/@dharta/sdk/src/resources.ts +549 -68
  232. package/node_modules/@dharta/sdk/src/types.ts +629 -20
  233. package/package.json +16 -6
  234. package/src/agent.ts +3 -2
  235. package/src/api-error.ts +6 -5
  236. package/src/cli.ts +978 -163
  237. package/src/command-tree.ts +13 -0
  238. package/src/commands/agents.ts +365 -167
  239. package/src/commands/analytics.ts +6 -5
  240. package/src/commands/api.ts +73 -92
  241. package/src/commands/appearance.ts +5 -6
  242. package/src/commands/artifact.ts +7 -6
  243. package/src/commands/audit-log.ts +2 -1
  244. package/src/commands/auth.ts +25 -5
  245. package/src/commands/caps.ts +11 -15
  246. package/src/commands/deploy.ts +18 -4
  247. package/src/commands/dev.ts +86 -25
  248. package/src/commands/doctor.ts +69 -0
  249. package/src/commands/embed-keys.ts +4 -14
  250. package/src/commands/env.ts +4 -7
  251. package/src/commands/files.ts +3 -4
  252. package/src/commands/fleet.ts +672 -0
  253. package/src/commands/genui.ts +59 -0
  254. package/src/commands/git-credential.ts +2 -3
  255. package/src/commands/kartas.ts +45 -11
  256. package/src/commands/keys.ts +152 -35
  257. package/src/commands/login.ts +2 -1
  258. package/src/commands/members.ts +31 -6
  259. package/src/commands/model-connections.ts +547 -0
  260. package/src/commands/open.ts +5 -4
  261. package/src/commands/org.ts +57 -0
  262. package/src/commands/organization.ts +153 -0
  263. package/src/commands/parity.ts +1 -3
  264. package/src/commands/repos.ts +23 -0
  265. package/src/commands/rollback.ts +2 -3
  266. package/src/commands/schedules.ts +33 -22
  267. package/src/commands/scopes.ts +8 -1
  268. package/src/commands/sessions.ts +9 -3
  269. package/src/commands/setup.ts +5 -4
  270. package/src/commands/update.ts +28 -12
  271. package/src/commands/webhooks.ts +30 -19
  272. package/src/completions.ts +25 -13
  273. package/src/config.ts +141 -9
  274. package/src/context.ts +34 -7
  275. package/src/docs/cli-reference.ts +206 -0
  276. package/src/exit-codes.ts +122 -0
  277. package/src/genui.ts +1398 -0
  278. package/src/harnesses.ts +2 -1
  279. package/src/jq.ts +109 -0
  280. package/src/login-offer.ts +6 -2
  281. package/src/manifest.ts +134 -0
  282. package/src/model-auth.ts +173 -0
  283. package/src/model-settings.ts +222 -0
  284. package/src/money.ts +5 -1
  285. package/src/output.ts +60 -0
  286. package/src/runtime.ts +1 -1
  287. package/src/scaffold.ts +2 -1
  288. package/src/validators.ts +18 -11
  289. package/src/version-check.ts +1 -1
  290. package/dist/commands/model-keys.d.ts +0 -22
  291. package/dist/commands/model-keys.js +0 -222
  292. package/dist/commands/model-keys.js.map +0 -1
  293. package/src/commands/model-keys.ts +0 -278
@@ -0,0 +1,101 @@
1
+ // Every Dharta mutation takes an `Idempotency-Key`. The header itself is set by
2
+ // `HttpClient`, which is the one place that can see a caller's key, a
3
+ // client-wide key and the need to mint at the same time; a resource method
4
+ // passes what the caller chose and nothing else.
5
+
6
+ // The last argument of every mutating method. Supply a key you keep and a retry
7
+ // of an ambiguous failure replays the first response instead of doing the work
8
+ // again; supply nothing and one is minted per call, which still protects the
9
+ // request from arriving twice inside the platform.
10
+ //
11
+ // The SDK never retries on its own. A retry is a decision about your workload
12
+ // (how long to wait, how many times, whether the operation still makes sense),
13
+ // and a library that guesses gets it wrong on exactly the operations that
14
+ // matter. Keep the key, retry yourself.
15
+ //
16
+ // 5xx and 429 responses are not stored server-side, so reusing the key after
17
+ // one re-drives the work rather than replaying the failure.
18
+ //
19
+ // See MAX_IDEMPOTENCY_KEY_LENGTH below for the shape a key has to have. This is
20
+ // the one place that rule is written down; the CLI and the docs point here.
21
+ export interface MutationOptions {
22
+ idempotencyKey?: string;
23
+ }
24
+
25
+ // THE rule for an Idempotency-Key, in one place. Every caller-supplied key goes
26
+ // through `assertIdempotencyKey`, wherever it came from: `MutationOptions`, a
27
+ // header a caller wrote by hand, or the client-wide `idempotencyKey` option.
28
+ //
29
+ // 255 is the server's cap (`Idempotent::MAX_KEY_LENGTH`), which it measures with
30
+ // Ruby's `String#length`, counting code points. Printable ASCII is narrower than
31
+ // the server insists on, and deliberately so: the value has to survive an HTTP
32
+ // header, and `fetch` throws a TypeError while BUILDING the request for anything
33
+ // outside ASCII, which surfaces as a message about headers long after the
34
+ // mistake. Excluding the space and the control characters also means a key
35
+ // cannot split a header. Inside 0x21 to 0x7E one character is one byte is one
36
+ // code point, so this cap and the server's measure the same thing.
37
+ //
38
+ // An empty key is rejected rather than passed on. A blank `Idempotency-Key` is
39
+ // how the platform spells "not idempotent", so accepting one would quietly turn
40
+ // the protection OFF for a caller who thought they were turning it on.
41
+ export const MAX_IDEMPOTENCY_KEY_LENGTH = 255;
42
+
43
+ const IDEMPOTENCY_KEY_PATTERN = /^[\x21-\x7e]+$/;
44
+
45
+ export const INVALID_IDEMPOTENCY_KEY_CODE = "invalid_idempotency_key";
46
+
47
+ // Carries a stable `code` so a consumer can map it without matching on English.
48
+ // The CLI maps it to exit 2, the same code every other rejected value gets.
49
+ export class InvalidIdempotencyKeyError extends Error {
50
+ readonly code = INVALID_IDEMPOTENCY_KEY_CODE;
51
+
52
+ constructor(message: string) {
53
+ super(message);
54
+ this.name = "InvalidIdempotencyKeyError";
55
+ }
56
+ }
57
+
58
+ // `source` names where the key came from, so a caller with three ways to supply
59
+ // one is told which is wrong. Returns the key, so it reads as a checkpoint.
60
+ export function assertIdempotencyKey(key: string, source: string): string {
61
+ if (key.length === 0) {
62
+ throw new InvalidIdempotencyKeyError(
63
+ `${source} cannot be empty. An empty Idempotency-Key turns idempotency off ` +
64
+ "rather than on; omit it to have one minted, or pass a value you keep.",
65
+ );
66
+ }
67
+ if (key.length > MAX_IDEMPOTENCY_KEY_LENGTH) {
68
+ throw new InvalidIdempotencyKeyError(
69
+ `${source} must be at most ${MAX_IDEMPOTENCY_KEY_LENGTH} characters, got ${key.length}.`,
70
+ );
71
+ }
72
+ if (!IDEMPOTENCY_KEY_PATTERN.test(key)) {
73
+ throw new InvalidIdempotencyKeyError(
74
+ `${source} must be printable ASCII with no spaces (0x21 to 0x7E). ` +
75
+ "The value travels as an HTTP header, which cannot carry anything else.",
76
+ );
77
+ }
78
+ return key;
79
+ }
80
+
81
+ export function randomIdempotencyKey(): string {
82
+ if (globalThis.crypto?.randomUUID) return globalThis.crypto.randomUUID();
83
+ const bytes = new Uint8Array(16);
84
+ if (globalThis.crypto?.getRandomValues) {
85
+ globalThis.crypto.getRandomValues(bytes);
86
+ } else {
87
+ for (let i = 0; i < bytes.length; i += 1) {
88
+ bytes[i] = Math.floor(Math.random() * 256);
89
+ }
90
+ }
91
+ bytes[6] = (bytes[6] & 0x0f) | 0x40;
92
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
93
+ const hex = [...bytes].map((byte) => byte.toString(16).padStart(2, "0"));
94
+ return [
95
+ hex.slice(0, 4).join(""),
96
+ hex.slice(4, 6).join(""),
97
+ hex.slice(6, 8).join(""),
98
+ hex.slice(8, 10).join(""),
99
+ hex.slice(10, 16).join(""),
100
+ ].join("-");
101
+ }
@@ -1,36 +1,75 @@
1
- import { HttpClient, type KartaOptions } from "./http.js";
1
+ import { FleetResource } from "./fleet.js";
2
+ import { HttpClient, type DhartaOptions } from "./http.js";
2
3
  import {
4
+ AgentsResource,
3
5
  ApiKeysResource,
4
6
  BillingResource,
5
- ModelKeysResource,
7
+ GithubRepositoriesResource,
8
+ KartasResource,
9
+ MembersResource,
10
+ ModelConnectionsResource,
11
+ OrganizationResource,
12
+ ReleasesResource,
13
+ SourceReposResource,
6
14
  UsageResource,
7
15
  WebhookEndpointsResource,
8
16
  } from "./resources.js";
9
17
 
10
18
  export class Dharta {
19
+ readonly agents: AgentsResource;
20
+ readonly releases: ReleasesResource;
21
+ readonly githubRepositories: GithubRepositoriesResource;
11
22
  readonly apiKeys: ApiKeysResource;
12
- readonly modelKeys: ModelKeysResource;
23
+ readonly kartas: KartasResource;
24
+ readonly members: MembersResource;
25
+ readonly modelConnections: ModelConnectionsResource;
26
+ readonly organization: OrganizationResource;
27
+ readonly sourceRepos: SourceReposResource;
13
28
  readonly webhookEndpoints: WebhookEndpointsResource;
14
29
  readonly usage: UsageResource;
15
30
  readonly billing: BillingResource;
31
+ readonly fleet: FleetResource;
16
32
 
17
- constructor(opts: KartaOptions) {
33
+ constructor(opts: DhartaOptions) {
18
34
  const http = new HttpClient(opts);
35
+ this.agents = new AgentsResource(http);
36
+ this.releases = new ReleasesResource(http);
37
+ this.githubRepositories = new GithubRepositoriesResource(http);
19
38
  this.apiKeys = new ApiKeysResource(http);
20
- this.modelKeys = new ModelKeysResource(http);
39
+ this.kartas = new KartasResource(http);
40
+ this.members = new MembersResource(http);
41
+ this.modelConnections = new ModelConnectionsResource(http);
42
+ this.organization = new OrganizationResource(http);
43
+ this.sourceRepos = new SourceReposResource(http);
21
44
  this.webhookEndpoints = new WebhookEndpointsResource(http);
22
45
  this.usage = new UsageResource(http);
23
46
  this.billing = new BillingResource(http);
47
+ this.fleet = new FleetResource(http);
24
48
  }
25
49
  }
26
50
 
27
- export type { KartaOptions, RequestOptions } from "./http.js";
51
+ export type { DhartaOptions, RequestOptions } from "./http.js";
52
+ // Every mutating method takes this as its last argument. A caller retrying an
53
+ // ambiguous failure needs to name the type to hold the key it reused.
54
+ export type { MutationOptions } from "./idempotency.js";
55
+ export {
56
+ assertIdempotencyKey,
57
+ InvalidIdempotencyKeyError,
58
+ INVALID_IDEMPOTENCY_KEY_CODE,
59
+ MAX_IDEMPOTENCY_KEY_LENGTH,
60
+ } from "./idempotency.js";
28
61
  export { HttpClient } from "./http.js";
62
+ export type { ModelConnectionApiFormat } from "./types.js";
63
+ export * from "./fleet.js";
29
64
  export * from "./types.js";
65
+ // The resource classes and their parameter and result shapes. Consumers reach
66
+ // them through `new Dharta(...)`, but the types have to be nameable: the CLI
67
+ // annotates its command functions with them.
68
+ export * from "./resources.js";
30
69
  export {
31
- KartaError,
32
- KartaAuthError,
33
- KartaForbiddenError,
34
- KartaNotFoundError,
35
- KartaValidationError,
70
+ DhartaError,
71
+ DhartaAuthError,
72
+ DhartaForbiddenError,
73
+ DhartaNotFoundError,
74
+ DhartaValidationError,
36
75
  } from "./errors.js";