rackmind-cli 0.2.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,21 +1,101 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 RackMind
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Business Source License 1.1
2
+
3
+ Parameters
4
+
5
+ Licensor: RackMind
6
+ Licensed Work: rackmind-cli
7
+ The Licensed Work is (c) 2026 RackMind
8
+ Additional Use Grant: You may use the Licensed Work for any purpose,
9
+ including production use, with one limitation: you may
10
+ not offer the Licensed Work to third parties as a
11
+ hosted, managed, or commercial service, nor redistribute
12
+ it as part of a product or service that competes with
13
+ RackMind's commercial offerings (rackmind.ai
14
+ subscriptions).
15
+
16
+ Personal use, internal company use, and
17
+ Bring-Your-Own-Key (BYOK) usage with your own AI provider
18
+ credentials are all permitted without restriction.
19
+ Change Date: Four years from the date this version of the Licensed
20
+ Work is first made publicly available under this License.
21
+ Change License: Apache License, Version 2.0
22
+
23
+ For information about alternative licensing arrangements for the Licensed Work,
24
+ please contact krish@rackmind.ai.
25
+
26
+ License text copyright (c) 2024 MariaDB plc, All Rights Reserved.
27
+ "Business Source License" is a trademark of MariaDB plc.
28
+
29
+ -----------------------------------------------------------------------
30
+
31
+ Terms
32
+
33
+ The Licensor hereby grants you the right to copy, modify, create derivative
34
+ works, redistribute, and make non-production use of the Licensed Work. The
35
+ Licensor may make an Additional Use Grant, above, permitting limited production
36
+ use.
37
+
38
+ Effective on the Change Date, or the fourth anniversary of the first publicly
39
+ available distribution of a specific version of the Licensed Work under this
40
+ License, whichever comes first, the Licensor hereby grants you rights under
41
+ the terms of the Change License, and the rights granted in the paragraph above
42
+ terminate.
43
+
44
+ If your use of the Licensed Work does not comply with the requirements
45
+ currently in effect as described in this License, you must purchase a
46
+ commercial license from the Licensor, its affiliated entities, or authorized
47
+ resellers, or you must refrain from using the Licensed Work.
48
+
49
+ All copies of the original and modified Licensed Work, and derivative works of
50
+ the Licensed Work, are subject to this License. This License applies separately
51
+ for each version of the Licensed Work and the Change Date may vary for each
52
+ version of the Licensed Work released by Licensor.
53
+
54
+ You must conspicuously display this License on each original or modified copy
55
+ of the Licensed Work. If you receive the Licensed Work in original or modified
56
+ form from a third party, the terms and conditions set forth in this License
57
+ apply to your use of that work.
58
+
59
+ Any use of the Licensed Work in violation of this License will automatically
60
+ terminate your rights under this License for the current and all other
61
+ versions of the Licensed Work.
62
+
63
+ This License does not grant you any right in any trademark or logo of Licensor
64
+ or its affiliates (provided that you may use a trademark or logo of Licensor
65
+ as expressly required by this License).
66
+
67
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
68
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
69
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
70
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
71
+ TITLE.
72
+
73
+ MariaDB hereby grants you permission to use this License's text to license
74
+ your works, and to refer to it using the trademark "Business Source License",
75
+ as long as you comply with the Covenants of Licensor below.
76
+
77
+ Covenants of Licensor
78
+
79
+ In consideration of the right to use this License's text and the "Business
80
+ Source License" name and trademark, Licensor covenants to MariaDB, and to all
81
+ other recipients of the licensed work to be provided by Licensor:
82
+
83
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
84
+ or a license that is compatible with GPL Version 2.0 or a later version,
85
+ where "compatible" means that software provided under the Change License
86
+ can be included in a program with software provided under GPL Version 2.0
87
+ or a later version. Licensor may specify additional Change Licenses without
88
+ limitation.
89
+
90
+ 2. To either: (a) specify an additional grant of rights to use that does not
91
+ impose any additional restriction on the right granted in this License, as
92
+ the Additional Use Grant; or (b) insert the text "None" to specify a
93
+ Change Date.
94
+
95
+ 3. Not to modify this License in any other way.
96
+
97
+ Notice
98
+
99
+ The Business Source License (this document, or the "License") is not an Open
100
+ Source license. However, the Licensed Work will eventually be made available
101
+ under an Open Source License, as stated in this License.
package/README.md CHANGED
@@ -121,4 +121,10 @@ Detailed contributor setup, architecture overview, and the commit gate are in [O
121
121
 
122
122
  ## License
123
123
 
124
- [MIT](./LICENSE)
124
+ [Business Source License 1.1](./LICENSE) — source-available, not Open Source.
125
+
126
+ You may use rackmind-cli for any purpose, including production use, with one limitation: you may not offer it to third parties as a hosted, managed, or commercial service that competes with RackMind's offerings (rackmind.ai subscriptions). **Personal use, internal company use, and Bring-Your-Own-Key (BYOK) usage with your own AI provider credentials are explicitly permitted without restriction.**
127
+
128
+ Each released version converts to Apache License 2.0 four years after its public release date. For alternative licensing arrangements, contact krish@rackmind.ai.
129
+
130
+ Earlier versions (0.2.x and below) remain MIT-licensed.
@@ -1,5 +1,10 @@
1
1
  import type { ServerClient } from '../../server/client.js';
2
2
  import type { AIProvider, ChatHistory, MultiTurnCallbacks, ProviderOptions, StreamCallbacks } from './base.js';
3
+ /**
4
+ * Returns true for browser AbortError and the Anthropic SDK's
5
+ * APIUserAbortError so callers can treat them uniformly.
6
+ */
7
+ export declare function isAbortError(err: unknown): boolean;
3
8
  export declare class AnthropicProvider implements AIProvider {
4
9
  private readonly anthropic;
5
10
  private readonly model;
@@ -10,12 +15,14 @@ export declare class AnthropicProvider implements AIProvider {
10
15
  getModel(): string;
11
16
  /** Clear cached server context so next turn re-fetches from Proxmox API. */
12
17
  invalidateContextCache(): void;
13
- chat(query: string, serverClient: ServerClient, serverAlias: string, callbacks: StreamCallbacks): Promise<void>;
14
- chatMultiTurn(query: string, history: ChatHistory, serverClient: ServerClient, serverAlias: string, callbacks: MultiTurnCallbacks): Promise<ChatHistory>;
18
+ chat(query: string, serverClient: ServerClient, serverAlias: string, callbacks: StreamCallbacks, signal?: AbortSignal): Promise<void>;
19
+ chatMultiTurn(query: string, history: ChatHistory, serverClient: ServerClient, serverAlias: string, callbacks: MultiTurnCallbacks, signal?: AbortSignal): Promise<ChatHistory>;
15
20
  dispose(): Promise<void>;
16
21
  /**
17
22
  * Create a message with retry logic for transient errors.
18
23
  * Rate limits and overload errors trigger exponential backoff.
24
+ * The optional AbortSignal is forwarded to the SDK so the in-flight HTTP
25
+ * request can be cancelled immediately when the user hits Ctrl+C.
19
26
  */
20
27
  private createWithRetry;
21
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"anthropic-provider.d.ts","sourceRoot":"","sources":["../../../src/ai/providers/anthropic-provider.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAO3D,OAAO,KAAK,EACR,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,eAAe,EAClB,MAAM,WAAW,CAAC;AAKnB,qBAAa,iBAAkB,YAAW,UAAU;IAChD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IACtC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OA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AAE,MAAM,EACb,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,eAAe,EAC1B,MAAM,CAAC,EAAE,WAAW,GACrB,OAAO,CAAC,IAAI,CAAC;IA0EV,aAAa,CACf,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,WAAW,EACpB,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,kBAAkB,EAC7B,MAAM,CAAC,EAAE,WAAW,GACrB,OAAO,CAAC,WAAW,CAAC;IAyFjB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B;;;;;OAKG;IACH,OAAO,CAAC,eAAe;CAoC1B"}
@@ -14,6 +14,25 @@ import { withRetry, isTransientError, isRateLimitError } from '../../utils/retry
14
14
  import { DEFAULT_ANTHROPIC_MODEL_ID } from '../models.js';
15
15
  /** Max iterations of the tool use loop — hard guard against runaway chains. */
16
16
  const MAX_TOOL_ITERATIONS = 20;
17
+ // ---------------------------------------------------------------------------
18
+ // Abort helpers
19
+ // ---------------------------------------------------------------------------
20
+ /**
21
+ * Returns true for browser AbortError and the Anthropic SDK's
22
+ * APIUserAbortError so callers can treat them uniformly.
23
+ */
24
+ export function isAbortError(err) {
25
+ return err instanceof Error && (err.name === 'AbortError' || err.name === 'APIUserAbortError');
26
+ }
27
+ /**
28
+ * Throw an AbortError. Centralised so callers in the tool loop all use
29
+ * the same error shape, matching what the Anthropic SDK itself throws.
30
+ */
31
+ function throwAbortError() {
32
+ const err = new Error('The operation was aborted.');
33
+ err.name = 'AbortError';
34
+ throw err;
35
+ }
17
36
  export class AnthropicProvider {
18
37
  anthropic;
19
38
  model;
@@ -39,7 +58,7 @@ export class AnthropicProvider {
39
58
  this.cachedContext = null;
40
59
  logger.info('Server context cache cleared — will re-fetch on next turn');
41
60
  }
42
- async chat(query, serverClient, serverAlias, callbacks) {
61
+ async chat(query, serverClient, serverAlias, callbacks, signal) {
43
62
  if (!this.cachedContext) {
44
63
  this.cachedContext = await fetchServerContext(serverClient);
45
64
  }
@@ -48,8 +67,11 @@ export class AnthropicProvider {
48
67
  const tools = getToolDefinitions();
49
68
  const messages = [{ role: 'user', content: query }];
50
69
  for (let iteration = 0; iteration < MAX_TOOL_ITERATIONS; iteration++) {
70
+ if (signal?.aborted) {
71
+ throwAbortError();
72
+ }
51
73
  logger.debug('AI request iteration', { iteration, messageCount: messages.length });
52
- const response = await this.createWithRetry(systemPrompt, tools, messages, callbacks);
74
+ const response = await this.createWithRetry(systemPrompt, tools, messages, callbacks, signal);
53
75
  const assistantContent = [];
54
76
  const toolUseBlocks = [];
55
77
  for (const block of response.content) {
@@ -71,9 +93,12 @@ export class AnthropicProvider {
71
93
  }
72
94
  const toolResults = [];
73
95
  for (const toolBlock of toolUseBlocks) {
96
+ if (signal?.aborted) {
97
+ throwAbortError();
98
+ }
74
99
  const toolInput = toolBlock.input;
75
100
  callbacks.onToolStart(toolBlock.name, toolBlock.name);
76
- const result = await executeTool(toolBlock.name, toolInput, serverClient, { confirm: callbacks.confirmDestructive });
101
+ const result = await executeTool(toolBlock.name, toolInput, serverClient, { confirm: callbacks.confirmDestructive, signal });
77
102
  callbacks.onToolEnd(toolBlock.name, result.label, result.isError);
78
103
  toolResults.push({
79
104
  type: 'tool_result',
@@ -86,7 +111,7 @@ export class AnthropicProvider {
86
111
  }
87
112
  callbacks.onError('Reached maximum tool iterations. The AI may be stuck in a loop.');
88
113
  }
89
- async chatMultiTurn(query, history, serverClient, serverAlias, callbacks) {
114
+ async chatMultiTurn(query, history, serverClient, serverAlias, callbacks, signal) {
90
115
  if (!this.cachedContext) {
91
116
  this.cachedContext = await fetchServerContext(serverClient);
92
117
  }
@@ -98,11 +123,14 @@ export class AnthropicProvider {
98
123
  { role: 'user', content: query },
99
124
  ];
100
125
  for (let iteration = 0; iteration < MAX_TOOL_ITERATIONS; iteration++) {
126
+ if (signal?.aborted) {
127
+ throwAbortError();
128
+ }
101
129
  logger.debug('AI multi-turn request iteration', {
102
130
  iteration,
103
131
  messageCount: messages.length,
104
132
  });
105
- const response = await this.createWithRetry(systemPrompt, tools, messages, callbacks);
133
+ const response = await this.createWithRetry(systemPrompt, tools, messages, callbacks, signal);
106
134
  const assistantContent = [];
107
135
  const toolUseBlocks = [];
108
136
  for (const block of response.content) {
@@ -124,9 +152,12 @@ export class AnthropicProvider {
124
152
  }
125
153
  const toolResults = [];
126
154
  for (const toolBlock of toolUseBlocks) {
155
+ if (signal?.aborted) {
156
+ throwAbortError();
157
+ }
127
158
  const toolInput = toolBlock.input;
128
159
  callbacks.onToolStart(toolBlock.name, toolBlock.name);
129
- const result = await executeTool(toolBlock.name, toolInput, serverClient, { confirm: callbacks.confirmDestructive });
160
+ const result = await executeTool(toolBlock.name, toolInput, serverClient, { confirm: callbacks.confirmDestructive, signal });
130
161
  callbacks.onToolEnd(toolBlock.name, result.label, result.isError);
131
162
  if (callbacks.onToolResult) {
132
163
  callbacks.onToolResult({
@@ -154,19 +185,21 @@ export class AnthropicProvider {
154
185
  /**
155
186
  * Create a message with retry logic for transient errors.
156
187
  * Rate limits and overload errors trigger exponential backoff.
188
+ * The optional AbortSignal is forwarded to the SDK so the in-flight HTTP
189
+ * request can be cancelled immediately when the user hits Ctrl+C.
157
190
  */
158
- createWithRetry(system, tools, messages, callbacks) {
191
+ createWithRetry(system, tools, messages, callbacks, signal) {
159
192
  return withRetry(() => this.anthropic.messages.create({
160
193
  model: this.model,
161
194
  max_tokens: this.maxTokens,
162
195
  system,
163
196
  tools,
164
197
  messages,
165
- }), {
198
+ }, { signal }), {
166
199
  maxAttempts: 3,
167
200
  initialDelayMs: 2000,
168
201
  maxDelayMs: 30_000,
169
- isRetryable: isTransientError,
202
+ isRetryable: (err) => !isAbortError(err) && isTransientError(err),
170
203
  onRetry: (attempt, error, delayMs) => {
171
204
  const msg = error instanceof Error ? error.message : String(error);
172
205
  const isRateLimit = isRateLimitError(error);
@@ -1 +1 @@
1
- {"version":3,"file":"anthropic-provider.js","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IAAI,CAAC,cAAc,OAAO,GAAG,CAAC,QAAQ,CACvF,CAAC;gBACF,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YACpE,CAAC;SACJ,CACJ,CAAC;IACN,CAAC;CACJ"}
@@ -49,13 +49,17 @@ export interface AIProvider {
49
49
  * Send a single query with no prior history. Streams results via
50
50
  * callbacks. Throws on fatal errors.
51
51
  */
52
- chat(query: string, serverClient: ServerClient, serverAlias: string, callbacks: StreamCallbacks): Promise<void>;
52
+ chat(query: string, serverClient: ServerClient, serverAlias: string, callbacks: StreamCallbacks, signal?: AbortSignal): Promise<void>;
53
53
  /**
54
54
  * Send a new user message given the prior conversation history.
55
55
  * Returns the updated history (with the new user turn and the
56
56
  * assistant's response appended).
57
+ *
58
+ * When `signal` is aborted mid-turn the call rejects with an AbortError
59
+ * (or the SDK's APIUserAbortError). The caller is responsible for not
60
+ * persisting any partial history returned before the abort.
57
61
  */
58
- chatMultiTurn(query: string, history: ChatHistory, serverClient: ServerClient, serverAlias: string, callbacks: MultiTurnCallbacks): Promise<ChatHistory>;
62
+ chatMultiTurn(query: string, history: ChatHistory, serverClient: ServerClient, serverAlias: string, callbacks: MultiTurnCallbacks, signal?: AbortSignal): Promise<ChatHistory>;
59
63
  /**
60
64
  * Release any resources this provider holds (HTTP bridge, child
61
65
  * processes, etc.). Safe to call multiple times.
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/ai/providers/base.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,YAAY,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE1F,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1
+ import { z } from 'zod';
1
2
  import type { ServerClient } from '../server/client.js';
2
3
  /**
3
4
  * Deep-clone `input` and redact any value that either lives under a
@@ -9,17 +10,7 @@ import type { ServerClient } from '../server/client.js';
9
10
  * the wrapper helpers below.
10
11
  */
11
12
  export declare function redactSecrets(input: unknown): unknown;
12
- interface ExecuteCommandInput {
13
- command: string;
14
- }
15
- interface ExecuteCommandInContainerInput {
16
- vmid: number;
17
- command: string;
18
- }
19
- interface VmidInput {
20
- vmid: number;
21
- }
22
- type ToolInput = ExecuteCommandInput | ExecuteCommandInContainerInput | VmidInput | Record<string, never>;
13
+ export declare const _toolSchemas: Map<string, z.ZodTypeAny>;
23
14
  export interface ToolResult {
24
15
  /** The string content to send back to Claude */
25
16
  content: string;
@@ -55,11 +46,18 @@ export interface ExecuteToolOptions {
55
46
  * should always supply this.
56
47
  */
57
48
  confirm?: ConfirmDestructiveFn;
49
+ /**
50
+ * AbortSignal for the current turn. When already aborted at call time,
51
+ * the tool short-circuits and returns an aborted result without calling
52
+ * the underlying handler. Handlers themselves do not receive the signal —
53
+ * they return quickly enough that mid-execution cancellation is handled at
54
+ * the loop level in the provider.
55
+ */
56
+ signal?: AbortSignal;
58
57
  }
59
58
  /**
60
59
  * Execute a tool call and return the result.
61
60
  * Catches all errors and returns them as error results rather than throwing.
62
61
  */
63
- export declare function executeTool(toolName: string, input: ToolInput, client: ServerClient, options?: ExecuteToolOptions): Promise<ToolResult>;
64
- export {};
62
+ export declare function executeTool(toolName: string, input: Record<string, unknown>, client: ServerClient, options?: ExecuteToolOptions): Promise<ToolResult>;
65
63
  //# sourceMappingURL=tool-executor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tool-executor.d.ts","sourceRoot":"","sources":["../../src/ai/tool-executor.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAgCxD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,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