@kinotic-ai/system-api 5.0.0-beta.15 → 5.0.0-beta.19

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.
package/dist/index.cjs CHANGED
@@ -44,7 +44,6 @@ __export(exports_src, {
44
44
  WorkloadOrchestrationService: () => WorkloadOrchestrationService,
45
45
  VmProviderType: () => VmProviderType,
46
46
  VmNodeStatusType: () => VmNodeStatusType,
47
- VmNodeStatus: () => VmNodeStatus,
48
47
  VmNodeServiceProxy: () => VmNodeServiceProxy,
49
48
  VmNodeRegistration: () => VmNodeRegistration,
50
49
  VmNodeOrchestrationServiceProxy: () => VmNodeOrchestrationServiceProxy,
@@ -54,7 +53,7 @@ __export(exports_src, {
54
53
  SystemMemberService: () => SystemMemberService,
55
54
  SystemApiPlugin: () => SystemApiPlugin,
56
55
  SingleLoggerLevelsDescriptor: () => SingleLoggerLevelsDescriptor,
57
- SYSTEM_API_ZONE: () => import_management_api9.SYSTEM_API_ZONE,
56
+ SYSTEM_API_ZONE: () => import_management_api10.SYSTEM_API_ZONE,
58
57
  LoggersDescriptor: () => LoggersDescriptor,
59
58
  LoggerLevelsDescriptor: () => LoggerLevelsDescriptor,
60
59
  LogManager: () => LogManager,
@@ -65,22 +64,10 @@ __export(exports_src, {
65
64
  GroupLoggerLevelsDescriptor: () => GroupLoggerLevelsDescriptor
66
65
  });
67
66
  module.exports = __toCommonJS(exports_src);
68
- var import_management_api9 = require("@kinotic-ai/management-api");
69
-
70
- // packages/system-api/src/api/model/workload/VmNodeStatusType.ts
71
- var VmNodeStatusType;
72
- ((VmNodeStatusType2) => {
73
- VmNodeStatusType2["ONLINE"] = "ONLINE";
74
- VmNodeStatusType2["OFFLINE"] = "OFFLINE";
75
- VmNodeStatusType2["DRAINING"] = "DRAINING";
76
- VmNodeStatusType2["UNREACHABLE"] = "UNREACHABLE";
77
- })(VmNodeStatusType ||= {});
67
+ var import_management_api10 = require("@kinotic-ai/management-api");
78
68
 
79
- // packages/system-api/src/api/model/workload/VmNodeStatus.ts
80
- class VmNodeStatus {
81
- type = "ONLINE" /* ONLINE */;
82
- healthMessage = null;
83
- }
69
+ // packages/system-api/src/api/model/workload/VmNode.ts
70
+ var import_management_api = require("@kinotic-ai/management-api");
84
71
 
85
72
  // packages/system-api/src/api/model/workload/VmProviderType.ts
86
73
  var VmProviderType;
@@ -94,15 +81,15 @@ class VmNode {
94
81
  id;
95
82
  name;
96
83
  hostname;
97
- status = new VmNodeStatus;
84
+ state = new import_management_api.ReconcileState;
85
+ healthMessage = null;
98
86
  providerType = "BOXLITE" /* BOXLITE */;
99
87
  totalCpus = 0;
100
88
  totalMemoryMb = 0;
101
89
  totalDiskMb = 0;
102
- availableCpus = 0;
103
- availableMemoryMb = 0;
104
- availableDiskMb = 0;
105
- reservations = [];
90
+ freeCpus = 0;
91
+ freeMemoryMb = 0;
92
+ freeDiskMb = 0;
106
93
  lastSeen = null;
107
94
  workloadDataDir = null;
108
95
  constructor(id, name, hostname) {
@@ -111,7 +98,13 @@ class VmNode {
111
98
  this.hostname = hostname;
112
99
  }
113
100
  }
114
- // packages/system-api/src/api/model/VmNodeRegistration.ts
101
+ // packages/system-api/src/api/model/workload/VmNodeStatusType.ts
102
+ var VmNodeStatusType;
103
+ ((VmNodeStatusType2) => {
104
+ VmNodeStatusType2["ONLINE"] = "ONLINE";
105
+ VmNodeStatusType2["DRAINING"] = "DRAINING";
106
+ })(VmNodeStatusType ||= {});
107
+ // packages/system-api/src/api/model/workload/VmNodeRegistration.ts
115
108
  class VmNodeRegistration {
116
109
  id;
117
110
  name;
@@ -127,28 +120,32 @@ class VmNodeRegistration {
127
120
  this.hostname = hostname;
128
121
  }
129
122
  }
130
- // packages/system-api/src/api/services/IVmNodeService.ts
131
- var import_management_api = require("@kinotic-ai/management-api");
123
+ // packages/system-api/src/api/services/workload/IVmNodeService.ts
124
+ var import_management_api2 = require("@kinotic-ai/management-api");
132
125
  var import_core = require("@kinotic-ai/core");
133
126
 
134
127
  class VmNodeServiceProxy extends import_core.CrudServiceProxy {
135
128
  constructor(kinotic) {
136
- super(kinotic.serviceProxy(`${import_management_api.SYSTEM_API_ZONE}~org.kinotic.system.api.services.VmNodeService`));
129
+ super(kinotic.serviceProxy(`${import_management_api2.SYSTEM_API_ZONE}~org.kinotic.system.api.services.workload.VmNodeService`));
130
+ }
131
+ async findHistory(nodeId, pageable) {
132
+ const page = await this.findHistorySinglePage(nodeId, pageable);
133
+ return new import_core.FunctionalIterablePage(pageable, page, (pageable2) => this.findHistorySinglePage(nodeId, pageable2));
137
134
  }
138
- findAvailableNode(requiredCpus, requiredMemoryMb, requiredDiskMb) {
139
- return this.serviceProxy.invoke("findAvailableNode", [requiredCpus, requiredMemoryMb, requiredDiskMb]);
135
+ findHistorySinglePage(nodeId, pageable) {
136
+ return this.serviceProxy.invoke("findHistory", [nodeId, pageable]);
140
137
  }
141
138
  syncIndex() {
142
139
  return this.serviceProxy.invoke("syncIndex", []);
143
140
  }
144
141
  }
145
- // packages/system-api/src/api/services/IWorkloadService.ts
146
- var import_management_api2 = require("@kinotic-ai/management-api");
142
+ // packages/system-api/src/api/services/workload/IWorkloadService.ts
143
+ var import_management_api3 = require("@kinotic-ai/management-api");
147
144
  var import_core2 = require("@kinotic-ai/core");
148
145
 
149
146
  class WorkloadServiceProxy extends import_core2.CrudServiceProxy {
150
147
  constructor(kinotic) {
151
- super(kinotic.serviceProxy(`${import_management_api2.SYSTEM_API_ZONE}~org.kinotic.system.api.services.WorkloadService`));
148
+ super(kinotic.serviceProxy(`${import_management_api3.SYSTEM_API_ZONE}~org.kinotic.system.api.services.workload.WorkloadService`));
152
149
  }
153
150
  async findAllForNode(nodeId, pageable) {
154
151
  const page = await this.findAllForNodeSinglePage(nodeId, pageable);
@@ -157,41 +154,48 @@ class WorkloadServiceProxy extends import_core2.CrudServiceProxy {
157
154
  findAllForNodeSinglePage(nodeId, pageable) {
158
155
  return this.serviceProxy.invoke("findAllForNode", [nodeId, pageable]);
159
156
  }
160
- countForNode(nodeId) {
161
- return this.serviceProxy.invoke("countForNode", [nodeId]);
157
+ async findHistory(workloadId, pageable) {
158
+ const page = await this.findHistorySinglePage(workloadId, pageable);
159
+ return new import_core2.FunctionalIterablePage(pageable, page, (pageable2) => this.findHistorySinglePage(workloadId, pageable2));
160
+ }
161
+ findHistorySinglePage(workloadId, pageable) {
162
+ return this.serviceProxy.invoke("findHistory", [workloadId, pageable]);
162
163
  }
163
164
  syncIndex() {
164
165
  return this.serviceProxy.invoke("syncIndex", []);
165
166
  }
166
167
  }
167
- // packages/system-api/src/api/services/IWorkloadOrchestrationService.ts
168
- var import_management_api3 = require("@kinotic-ai/management-api");
168
+ // packages/system-api/src/api/services/workload/IWorkloadOrchestrationService.ts
169
+ var import_management_api4 = require("@kinotic-ai/management-api");
169
170
 
170
171
  class WorkloadOrchestrationService {
171
172
  serviceProxy;
172
173
  constructor(kinotic) {
173
- this.serviceProxy = kinotic.serviceProxy(`${import_management_api3.SYSTEM_API_ZONE}~org.kinotic.system.api.services.WorkloadOrchestrationService`);
174
+ this.serviceProxy = kinotic.serviceProxy(`${import_management_api4.SYSTEM_API_ZONE}~org.kinotic.system.api.services.workload.WorkloadOrchestrationService`);
174
175
  }
175
176
  deployWorkload(workload) {
176
177
  return this.serviceProxy.invoke("deployWorkload", [workload]);
177
178
  }
178
- restartWorkload(workloadId) {
179
- return this.serviceProxy.invoke("restartWorkload", [workloadId]);
180
- }
181
179
  stopWorkload(workloadId) {
182
180
  return this.serviceProxy.invoke("stopWorkload", [workloadId]);
183
181
  }
184
182
  destroyWorkload(workloadId) {
185
183
  return this.serviceProxy.invoke("destroyWorkload", [workloadId]);
186
184
  }
185
+ deleteWorkload(workloadId) {
186
+ return this.serviceProxy.invoke("deleteWorkload", [workloadId]);
187
+ }
188
+ deleteWorkloads(workloadIds) {
189
+ return this.serviceProxy.invoke("deleteWorkloads", [workloadIds]);
190
+ }
187
191
  }
188
- // packages/system-api/src/api/services/VmNodeOrchestrationServiceProxy.ts
189
- var import_management_api4 = require("@kinotic-ai/management-api");
192
+ // packages/system-api/src/api/services/workload/VmNodeOrchestrationServiceProxy.ts
193
+ var import_management_api5 = require("@kinotic-ai/management-api");
190
194
 
191
195
  class VmNodeOrchestrationServiceProxy {
192
196
  serviceProxy;
193
197
  constructor(kinotic) {
194
- this.serviceProxy = kinotic.serviceProxy(`${import_management_api4.SYSTEM_API_ZONE}~org.kinotic.system.api.services.VmNodeOrchestrationService`);
198
+ this.serviceProxy = kinotic.serviceProxy(`${import_management_api5.SYSTEM_API_ZONE}~org.kinotic.system.api.services.workload.VmNodeOrchestrationService`);
195
199
  }
196
200
  registerNode(registration) {
197
201
  return this.serviceProxy.invoke("registerNode", [registration]);
@@ -207,7 +211,7 @@ class VmNodeOrchestrationServiceProxy {
207
211
  }
208
212
  }
209
213
  // packages/system-api/src/api/services/LogManager.ts
210
- var import_management_api5 = require("@kinotic-ai/management-api");
214
+ var import_management_api6 = require("@kinotic-ai/management-api");
211
215
 
212
216
  // packages/system-api/src/api/services/ILogManager.ts
213
217
  var LogLevel;
@@ -248,7 +252,7 @@ class TraceLogProperties {
248
252
  class LogManager {
249
253
  serviceProxy;
250
254
  constructor(kinotic) {
251
- this.serviceProxy = kinotic.serviceProxy(`${import_management_api5.SYSTEM_API_ZONE}~org.kinotic.system.api.services.LogManager`);
255
+ this.serviceProxy = kinotic.serviceProxy(`${import_management_api6.SYSTEM_API_ZONE}~org.kinotic.system.api.services.LogManager`);
252
256
  }
253
257
  loggers(nodeId) {
254
258
  return this.serviceProxy.invoke("loggers", null, nodeId);
@@ -281,12 +285,12 @@ class LogManager {
281
285
  }
282
286
 
283
287
  // packages/system-api/src/api/services/IKinoticClusterInfoService.ts
284
- var import_management_api6 = require("@kinotic-ai/management-api");
288
+ var import_management_api7 = require("@kinotic-ai/management-api");
285
289
 
286
290
  class KinoticClusterInfoService {
287
291
  serviceProxy;
288
292
  constructor(kinotic) {
289
- this.serviceProxy = kinotic.serviceProxy(`${import_management_api6.SYSTEM_API_ZONE}~org.kinotic.system.api.services.KinoticClusterInfoService`);
293
+ this.serviceProxy = kinotic.serviceProxy(`${import_management_api7.SYSTEM_API_ZONE}~org.kinotic.system.api.services.KinoticClusterInfoService`);
290
294
  }
291
295
  getClusterInfo() {
292
296
  return this.serviceProxy.invoke("getClusterInfo");
@@ -294,12 +298,12 @@ class KinoticClusterInfoService {
294
298
  }
295
299
 
296
300
  // packages/system-api/src/api/services/ISystemOrganizationService.ts
297
- var import_management_api7 = require("@kinotic-ai/management-api");
301
+ var import_management_api8 = require("@kinotic-ai/management-api");
298
302
 
299
303
  class SystemOrganizationService {
300
304
  serviceProxy;
301
305
  constructor(kinotic) {
302
- this.serviceProxy = kinotic.serviceProxy(`${import_management_api7.SYSTEM_API_ZONE}~org.kinotic.system.api.services.SystemOrganizationService`);
306
+ this.serviceProxy = kinotic.serviceProxy(`${import_management_api8.SYSTEM_API_ZONE}~org.kinotic.system.api.services.SystemOrganizationService`);
303
307
  }
304
308
  findOrganizations(pageable) {
305
309
  return this.serviceProxy.invoke("findOrganizations", [pageable]);
@@ -331,12 +335,12 @@ class SystemOrganizationService {
331
335
  }
332
336
 
333
337
  // packages/system-api/src/api/services/ISystemMemberService.ts
334
- var import_management_api8 = require("@kinotic-ai/management-api");
338
+ var import_management_api9 = require("@kinotic-ai/management-api");
335
339
 
336
340
  class SystemMemberService {
337
341
  serviceProxy;
338
342
  constructor(kinotic) {
339
- this.serviceProxy = kinotic.serviceProxy(`${import_management_api8.SYSTEM_API_ZONE}~org.kinotic.system.api.services.SystemMemberService`);
343
+ this.serviceProxy = kinotic.serviceProxy(`${import_management_api9.SYSTEM_API_ZONE}~org.kinotic.system.api.services.SystemMemberService`);
340
344
  }
341
345
  findUsers(pageable) {
342
346
  return this.serviceProxy.invoke("findUsers", [pageable]);
@@ -375,7 +379,7 @@ var SystemApiPlugin = {
375
379
  };
376
380
  }
377
381
  };
378
- // packages/system-api/src/api/model/KinoticClusterInfo.ts
382
+ // packages/system-api/src/api/model/cluster/KinoticClusterInfo.ts
379
383
  class KinoticClusterInfo {
380
384
  localNodeId = "";
381
385
  serverNodeCount = 0;
@@ -384,7 +388,7 @@ class KinoticClusterInfo {
384
388
  nodes = [];
385
389
  active = false;
386
390
  }
387
- // packages/system-api/src/api/model/KinoticNodeInfo.ts
391
+ // packages/system-api/src/api/model/cluster/KinoticNodeInfo.ts
388
392
  class KinoticNodeInfo {
389
393
  nodeId = "";
390
394
  order = 0;
package/dist/index.d.cts CHANGED
@@ -1,45 +1,26 @@
1
1
  import { SYSTEM_API_ZONE } from "@kinotic-ai/management-api";
2
- import { Identifiable } from "@kinotic-ai/core";
3
- declare enum VmNodeStatusType {
4
- ONLINE = "ONLINE",
5
- OFFLINE = "OFFLINE",
6
- DRAINING = "DRAINING",
7
- UNREACHABLE = "UNREACHABLE"
8
- }
2
+ import { ReconcileState, Reconcilable } from "@kinotic-ai/management-api";
9
3
  /**
10
- * Whether a node is fit to receive workloads, and why when it is not.
4
+ * Whether a node is taking workloads, as the node reports it. A node the platform cannot reach is
5
+ * not a phase the node can report: it carries the condition NODE_UNREACHABLE beside what it last
6
+ * reported.
11
7
  */
12
- declare class VmNodeStatus {
13
- /**
14
- * Whether the node is taking workloads.
15
- */
16
- type: VmNodeStatusType;
8
+ declare enum VmNodeStatusType {
9
+ ONLINE = "ONLINE",
17
10
  /**
18
- * Why the node is not taking workloads, or null when it is. Set from the node's own report
19
- * of the guarantees it can still make — a data root that stopped enforcing disk limits, or
20
- * a firewall that stopped hiding host credentials from guests.
11
+ * The node reported something it can no longer guarantee: it keeps the workloads it has and takes
12
+ * no more until it reports no problems.
21
13
  */
22
- healthMessage: string | null;
14
+ DRAINING = "DRAINING"
23
15
  }
24
16
  /**
25
- * The room one workload holds on a VmNode: its CPU, memory and disk while its VM runs, and its
26
- * disk alone once the run has ended, since a VM that is kept for a restart keeps its disk on the
27
- * node. A workload holds at most one reservation per node, keyed by its id.
17
+ * The reconciled state of a node: the shape both the intent and the observation take, so a node is
18
+ * in its desired state exactly when the two are equal. Intent is that the node takes workloads;
19
+ * observation is what the node reports it can do.
28
20
  */
29
- interface WorkloadReservation {
30
- /** The id of the workload holding the reservation. */
31
- workloadId: string;
32
- /** CPU the workload's VM is allotted, in cores; a fraction is a share of one core. */
33
- cpus: number;
34
- /** Memory the workload's VM is allotted, in megabytes. */
35
- memoryMb: number;
36
- /** Disk the workload's VM is allotted, in megabytes. */
37
- diskMb: number;
38
- /**
39
- * True while the workload's run holds its CPU and memory; false once the run has ended and
40
- * only the disk is still held.
41
- */
42
- running: boolean;
21
+ interface VmNodeState {
22
+ /** Whether the node takes workloads. */
23
+ phase: VmNodeStatusType;
43
24
  }
44
25
  declare enum VmProviderType {
45
26
  BOXLITE = "BOXLITE",
@@ -49,7 +30,7 @@ declare enum VmProviderType {
49
30
  * Represents a node in the cluster that is running a VmManager process
50
31
  * and is capable of hosting workloads.
51
32
  */
52
- declare class VmNode implements Identifiable<string> {
33
+ declare class VmNode implements Reconcilable<VmNodeState> {
53
34
  /**
54
35
  * Unique identifier for this node.
55
36
  */
@@ -63,9 +44,17 @@ declare class VmNode implements Identifiable<string> {
63
44
  */
64
45
  hostname: string;
65
46
  /**
66
- * Whether the node is fit to receive workloads, and why when it is not.
47
+ * What the node should be, taking workloads, and what it reports it is, with what the platform
48
+ * inferred beside the node's word: that it fell silent, or that a call to it could not be
49
+ * delivered. A node is placeable exactly when this is reconciled.
50
+ */
51
+ state: ReconcileState<VmNodeState>;
52
+ /**
53
+ * Why the node is not taking workloads, or null when it is. Set from the node's own report of
54
+ * the guarantees it can still make — a data root that stopped enforcing disk limits, or a
55
+ * firewall that stopped hiding host credentials from guests.
67
56
  */
68
- status: VmNodeStatus;
57
+ healthMessage: string | null;
69
58
  /**
70
59
  * The VM provider this node runs every workload on, determined by how the node was
71
60
  * provisioned and reported when it registers.
@@ -85,23 +74,17 @@ declare class VmNode implements Identifiable<string> {
85
74
  totalDiskMb: number;
86
75
  /**
87
76
  * CPU not allocated to any workload, in cores. What is allocated is
88
- * totalCpus - availableCpus, the sum of the reservations that are running.
77
+ * totalCpus - freeCpus, what the workloads running on the node are sized for.
89
78
  */
90
- availableCpus: number;
79
+ freeCpus: number;
91
80
  /**
92
81
  * Memory not allocated to any workload, in megabytes.
93
82
  */
94
- availableMemoryMb: number;
83
+ freeMemoryMb: number;
95
84
  /**
96
85
  * Disk space not allocated to any workload, in megabytes.
97
86
  */
98
- availableDiskMb: number;
99
- /**
100
- * The room each workload placed on this node holds, one entry per workload. The available*
101
- * fields are the totals less what these hold, so a workload's room is reserved and released
102
- * by its id and never counted twice.
103
- */
104
- reservations: WorkloadReservation[];
87
+ freeDiskMb: number;
105
88
  /**
106
89
  * The date and time the node was last seen/heartbeat.
107
90
  */
@@ -166,17 +149,18 @@ interface WorkloadStatusReport {
166
149
  /** When the node recorded this status, in epoch milliseconds. */
167
150
  updated: number;
168
151
  }
152
+ import { WatchEvent } from "@kinotic-ai/management-api";
169
153
  import { IKinotic } from "@kinotic-ai/core";
170
- import { CrudServiceProxy, ICrudServiceProxy } from "@kinotic-ai/core";
154
+ import { CrudServiceProxy, ICrudServiceProxy, IterablePage, Page, Pageable } from "@kinotic-ai/core";
171
155
  interface IVmNodeService extends ICrudServiceProxy<VmNode> {
172
156
  /**
173
- * Finds a node with sufficient resources to host a workload with the given requirements.
174
- * @param requiredCpus the CPU required, in cores
175
- * @param requiredMemoryMb the amount of memory required in megabytes
176
- * @param requiredDiskMb the amount of disk space required in megabytes
177
- * @return a Promise resolving to a suitable node, or null if none available
157
+ * Lists what happened to the node, newest first: each change of what it should be and of what it
158
+ * reports, and each mark set beside them, with what caused it.
159
+ * @param nodeId the id of the node
160
+ * @param pageable the page to return
161
+ * @return a Promise resolving to a page of ledger entries, empty when the node is not registered
178
162
  */
179
- findAvailableNode(requiredCpus: number, requiredMemoryMb: number, requiredDiskMb: number): Promise<VmNode | null>;
163
+ findHistory(nodeId: string, pageable: Pageable): Promise<IterablePage<WatchEvent>>;
180
164
  /**
181
165
  * This operation makes all the recent writes immediately available for search.
182
166
  * @return a Promise that resolves when the operation is complete
@@ -185,11 +169,12 @@ interface IVmNodeService extends ICrudServiceProxy<VmNode> {
185
169
  }
186
170
  declare class VmNodeServiceProxy extends CrudServiceProxy<VmNode> implements IVmNodeService {
187
171
  constructor(kinotic: IKinotic);
188
- findAvailableNode(requiredCpus: number, requiredMemoryMb: number, requiredDiskMb: number): Promise<VmNode | null>;
172
+ findHistory(nodeId: string, pageable: Pageable): Promise<IterablePage<WatchEvent>>;
173
+ findHistorySinglePage(nodeId: string, pageable: Pageable): Promise<Page<WatchEvent>>;
189
174
  syncIndex(): Promise<void>;
190
175
  }
191
- import { Workload } from "@kinotic-ai/management-api";
192
- import { CrudServiceProxy as CrudServiceProxy2, IKinotic as IKinotic2, ICrudServiceProxy as ICrudServiceProxy2, IterablePage, Page, Pageable } from "@kinotic-ai/core";
176
+ import { Workload, WatchEvent as WatchEvent2 } from "@kinotic-ai/management-api";
177
+ import { CrudServiceProxy as CrudServiceProxy2, IKinotic as IKinotic2, ICrudServiceProxy as ICrudServiceProxy2, IterablePage as IterablePage2, Page as Page2, Pageable as Pageable2 } from "@kinotic-ai/core";
193
178
  interface IWorkloadService extends ICrudServiceProxy2<Workload> {
194
179
  /**
195
180
  * Finds all workloads deployed on the given node.
@@ -197,13 +182,15 @@ interface IWorkloadService extends ICrudServiceProxy2<Workload> {
197
182
  * @param pageable the page to return
198
183
  * @return a Promise resolving to a page of workloads
199
184
  */
200
- findAllForNode(nodeId: string, pageable: Pageable): Promise<IterablePage<Workload>>;
185
+ findAllForNode(nodeId: string, pageable: Pageable2): Promise<IterablePage2<Workload>>;
201
186
  /**
202
- * Counts all workloads deployed on the given node.
203
- * @param nodeId the id of the node to count workloads for
204
- * @return a Promise resolving to the number of workloads
187
+ * Lists what happened to the workload, newest first: each status its run passed through and each
188
+ * mark set beside it, with what caused it.
189
+ * @param workloadId the workload
190
+ * @param pageable the page to return
191
+ * @return a Promise resolving to a page of ledger entries, empty when the workload does not exist
205
192
  */
206
- countForNode(nodeId: string): Promise<number>;
193
+ findHistory(workloadId: string, pageable: Pageable2): Promise<IterablePage2<WatchEvent2>>;
207
194
  /**
208
195
  * This operation makes all the recent writes immediately available for search.
209
196
  * @return a Promise that resolves when the operation is complete
@@ -212,9 +199,10 @@ interface IWorkloadService extends ICrudServiceProxy2<Workload> {
212
199
  }
213
200
  declare class WorkloadServiceProxy extends CrudServiceProxy2<Workload> implements IWorkloadService {
214
201
  constructor(kinotic: IKinotic2);
215
- findAllForNode(nodeId: string, pageable: Pageable): Promise<IterablePage<Workload>>;
216
- findAllForNodeSinglePage(nodeId: string, pageable: Pageable): Promise<Page<Workload>>;
217
- countForNode(nodeId: string): Promise<number>;
202
+ findAllForNode(nodeId: string, pageable: Pageable2): Promise<IterablePage2<Workload>>;
203
+ findAllForNodeSinglePage(nodeId: string, pageable: Pageable2): Promise<Page2<Workload>>;
204
+ findHistory(workloadId: string, pageable: Pageable2): Promise<IterablePage2<WatchEvent2>>;
205
+ findHistorySinglePage(workloadId: string, pageable: Pageable2): Promise<Page2<WatchEvent2>>;
218
206
  syncIndex(): Promise<void>;
219
207
  }
220
208
  import { Workload as Workload2 } from "@kinotic-ai/management-api";
@@ -236,33 +224,46 @@ interface IWorkloadOrchestrationService {
236
224
  */
237
225
  deployWorkload(workload: Workload2): Promise<Workload2>;
238
226
  /**
239
- * Restarts a stopped workload in place on the node it is deployed to. Fails unless the
240
- * workload is stopped; a workload stopped with autoRemove true has no VM left to restart.
241
- * Honors the workload's detached flag the same way as {@link deployWorkload}.
242
- * @param workloadId the id of the workload to restart
243
- * @return a Promise resolving to the restarted workload
244
- */
245
- restartWorkload(workloadId: string): Promise<Workload2>;
246
- /**
247
227
  * Stops a running workload.
248
228
  * @param workloadId the id of the workload to stop
249
229
  * @return a Promise that resolves when the workload has been stopped
250
230
  */
251
231
  stopWorkload(workloadId: string): Promise<void>;
252
232
  /**
253
- * Destroys a workload, removing it from the node and cleaning up all resources.
233
+ * Destroys a workload's VM on its node, with its disk, and returns its room. A run still open is
234
+ * recorded STOPPED. The record stays as the run's outcome, and its logs stay in the log store,
235
+ * until deleteWorkload.
254
236
  * @param workloadId the id of the workload to destroy
255
- * @return a Promise that resolves when the workload has been destroyed
237
+ * @return a Promise that resolves when the VM has been destroyed
256
238
  */
257
239
  destroyWorkload(workloadId: string): Promise<void>;
240
+ /**
241
+ * Deletes a workload's record and every log line it wrote from the organization's log store, the
242
+ * one way either is removed. A run still open on its node — starting, running, or a stop the node
243
+ * has not answered — is refused: stop or destroy it first.
244
+ * @param workloadId the id of the workload to delete
245
+ * @return a Promise that resolves when the record and its logs are gone, or rejects if the run is
246
+ * still open
247
+ */
248
+ deleteWorkload(workloadId: string): Promise<void>;
249
+ /**
250
+ * Deletes the given workloads' records and every log line they wrote, as deleteWorkload does for
251
+ * one, with the log store asked once per organization. Any run still open refuses the whole batch
252
+ * before anything is deleted.
253
+ * @param workloadIds the ids of the workloads to delete
254
+ * @return a Promise that resolves when the records and their logs are gone, or rejects if any run
255
+ * is still open
256
+ */
257
+ deleteWorkloads(workloadIds: string[]): Promise<void>;
258
258
  }
259
259
  declare class WorkloadOrchestrationService implements IWorkloadOrchestrationService {
260
260
  private readonly serviceProxy;
261
261
  constructor(kinotic: IKinotic3);
262
262
  deployWorkload(workload: Workload2): Promise<Workload2>;
263
- restartWorkload(workloadId: string): Promise<Workload2>;
264
263
  stopWorkload(workloadId: string): Promise<void>;
265
264
  destroyWorkload(workloadId: string): Promise<void>;
265
+ deleteWorkload(workloadId: string): Promise<void>;
266
+ deleteWorkloads(workloadIds: string[]): Promise<void>;
266
267
  }
267
268
  import { IKinotic as IKinotic4 } from "@kinotic-ai/core";
268
269
  /**
@@ -420,40 +421,40 @@ declare class KinoticClusterInfoService implements IKinoticClusterInfoService {
420
421
  getClusterInfo(): Promise<KinoticClusterInfo>;
421
422
  }
422
423
  import { Application, Organization, Project, PendingInviteSummary, UserParticipantIdentity } from "@kinotic-ai/management-api";
423
- import { IKinotic as IKinotic6, Page as Page2, Pageable as Pageable2 } from "@kinotic-ai/core";
424
+ import { IKinotic as IKinotic6, Page as Page3, Pageable as Pageable3 } from "@kinotic-ai/core";
424
425
  /**
425
426
  * Cross-organization reads for platform operators. Published in the system zone, which only
426
427
  * SYSTEM participants may address, so every method takes the target organization explicitly
427
428
  * instead of resolving it from the caller's scope.
428
429
  */
429
430
  interface ISystemOrganizationService {
430
- findOrganizations(pageable: Pageable2): Promise<Page2<Organization>>;
431
- searchOrganizations(searchText: string, pageable: Pageable2): Promise<Page2<Organization>>;
431
+ findOrganizations(pageable: Pageable3): Promise<Page3<Organization>>;
432
+ searchOrganizations(searchText: string, pageable: Pageable3): Promise<Page3<Organization>>;
432
433
  /** Resolves null when no organization has the given id. */
433
434
  findOrganizationById(organizationId: string): Promise<Organization | null>;
434
435
  countOrganizations(): Promise<number>;
435
- findApplications(organizationId: string, pageable: Pageable2): Promise<Page2<Application>>;
436
- findProjects(organizationId: string, pageable: Pageable2): Promise<Page2<Project>>;
436
+ findApplications(organizationId: string, pageable: Pageable3): Promise<Page3<Application>>;
437
+ findProjects(organizationId: string, pageable: Pageable3): Promise<Page3<Project>>;
437
438
  /** applicationId null = the organization's members */
438
- findMembers(organizationId: string, applicationId: string | null, pageable: Pageable2): Promise<Page2<UserParticipantIdentity>>;
439
- searchMembers(searchText: string, organizationId: string, applicationId: string | null, pageable: Pageable2): Promise<Page2<UserParticipantIdentity>>;
440
- findPendingInvites(organizationId: string, applicationId: string | null, pageable: Pageable2): Promise<Page2<PendingInviteSummary>>;
439
+ findMembers(organizationId: string, applicationId: string | null, pageable: Pageable3): Promise<Page3<UserParticipantIdentity>>;
440
+ searchMembers(searchText: string, organizationId: string, applicationId: string | null, pageable: Pageable3): Promise<Page3<UserParticipantIdentity>>;
441
+ findPendingInvites(organizationId: string, applicationId: string | null, pageable: Pageable3): Promise<Page3<PendingInviteSummary>>;
441
442
  }
442
443
  declare class SystemOrganizationService implements ISystemOrganizationService {
443
444
  private readonly serviceProxy;
444
445
  constructor(kinotic: IKinotic6);
445
- findOrganizations(pageable: Pageable2): Promise<Page2<Organization>>;
446
- searchOrganizations(searchText: string, pageable: Pageable2): Promise<Page2<Organization>>;
446
+ findOrganizations(pageable: Pageable3): Promise<Page3<Organization>>;
447
+ searchOrganizations(searchText: string, pageable: Pageable3): Promise<Page3<Organization>>;
447
448
  findOrganizationById(organizationId: string): Promise<Organization | null>;
448
449
  countOrganizations(): Promise<number>;
449
- findApplications(organizationId: string, pageable: Pageable2): Promise<Page2<Application>>;
450
- findProjects(organizationId: string, pageable: Pageable2): Promise<Page2<Project>>;
451
- findMembers(organizationId: string, applicationId: string | null, pageable: Pageable2): Promise<Page2<UserParticipantIdentity>>;
452
- searchMembers(searchText: string, organizationId: string, applicationId: string | null, pageable: Pageable2): Promise<Page2<UserParticipantIdentity>>;
453
- findPendingInvites(organizationId: string, applicationId: string | null, pageable: Pageable2): Promise<Page2<PendingInviteSummary>>;
450
+ findApplications(organizationId: string, pageable: Pageable3): Promise<Page3<Application>>;
451
+ findProjects(organizationId: string, pageable: Pageable3): Promise<Page3<Project>>;
452
+ findMembers(organizationId: string, applicationId: string | null, pageable: Pageable3): Promise<Page3<UserParticipantIdentity>>;
453
+ searchMembers(searchText: string, organizationId: string, applicationId: string | null, pageable: Pageable3): Promise<Page3<UserParticipantIdentity>>;
454
+ findPendingInvites(organizationId: string, applicationId: string | null, pageable: Pageable3): Promise<Page3<PendingInviteSummary>>;
454
455
  }
455
456
  import { MachineParticipantIdentity, MachineProvisionResult, UserParticipantIdentity as UserParticipantIdentity2 } from "@kinotic-ai/management-api";
456
- import { IKinotic as IKinotic7, Page as Page3, Pageable as Pageable3 } from "@kinotic-ai/core";
457
+ import { IKinotic as IKinotic7, Page as Page4, Pageable as Pageable4 } from "@kinotic-ai/core";
457
458
  /**
458
459
  * The platform's own members: the operators who sign in to the system console, and the
459
460
  * SYSTEM-scope machines that connect as platform daemons, such as a worker node's vm-manager.
@@ -462,10 +463,10 @@ import { IKinotic as IKinotic7, Page as Page3, Pageable as Pageable3 } from "@ki
462
463
  * manage through IMachineService.
463
464
  */
464
465
  interface ISystemMemberService {
465
- findUsers(pageable: Pageable3): Promise<Page3<UserParticipantIdentity2>>;
466
- searchUsers(searchText: string, pageable: Pageable3): Promise<Page3<UserParticipantIdentity2>>;
466
+ findUsers(pageable: Pageable4): Promise<Page4<UserParticipantIdentity2>>;
467
+ searchUsers(searchText: string, pageable: Pageable4): Promise<Page4<UserParticipantIdentity2>>;
467
468
  /** Lists the platform's machines, disabled ones included. */
468
- findMachines(pageable: Pageable3): Promise<Page3<MachineParticipantIdentity>>;
469
+ findMachines(pageable: Pageable4): Promise<Page4<MachineParticipantIdentity>>;
469
470
  /**
470
471
  * Provisions a platform machine and returns it together with its generated client secret.
471
472
  * The secret is disclosed exactly once — it cannot be retrieved later.
@@ -491,9 +492,9 @@ interface ISystemMemberService {
491
492
  declare class SystemMemberService implements ISystemMemberService {
492
493
  private readonly serviceProxy;
493
494
  constructor(kinotic: IKinotic7);
494
- findUsers(pageable: Pageable3): Promise<Page3<UserParticipantIdentity2>>;
495
- searchUsers(searchText: string, pageable: Pageable3): Promise<Page3<UserParticipantIdentity2>>;
496
- findMachines(pageable: Pageable3): Promise<Page3<MachineParticipantIdentity>>;
495
+ findUsers(pageable: Pageable4): Promise<Page4<UserParticipantIdentity2>>;
496
+ searchUsers(searchText: string, pageable: Pageable4): Promise<Page4<UserParticipantIdentity2>>;
497
+ findMachines(pageable: Pageable4): Promise<Page4<MachineParticipantIdentity>>;
497
498
  createMachine(displayName: string): Promise<MachineProvisionResult>;
498
499
  rotateSecret(machineId: string): Promise<string>;
499
500
  setMachineEnabled(machineId: string, enabled: boolean): Promise<void>;
@@ -522,4 +523,4 @@ declare class LogManager implements ILogManager {
522
523
  declare module "@kinotic-ai/core" {
523
524
  interface KinoticSingleton extends ISystemApiExtension {}
524
525
  }
525
- export { WorkloadStatusReport, WorkloadServiceProxy, WorkloadReservation, WorkloadOrchestrationService, VmProviderType, VmNodeStatusType, VmNodeStatus, VmNodeServiceProxy, VmNodeRegistration, VmNodeOrchestrationServiceProxy, VmNode, TraceLogProperties, SystemOrganizationService, SystemMemberService, SystemApiPlugin, SingleLoggerLevelsDescriptor, SYSTEM_API_ZONE, LoggersDescriptor, LoggerLevelsDescriptor, LogManager, LogLevel, KinoticNodeInfo, KinoticClusterInfoService, KinoticClusterInfo, IWorkloadService, IWorkloadOrchestrationService, IVmNodeService, ISystemOrganizationService, ISystemMemberService, ISystemApiExtension, ILogManager, IKinoticClusterInfoService, GroupLoggerLevelsDescriptor };
526
+ export { WorkloadStatusReport, WorkloadServiceProxy, WorkloadOrchestrationService, VmProviderType, VmNodeStatusType, VmNodeState, VmNodeServiceProxy, VmNodeRegistration, VmNodeOrchestrationServiceProxy, VmNode, TraceLogProperties, SystemOrganizationService, SystemMemberService, SystemApiPlugin, SingleLoggerLevelsDescriptor, SYSTEM_API_ZONE, LoggersDescriptor, LoggerLevelsDescriptor, LogManager, LogLevel, KinoticNodeInfo, KinoticClusterInfoService, KinoticClusterInfo, IWorkloadService, IWorkloadOrchestrationService, IVmNodeService, ISystemOrganizationService, ISystemMemberService, ISystemApiExtension, ILogManager, IKinoticClusterInfoService, GroupLoggerLevelsDescriptor };
package/dist/index.d.ts CHANGED
@@ -1,45 +1,26 @@
1
1
  import { SYSTEM_API_ZONE } from "@kinotic-ai/management-api";
2
- import { Identifiable } from "@kinotic-ai/core";
3
- declare enum VmNodeStatusType {
4
- ONLINE = "ONLINE",
5
- OFFLINE = "OFFLINE",
6
- DRAINING = "DRAINING",
7
- UNREACHABLE = "UNREACHABLE"
8
- }
2
+ import { ReconcileState, Reconcilable } from "@kinotic-ai/management-api";
9
3
  /**
10
- * Whether a node is fit to receive workloads, and why when it is not.
4
+ * Whether a node is taking workloads, as the node reports it. A node the platform cannot reach is
5
+ * not a phase the node can report: it carries the condition NODE_UNREACHABLE beside what it last
6
+ * reported.
11
7
  */
12
- declare class VmNodeStatus {
13
- /**
14
- * Whether the node is taking workloads.
15
- */
16
- type: VmNodeStatusType;
8
+ declare enum VmNodeStatusType {
9
+ ONLINE = "ONLINE",
17
10
  /**
18
- * Why the node is not taking workloads, or null when it is. Set from the node's own report
19
- * of the guarantees it can still make — a data root that stopped enforcing disk limits, or
20
- * a firewall that stopped hiding host credentials from guests.
11
+ * The node reported something it can no longer guarantee: it keeps the workloads it has and takes
12
+ * no more until it reports no problems.
21
13
  */
22
- healthMessage: string | null;
14
+ DRAINING = "DRAINING"
23
15
  }
24
16
  /**
25
- * The room one workload holds on a VmNode: its CPU, memory and disk while its VM runs, and its
26
- * disk alone once the run has ended, since a VM that is kept for a restart keeps its disk on the
27
- * node. A workload holds at most one reservation per node, keyed by its id.
17
+ * The reconciled state of a node: the shape both the intent and the observation take, so a node is
18
+ * in its desired state exactly when the two are equal. Intent is that the node takes workloads;
19
+ * observation is what the node reports it can do.
28
20
  */
29
- interface WorkloadReservation {
30
- /** The id of the workload holding the reservation. */
31
- workloadId: string;
32
- /** CPU the workload's VM is allotted, in cores; a fraction is a share of one core. */
33
- cpus: number;
34
- /** Memory the workload's VM is allotted, in megabytes. */
35
- memoryMb: number;
36
- /** Disk the workload's VM is allotted, in megabytes. */
37
- diskMb: number;
38
- /**
39
- * True while the workload's run holds its CPU and memory; false once the run has ended and
40
- * only the disk is still held.
41
- */
42
- running: boolean;
21
+ interface VmNodeState {
22
+ /** Whether the node takes workloads. */
23
+ phase: VmNodeStatusType;
43
24
  }
44
25
  declare enum VmProviderType {
45
26
  BOXLITE = "BOXLITE",
@@ -49,7 +30,7 @@ declare enum VmProviderType {
49
30
  * Represents a node in the cluster that is running a VmManager process
50
31
  * and is capable of hosting workloads.
51
32
  */
52
- declare class VmNode implements Identifiable<string> {
33
+ declare class VmNode implements Reconcilable<VmNodeState> {
53
34
  /**
54
35
  * Unique identifier for this node.
55
36
  */
@@ -63,9 +44,17 @@ declare class VmNode implements Identifiable<string> {
63
44
  */
64
45
  hostname: string;
65
46
  /**
66
- * Whether the node is fit to receive workloads, and why when it is not.
47
+ * What the node should be, taking workloads, and what it reports it is, with what the platform
48
+ * inferred beside the node's word: that it fell silent, or that a call to it could not be
49
+ * delivered. A node is placeable exactly when this is reconciled.
50
+ */
51
+ state: ReconcileState<VmNodeState>;
52
+ /**
53
+ * Why the node is not taking workloads, or null when it is. Set from the node's own report of
54
+ * the guarantees it can still make — a data root that stopped enforcing disk limits, or a
55
+ * firewall that stopped hiding host credentials from guests.
67
56
  */
68
- status: VmNodeStatus;
57
+ healthMessage: string | null;
69
58
  /**
70
59
  * The VM provider this node runs every workload on, determined by how the node was
71
60
  * provisioned and reported when it registers.
@@ -85,23 +74,17 @@ declare class VmNode implements Identifiable<string> {
85
74
  totalDiskMb: number;
86
75
  /**
87
76
  * CPU not allocated to any workload, in cores. What is allocated is
88
- * totalCpus - availableCpus, the sum of the reservations that are running.
77
+ * totalCpus - freeCpus, what the workloads running on the node are sized for.
89
78
  */
90
- availableCpus: number;
79
+ freeCpus: number;
91
80
  /**
92
81
  * Memory not allocated to any workload, in megabytes.
93
82
  */
94
- availableMemoryMb: number;
83
+ freeMemoryMb: number;
95
84
  /**
96
85
  * Disk space not allocated to any workload, in megabytes.
97
86
  */
98
- availableDiskMb: number;
99
- /**
100
- * The room each workload placed on this node holds, one entry per workload. The available*
101
- * fields are the totals less what these hold, so a workload's room is reserved and released
102
- * by its id and never counted twice.
103
- */
104
- reservations: WorkloadReservation[];
87
+ freeDiskMb: number;
105
88
  /**
106
89
  * The date and time the node was last seen/heartbeat.
107
90
  */
@@ -166,17 +149,18 @@ interface WorkloadStatusReport {
166
149
  /** When the node recorded this status, in epoch milliseconds. */
167
150
  updated: number;
168
151
  }
152
+ import { WatchEvent } from "@kinotic-ai/management-api";
169
153
  import { IKinotic } from "@kinotic-ai/core";
170
- import { CrudServiceProxy, ICrudServiceProxy } from "@kinotic-ai/core";
154
+ import { CrudServiceProxy, ICrudServiceProxy, IterablePage, Page, Pageable } from "@kinotic-ai/core";
171
155
  interface IVmNodeService extends ICrudServiceProxy<VmNode> {
172
156
  /**
173
- * Finds a node with sufficient resources to host a workload with the given requirements.
174
- * @param requiredCpus the CPU required, in cores
175
- * @param requiredMemoryMb the amount of memory required in megabytes
176
- * @param requiredDiskMb the amount of disk space required in megabytes
177
- * @return a Promise resolving to a suitable node, or null if none available
157
+ * Lists what happened to the node, newest first: each change of what it should be and of what it
158
+ * reports, and each mark set beside them, with what caused it.
159
+ * @param nodeId the id of the node
160
+ * @param pageable the page to return
161
+ * @return a Promise resolving to a page of ledger entries, empty when the node is not registered
178
162
  */
179
- findAvailableNode(requiredCpus: number, requiredMemoryMb: number, requiredDiskMb: number): Promise<VmNode | null>;
163
+ findHistory(nodeId: string, pageable: Pageable): Promise<IterablePage<WatchEvent>>;
180
164
  /**
181
165
  * This operation makes all the recent writes immediately available for search.
182
166
  * @return a Promise that resolves when the operation is complete
@@ -185,11 +169,12 @@ interface IVmNodeService extends ICrudServiceProxy<VmNode> {
185
169
  }
186
170
  declare class VmNodeServiceProxy extends CrudServiceProxy<VmNode> implements IVmNodeService {
187
171
  constructor(kinotic: IKinotic);
188
- findAvailableNode(requiredCpus: number, requiredMemoryMb: number, requiredDiskMb: number): Promise<VmNode | null>;
172
+ findHistory(nodeId: string, pageable: Pageable): Promise<IterablePage<WatchEvent>>;
173
+ findHistorySinglePage(nodeId: string, pageable: Pageable): Promise<Page<WatchEvent>>;
189
174
  syncIndex(): Promise<void>;
190
175
  }
191
- import { Workload } from "@kinotic-ai/management-api";
192
- import { CrudServiceProxy as CrudServiceProxy2, IKinotic as IKinotic2, ICrudServiceProxy as ICrudServiceProxy2, IterablePage, Page, Pageable } from "@kinotic-ai/core";
176
+ import { Workload, WatchEvent as WatchEvent2 } from "@kinotic-ai/management-api";
177
+ import { CrudServiceProxy as CrudServiceProxy2, IKinotic as IKinotic2, ICrudServiceProxy as ICrudServiceProxy2, IterablePage as IterablePage2, Page as Page2, Pageable as Pageable2 } from "@kinotic-ai/core";
193
178
  interface IWorkloadService extends ICrudServiceProxy2<Workload> {
194
179
  /**
195
180
  * Finds all workloads deployed on the given node.
@@ -197,13 +182,15 @@ interface IWorkloadService extends ICrudServiceProxy2<Workload> {
197
182
  * @param pageable the page to return
198
183
  * @return a Promise resolving to a page of workloads
199
184
  */
200
- findAllForNode(nodeId: string, pageable: Pageable): Promise<IterablePage<Workload>>;
185
+ findAllForNode(nodeId: string, pageable: Pageable2): Promise<IterablePage2<Workload>>;
201
186
  /**
202
- * Counts all workloads deployed on the given node.
203
- * @param nodeId the id of the node to count workloads for
204
- * @return a Promise resolving to the number of workloads
187
+ * Lists what happened to the workload, newest first: each status its run passed through and each
188
+ * mark set beside it, with what caused it.
189
+ * @param workloadId the workload
190
+ * @param pageable the page to return
191
+ * @return a Promise resolving to a page of ledger entries, empty when the workload does not exist
205
192
  */
206
- countForNode(nodeId: string): Promise<number>;
193
+ findHistory(workloadId: string, pageable: Pageable2): Promise<IterablePage2<WatchEvent2>>;
207
194
  /**
208
195
  * This operation makes all the recent writes immediately available for search.
209
196
  * @return a Promise that resolves when the operation is complete
@@ -212,9 +199,10 @@ interface IWorkloadService extends ICrudServiceProxy2<Workload> {
212
199
  }
213
200
  declare class WorkloadServiceProxy extends CrudServiceProxy2<Workload> implements IWorkloadService {
214
201
  constructor(kinotic: IKinotic2);
215
- findAllForNode(nodeId: string, pageable: Pageable): Promise<IterablePage<Workload>>;
216
- findAllForNodeSinglePage(nodeId: string, pageable: Pageable): Promise<Page<Workload>>;
217
- countForNode(nodeId: string): Promise<number>;
202
+ findAllForNode(nodeId: string, pageable: Pageable2): Promise<IterablePage2<Workload>>;
203
+ findAllForNodeSinglePage(nodeId: string, pageable: Pageable2): Promise<Page2<Workload>>;
204
+ findHistory(workloadId: string, pageable: Pageable2): Promise<IterablePage2<WatchEvent2>>;
205
+ findHistorySinglePage(workloadId: string, pageable: Pageable2): Promise<Page2<WatchEvent2>>;
218
206
  syncIndex(): Promise<void>;
219
207
  }
220
208
  import { Workload as Workload2 } from "@kinotic-ai/management-api";
@@ -236,33 +224,46 @@ interface IWorkloadOrchestrationService {
236
224
  */
237
225
  deployWorkload(workload: Workload2): Promise<Workload2>;
238
226
  /**
239
- * Restarts a stopped workload in place on the node it is deployed to. Fails unless the
240
- * workload is stopped; a workload stopped with autoRemove true has no VM left to restart.
241
- * Honors the workload's detached flag the same way as {@link deployWorkload}.
242
- * @param workloadId the id of the workload to restart
243
- * @return a Promise resolving to the restarted workload
244
- */
245
- restartWorkload(workloadId: string): Promise<Workload2>;
246
- /**
247
227
  * Stops a running workload.
248
228
  * @param workloadId the id of the workload to stop
249
229
  * @return a Promise that resolves when the workload has been stopped
250
230
  */
251
231
  stopWorkload(workloadId: string): Promise<void>;
252
232
  /**
253
- * Destroys a workload, removing it from the node and cleaning up all resources.
233
+ * Destroys a workload's VM on its node, with its disk, and returns its room. A run still open is
234
+ * recorded STOPPED. The record stays as the run's outcome, and its logs stay in the log store,
235
+ * until deleteWorkload.
254
236
  * @param workloadId the id of the workload to destroy
255
- * @return a Promise that resolves when the workload has been destroyed
237
+ * @return a Promise that resolves when the VM has been destroyed
256
238
  */
257
239
  destroyWorkload(workloadId: string): Promise<void>;
240
+ /**
241
+ * Deletes a workload's record and every log line it wrote from the organization's log store, the
242
+ * one way either is removed. A run still open on its node — starting, running, or a stop the node
243
+ * has not answered — is refused: stop or destroy it first.
244
+ * @param workloadId the id of the workload to delete
245
+ * @return a Promise that resolves when the record and its logs are gone, or rejects if the run is
246
+ * still open
247
+ */
248
+ deleteWorkload(workloadId: string): Promise<void>;
249
+ /**
250
+ * Deletes the given workloads' records and every log line they wrote, as deleteWorkload does for
251
+ * one, with the log store asked once per organization. Any run still open refuses the whole batch
252
+ * before anything is deleted.
253
+ * @param workloadIds the ids of the workloads to delete
254
+ * @return a Promise that resolves when the records and their logs are gone, or rejects if any run
255
+ * is still open
256
+ */
257
+ deleteWorkloads(workloadIds: string[]): Promise<void>;
258
258
  }
259
259
  declare class WorkloadOrchestrationService implements IWorkloadOrchestrationService {
260
260
  private readonly serviceProxy;
261
261
  constructor(kinotic: IKinotic3);
262
262
  deployWorkload(workload: Workload2): Promise<Workload2>;
263
- restartWorkload(workloadId: string): Promise<Workload2>;
264
263
  stopWorkload(workloadId: string): Promise<void>;
265
264
  destroyWorkload(workloadId: string): Promise<void>;
265
+ deleteWorkload(workloadId: string): Promise<void>;
266
+ deleteWorkloads(workloadIds: string[]): Promise<void>;
266
267
  }
267
268
  import { IKinotic as IKinotic4 } from "@kinotic-ai/core";
268
269
  /**
@@ -420,40 +421,40 @@ declare class KinoticClusterInfoService implements IKinoticClusterInfoService {
420
421
  getClusterInfo(): Promise<KinoticClusterInfo>;
421
422
  }
422
423
  import { Application, Organization, Project, PendingInviteSummary, UserParticipantIdentity } from "@kinotic-ai/management-api";
423
- import { IKinotic as IKinotic6, Page as Page2, Pageable as Pageable2 } from "@kinotic-ai/core";
424
+ import { IKinotic as IKinotic6, Page as Page3, Pageable as Pageable3 } from "@kinotic-ai/core";
424
425
  /**
425
426
  * Cross-organization reads for platform operators. Published in the system zone, which only
426
427
  * SYSTEM participants may address, so every method takes the target organization explicitly
427
428
  * instead of resolving it from the caller's scope.
428
429
  */
429
430
  interface ISystemOrganizationService {
430
- findOrganizations(pageable: Pageable2): Promise<Page2<Organization>>;
431
- searchOrganizations(searchText: string, pageable: Pageable2): Promise<Page2<Organization>>;
431
+ findOrganizations(pageable: Pageable3): Promise<Page3<Organization>>;
432
+ searchOrganizations(searchText: string, pageable: Pageable3): Promise<Page3<Organization>>;
432
433
  /** Resolves null when no organization has the given id. */
433
434
  findOrganizationById(organizationId: string): Promise<Organization | null>;
434
435
  countOrganizations(): Promise<number>;
435
- findApplications(organizationId: string, pageable: Pageable2): Promise<Page2<Application>>;
436
- findProjects(organizationId: string, pageable: Pageable2): Promise<Page2<Project>>;
436
+ findApplications(organizationId: string, pageable: Pageable3): Promise<Page3<Application>>;
437
+ findProjects(organizationId: string, pageable: Pageable3): Promise<Page3<Project>>;
437
438
  /** applicationId null = the organization's members */
438
- findMembers(organizationId: string, applicationId: string | null, pageable: Pageable2): Promise<Page2<UserParticipantIdentity>>;
439
- searchMembers(searchText: string, organizationId: string, applicationId: string | null, pageable: Pageable2): Promise<Page2<UserParticipantIdentity>>;
440
- findPendingInvites(organizationId: string, applicationId: string | null, pageable: Pageable2): Promise<Page2<PendingInviteSummary>>;
439
+ findMembers(organizationId: string, applicationId: string | null, pageable: Pageable3): Promise<Page3<UserParticipantIdentity>>;
440
+ searchMembers(searchText: string, organizationId: string, applicationId: string | null, pageable: Pageable3): Promise<Page3<UserParticipantIdentity>>;
441
+ findPendingInvites(organizationId: string, applicationId: string | null, pageable: Pageable3): Promise<Page3<PendingInviteSummary>>;
441
442
  }
442
443
  declare class SystemOrganizationService implements ISystemOrganizationService {
443
444
  private readonly serviceProxy;
444
445
  constructor(kinotic: IKinotic6);
445
- findOrganizations(pageable: Pageable2): Promise<Page2<Organization>>;
446
- searchOrganizations(searchText: string, pageable: Pageable2): Promise<Page2<Organization>>;
446
+ findOrganizations(pageable: Pageable3): Promise<Page3<Organization>>;
447
+ searchOrganizations(searchText: string, pageable: Pageable3): Promise<Page3<Organization>>;
447
448
  findOrganizationById(organizationId: string): Promise<Organization | null>;
448
449
  countOrganizations(): Promise<number>;
449
- findApplications(organizationId: string, pageable: Pageable2): Promise<Page2<Application>>;
450
- findProjects(organizationId: string, pageable: Pageable2): Promise<Page2<Project>>;
451
- findMembers(organizationId: string, applicationId: string | null, pageable: Pageable2): Promise<Page2<UserParticipantIdentity>>;
452
- searchMembers(searchText: string, organizationId: string, applicationId: string | null, pageable: Pageable2): Promise<Page2<UserParticipantIdentity>>;
453
- findPendingInvites(organizationId: string, applicationId: string | null, pageable: Pageable2): Promise<Page2<PendingInviteSummary>>;
450
+ findApplications(organizationId: string, pageable: Pageable3): Promise<Page3<Application>>;
451
+ findProjects(organizationId: string, pageable: Pageable3): Promise<Page3<Project>>;
452
+ findMembers(organizationId: string, applicationId: string | null, pageable: Pageable3): Promise<Page3<UserParticipantIdentity>>;
453
+ searchMembers(searchText: string, organizationId: string, applicationId: string | null, pageable: Pageable3): Promise<Page3<UserParticipantIdentity>>;
454
+ findPendingInvites(organizationId: string, applicationId: string | null, pageable: Pageable3): Promise<Page3<PendingInviteSummary>>;
454
455
  }
455
456
  import { MachineParticipantIdentity, MachineProvisionResult, UserParticipantIdentity as UserParticipantIdentity2 } from "@kinotic-ai/management-api";
456
- import { IKinotic as IKinotic7, Page as Page3, Pageable as Pageable3 } from "@kinotic-ai/core";
457
+ import { IKinotic as IKinotic7, Page as Page4, Pageable as Pageable4 } from "@kinotic-ai/core";
457
458
  /**
458
459
  * The platform's own members: the operators who sign in to the system console, and the
459
460
  * SYSTEM-scope machines that connect as platform daemons, such as a worker node's vm-manager.
@@ -462,10 +463,10 @@ import { IKinotic as IKinotic7, Page as Page3, Pageable as Pageable3 } from "@ki
462
463
  * manage through IMachineService.
463
464
  */
464
465
  interface ISystemMemberService {
465
- findUsers(pageable: Pageable3): Promise<Page3<UserParticipantIdentity2>>;
466
- searchUsers(searchText: string, pageable: Pageable3): Promise<Page3<UserParticipantIdentity2>>;
466
+ findUsers(pageable: Pageable4): Promise<Page4<UserParticipantIdentity2>>;
467
+ searchUsers(searchText: string, pageable: Pageable4): Promise<Page4<UserParticipantIdentity2>>;
467
468
  /** Lists the platform's machines, disabled ones included. */
468
- findMachines(pageable: Pageable3): Promise<Page3<MachineParticipantIdentity>>;
469
+ findMachines(pageable: Pageable4): Promise<Page4<MachineParticipantIdentity>>;
469
470
  /**
470
471
  * Provisions a platform machine and returns it together with its generated client secret.
471
472
  * The secret is disclosed exactly once — it cannot be retrieved later.
@@ -491,9 +492,9 @@ interface ISystemMemberService {
491
492
  declare class SystemMemberService implements ISystemMemberService {
492
493
  private readonly serviceProxy;
493
494
  constructor(kinotic: IKinotic7);
494
- findUsers(pageable: Pageable3): Promise<Page3<UserParticipantIdentity2>>;
495
- searchUsers(searchText: string, pageable: Pageable3): Promise<Page3<UserParticipantIdentity2>>;
496
- findMachines(pageable: Pageable3): Promise<Page3<MachineParticipantIdentity>>;
495
+ findUsers(pageable: Pageable4): Promise<Page4<UserParticipantIdentity2>>;
496
+ searchUsers(searchText: string, pageable: Pageable4): Promise<Page4<UserParticipantIdentity2>>;
497
+ findMachines(pageable: Pageable4): Promise<Page4<MachineParticipantIdentity>>;
497
498
  createMachine(displayName: string): Promise<MachineProvisionResult>;
498
499
  rotateSecret(machineId: string): Promise<string>;
499
500
  setMachineEnabled(machineId: string, enabled: boolean): Promise<void>;
@@ -522,4 +523,4 @@ declare class LogManager implements ILogManager {
522
523
  declare module "@kinotic-ai/core" {
523
524
  interface KinoticSingleton extends ISystemApiExtension {}
524
525
  }
525
- export { WorkloadStatusReport, WorkloadServiceProxy, WorkloadReservation, WorkloadOrchestrationService, VmProviderType, VmNodeStatusType, VmNodeStatus, VmNodeServiceProxy, VmNodeRegistration, VmNodeOrchestrationServiceProxy, VmNode, TraceLogProperties, SystemOrganizationService, SystemMemberService, SystemApiPlugin, SingleLoggerLevelsDescriptor, SYSTEM_API_ZONE, LoggersDescriptor, LoggerLevelsDescriptor, LogManager, LogLevel, KinoticNodeInfo, KinoticClusterInfoService, KinoticClusterInfo, IWorkloadService, IWorkloadOrchestrationService, IVmNodeService, ISystemOrganizationService, ISystemMemberService, ISystemApiExtension, ILogManager, IKinoticClusterInfoService, GroupLoggerLevelsDescriptor };
526
+ export { WorkloadStatusReport, WorkloadServiceProxy, WorkloadOrchestrationService, VmProviderType, VmNodeStatusType, VmNodeState, VmNodeServiceProxy, VmNodeRegistration, VmNodeOrchestrationServiceProxy, VmNode, TraceLogProperties, SystemOrganizationService, SystemMemberService, SystemApiPlugin, SingleLoggerLevelsDescriptor, SYSTEM_API_ZONE, LoggersDescriptor, LoggerLevelsDescriptor, LogManager, LogLevel, KinoticNodeInfo, KinoticClusterInfoService, KinoticClusterInfo, IWorkloadService, IWorkloadOrchestrationService, IVmNodeService, ISystemOrganizationService, ISystemMemberService, ISystemApiExtension, ILogManager, IKinoticClusterInfoService, GroupLoggerLevelsDescriptor };
package/dist/index.js CHANGED
@@ -1,20 +1,8 @@
1
1
  // packages/system-api/src/index.ts
2
2
  import { SYSTEM_API_ZONE as SYSTEM_API_ZONE9 } from "@kinotic-ai/management-api";
3
3
 
4
- // packages/system-api/src/api/model/workload/VmNodeStatusType.ts
5
- var VmNodeStatusType;
6
- ((VmNodeStatusType2) => {
7
- VmNodeStatusType2["ONLINE"] = "ONLINE";
8
- VmNodeStatusType2["OFFLINE"] = "OFFLINE";
9
- VmNodeStatusType2["DRAINING"] = "DRAINING";
10
- VmNodeStatusType2["UNREACHABLE"] = "UNREACHABLE";
11
- })(VmNodeStatusType ||= {});
12
-
13
- // packages/system-api/src/api/model/workload/VmNodeStatus.ts
14
- class VmNodeStatus {
15
- type = "ONLINE" /* ONLINE */;
16
- healthMessage = null;
17
- }
4
+ // packages/system-api/src/api/model/workload/VmNode.ts
5
+ import { ReconcileState } from "@kinotic-ai/management-api";
18
6
 
19
7
  // packages/system-api/src/api/model/workload/VmProviderType.ts
20
8
  var VmProviderType;
@@ -28,15 +16,15 @@ class VmNode {
28
16
  id;
29
17
  name;
30
18
  hostname;
31
- status = new VmNodeStatus;
19
+ state = new ReconcileState;
20
+ healthMessage = null;
32
21
  providerType = "BOXLITE" /* BOXLITE */;
33
22
  totalCpus = 0;
34
23
  totalMemoryMb = 0;
35
24
  totalDiskMb = 0;
36
- availableCpus = 0;
37
- availableMemoryMb = 0;
38
- availableDiskMb = 0;
39
- reservations = [];
25
+ freeCpus = 0;
26
+ freeMemoryMb = 0;
27
+ freeDiskMb = 0;
40
28
  lastSeen = null;
41
29
  workloadDataDir = null;
42
30
  constructor(id, name, hostname) {
@@ -45,7 +33,13 @@ class VmNode {
45
33
  this.hostname = hostname;
46
34
  }
47
35
  }
48
- // packages/system-api/src/api/model/VmNodeRegistration.ts
36
+ // packages/system-api/src/api/model/workload/VmNodeStatusType.ts
37
+ var VmNodeStatusType;
38
+ ((VmNodeStatusType2) => {
39
+ VmNodeStatusType2["ONLINE"] = "ONLINE";
40
+ VmNodeStatusType2["DRAINING"] = "DRAINING";
41
+ })(VmNodeStatusType ||= {});
42
+ // packages/system-api/src/api/model/workload/VmNodeRegistration.ts
49
43
  class VmNodeRegistration {
50
44
  id;
51
45
  name;
@@ -61,71 +55,82 @@ class VmNodeRegistration {
61
55
  this.hostname = hostname;
62
56
  }
63
57
  }
64
- // packages/system-api/src/api/services/IVmNodeService.ts
58
+ // packages/system-api/src/api/services/workload/IVmNodeService.ts
65
59
  import { SYSTEM_API_ZONE } from "@kinotic-ai/management-api";
66
- import { CrudServiceProxy } from "@kinotic-ai/core";
60
+ import { CrudServiceProxy, FunctionalIterablePage } from "@kinotic-ai/core";
67
61
 
68
62
  class VmNodeServiceProxy extends CrudServiceProxy {
69
63
  constructor(kinotic) {
70
- super(kinotic.serviceProxy(`${SYSTEM_API_ZONE}~org.kinotic.system.api.services.VmNodeService`));
64
+ super(kinotic.serviceProxy(`${SYSTEM_API_ZONE}~org.kinotic.system.api.services.workload.VmNodeService`));
71
65
  }
72
- findAvailableNode(requiredCpus, requiredMemoryMb, requiredDiskMb) {
73
- return this.serviceProxy.invoke("findAvailableNode", [requiredCpus, requiredMemoryMb, requiredDiskMb]);
66
+ async findHistory(nodeId, pageable) {
67
+ const page = await this.findHistorySinglePage(nodeId, pageable);
68
+ return new FunctionalIterablePage(pageable, page, (pageable2) => this.findHistorySinglePage(nodeId, pageable2));
69
+ }
70
+ findHistorySinglePage(nodeId, pageable) {
71
+ return this.serviceProxy.invoke("findHistory", [nodeId, pageable]);
74
72
  }
75
73
  syncIndex() {
76
74
  return this.serviceProxy.invoke("syncIndex", []);
77
75
  }
78
76
  }
79
- // packages/system-api/src/api/services/IWorkloadService.ts
77
+ // packages/system-api/src/api/services/workload/IWorkloadService.ts
80
78
  import { SYSTEM_API_ZONE as SYSTEM_API_ZONE2 } from "@kinotic-ai/management-api";
81
- import { CrudServiceProxy as CrudServiceProxy2, FunctionalIterablePage } from "@kinotic-ai/core";
79
+ import { CrudServiceProxy as CrudServiceProxy2, FunctionalIterablePage as FunctionalIterablePage2 } from "@kinotic-ai/core";
82
80
 
83
81
  class WorkloadServiceProxy extends CrudServiceProxy2 {
84
82
  constructor(kinotic) {
85
- super(kinotic.serviceProxy(`${SYSTEM_API_ZONE2}~org.kinotic.system.api.services.WorkloadService`));
83
+ super(kinotic.serviceProxy(`${SYSTEM_API_ZONE2}~org.kinotic.system.api.services.workload.WorkloadService`));
86
84
  }
87
85
  async findAllForNode(nodeId, pageable) {
88
86
  const page = await this.findAllForNodeSinglePage(nodeId, pageable);
89
- return new FunctionalIterablePage(pageable, page, (pageable2) => this.findAllForNodeSinglePage(nodeId, pageable2));
87
+ return new FunctionalIterablePage2(pageable, page, (pageable2) => this.findAllForNodeSinglePage(nodeId, pageable2));
90
88
  }
91
89
  findAllForNodeSinglePage(nodeId, pageable) {
92
90
  return this.serviceProxy.invoke("findAllForNode", [nodeId, pageable]);
93
91
  }
94
- countForNode(nodeId) {
95
- return this.serviceProxy.invoke("countForNode", [nodeId]);
92
+ async findHistory(workloadId, pageable) {
93
+ const page = await this.findHistorySinglePage(workloadId, pageable);
94
+ return new FunctionalIterablePage2(pageable, page, (pageable2) => this.findHistorySinglePage(workloadId, pageable2));
95
+ }
96
+ findHistorySinglePage(workloadId, pageable) {
97
+ return this.serviceProxy.invoke("findHistory", [workloadId, pageable]);
96
98
  }
97
99
  syncIndex() {
98
100
  return this.serviceProxy.invoke("syncIndex", []);
99
101
  }
100
102
  }
101
- // packages/system-api/src/api/services/IWorkloadOrchestrationService.ts
103
+ // packages/system-api/src/api/services/workload/IWorkloadOrchestrationService.ts
102
104
  import { SYSTEM_API_ZONE as SYSTEM_API_ZONE3 } from "@kinotic-ai/management-api";
103
105
 
104
106
  class WorkloadOrchestrationService {
105
107
  serviceProxy;
106
108
  constructor(kinotic) {
107
- this.serviceProxy = kinotic.serviceProxy(`${SYSTEM_API_ZONE3}~org.kinotic.system.api.services.WorkloadOrchestrationService`);
109
+ this.serviceProxy = kinotic.serviceProxy(`${SYSTEM_API_ZONE3}~org.kinotic.system.api.services.workload.WorkloadOrchestrationService`);
108
110
  }
109
111
  deployWorkload(workload) {
110
112
  return this.serviceProxy.invoke("deployWorkload", [workload]);
111
113
  }
112
- restartWorkload(workloadId) {
113
- return this.serviceProxy.invoke("restartWorkload", [workloadId]);
114
- }
115
114
  stopWorkload(workloadId) {
116
115
  return this.serviceProxy.invoke("stopWorkload", [workloadId]);
117
116
  }
118
117
  destroyWorkload(workloadId) {
119
118
  return this.serviceProxy.invoke("destroyWorkload", [workloadId]);
120
119
  }
120
+ deleteWorkload(workloadId) {
121
+ return this.serviceProxy.invoke("deleteWorkload", [workloadId]);
122
+ }
123
+ deleteWorkloads(workloadIds) {
124
+ return this.serviceProxy.invoke("deleteWorkloads", [workloadIds]);
125
+ }
121
126
  }
122
- // packages/system-api/src/api/services/VmNodeOrchestrationServiceProxy.ts
127
+ // packages/system-api/src/api/services/workload/VmNodeOrchestrationServiceProxy.ts
123
128
  import { SYSTEM_API_ZONE as SYSTEM_API_ZONE4 } from "@kinotic-ai/management-api";
124
129
 
125
130
  class VmNodeOrchestrationServiceProxy {
126
131
  serviceProxy;
127
132
  constructor(kinotic) {
128
- this.serviceProxy = kinotic.serviceProxy(`${SYSTEM_API_ZONE4}~org.kinotic.system.api.services.VmNodeOrchestrationService`);
133
+ this.serviceProxy = kinotic.serviceProxy(`${SYSTEM_API_ZONE4}~org.kinotic.system.api.services.workload.VmNodeOrchestrationService`);
129
134
  }
130
135
  registerNode(registration) {
131
136
  return this.serviceProxy.invoke("registerNode", [registration]);
@@ -313,7 +318,7 @@ var SystemApiPlugin = {
313
318
  };
314
319
  }
315
320
  };
316
- // packages/system-api/src/api/model/KinoticClusterInfo.ts
321
+ // packages/system-api/src/api/model/cluster/KinoticClusterInfo.ts
317
322
  class KinoticClusterInfo {
318
323
  localNodeId = "";
319
324
  serverNodeCount = 0;
@@ -322,7 +327,7 @@ class KinoticClusterInfo {
322
327
  nodes = [];
323
328
  active = false;
324
329
  }
325
- // packages/system-api/src/api/model/KinoticNodeInfo.ts
330
+ // packages/system-api/src/api/model/cluster/KinoticNodeInfo.ts
326
331
  class KinoticNodeInfo {
327
332
  nodeId = "";
328
333
  order = 0;
@@ -336,7 +341,6 @@ export {
336
341
  WorkloadOrchestrationService,
337
342
  VmProviderType,
338
343
  VmNodeStatusType,
339
- VmNodeStatus,
340
344
  VmNodeServiceProxy,
341
345
  VmNodeRegistration,
342
346
  VmNodeOrchestrationServiceProxy,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kinotic-ai/system-api",
3
- "version": "5.0.0-beta.15",
3
+ "version": "5.0.0-beta.19",
4
4
  "type": "module",
5
5
  "description": "Client API for the Kinotic platform's system plane: the workload and node orchestration services platform machines and operators use.",
6
6
  "files": [
@@ -38,12 +38,12 @@
38
38
  "coverage": "bun test --coverage --pass-with-no-tests"
39
39
  },
40
40
  "peerDependencies": {
41
- "@kinotic-ai/core": "^5.0.0-beta.13",
42
- "@kinotic-ai/management-api": "^5.0.0-beta.33"
41
+ "@kinotic-ai/core": "^5.0.0-beta.17",
42
+ "@kinotic-ai/management-api": "^5.0.0-beta.40"
43
43
  },
44
44
  "devDependencies": {
45
- "@kinotic-ai/core": "5.0.0-beta.13",
46
- "@kinotic-ai/management-api": "5.0.0-beta.33",
45
+ "@kinotic-ai/core": "5.0.0-beta.17",
46
+ "@kinotic-ai/management-api": "5.0.0-beta.40",
47
47
  "@types/bun": "^1.3.9",
48
48
  "typescript": "^5.9.3"
49
49
  }