saarthiclaw 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +2 -0
  3. package/dist/chunks/{chunk-QFVMJJQY.js → chunk-44LLGJXH.js} +7 -7
  4. package/dist/chunks/{chunk-GSBUJPPF.js → chunk-BBQ26JQA.js} +5 -5
  5. package/dist/chunks/{chunk-OS5GVLKA.js → chunk-CGJ4VEUD.js} +1 -1
  6. package/dist/chunks/{chunk-4CNBITFA.js → chunk-CGTA77EE.js} +27 -7
  7. package/dist/chunks/{chunk-ZXVP7JFV.js → chunk-CUC6MUW7.js} +11 -13
  8. package/dist/chunks/{chunk-E4DRW4AW.js → chunk-H2FAKNUI.js} +10 -2
  9. package/dist/chunks/{chunk-OICPXSO2.js → chunk-HFMRQTXE.js} +1 -1
  10. package/dist/chunks/{chunk-4YYY2YOT.js → chunk-KAWTUWO2.js} +25 -7
  11. package/dist/chunks/{chunk-EG5A2Q6X.js → chunk-OJCC4JH2.js} +1 -1
  12. package/dist/chunks/{chunk-SKYTL7AH.js → chunk-OLL2WJVK.js} +17 -8
  13. package/dist/chunks/chunk-R4PMMMD5.js +407 -0
  14. package/dist/chunks/{chunk-VAP6FVF5.js → chunk-XNIFO3FV.js} +6 -6
  15. package/dist/chunks/{client-5WRI2PBK.js → client-O4UP5DCM.js} +3 -5
  16. package/dist/chunks/{context-AP3U34DQ.js → context-OL7JU4XA.js} +5 -7
  17. package/dist/chunks/{doctor-O3R2YTRO.js → doctor-OBO4MCDY.js} +11 -6
  18. package/dist/chunks/{errors-ZXTAHCZI.js → errors-OJZTUG74.js} +2 -4
  19. package/dist/chunks/orchestrator-HUHXYUUM.js +23 -0
  20. package/dist/chunks/{orchestrator-CYIGQH74.js → orchestrator-IKYROOM5.js} +10 -12
  21. package/dist/chunks/orchestrator-QAFNDXD2.js +22 -0
  22. package/dist/chunks/{session-FPFJMS7Y.js → session-ZC5D2O77.js} +6 -3
  23. package/dist/chunks/{store-KW257WIV.js → store-JG5OKLEO.js} +5 -5
  24. package/dist/chunks/{sync-S2A65FIE.js → sync-LTPGXMRU.js} +7 -9
  25. package/dist/chunks/{team-OFNBRXVP.js → team-AOMHCEDT.js} +25 -20
  26. package/dist/chunks/{telegram-LPSIQBQX.js → telegram-KO7VH46G.js} +14 -16
  27. package/dist/chunks/{wakeup-M5EIP54K.js → wakeup-YZNEVSVH.js} +16 -18
  28. package/dist/index.js +20 -19
  29. package/package.json +1 -1
  30. package/dist/chunks/chunk-BTFIQWAE.js +0 -185
  31. package/dist/chunks/chunk-G6GCAEKE.js +0 -64
  32. package/dist/chunks/chunk-XTVJWMUH.js +0 -143
  33. package/dist/chunks/orchestrator-4SMA442I.js +0 -24
  34. package/dist/chunks/orchestrator-L4TOOHXY.js +0 -23
@@ -0,0 +1,407 @@
1
+ import {
2
+ ConfigError,
3
+ DEFAULT_MODEL,
4
+ loadConfig
5
+ } from "./chunk-2GDAWRT7.js";
6
+ import {
7
+ findWorkspaceRoot
8
+ } from "./chunk-MMIJKDOU.js";
9
+ import {
10
+ NonInteractiveError
11
+ } from "./chunk-IT46XDPQ.js";
12
+
13
+ // cli/errors.ts
14
+ import chalk from "chalk";
15
+
16
+ // ai/ai.config.ts
17
+ import { createOpenRouter } from "@openrouter/ai-sdk-provider";
18
+
19
+ // ai/errors.ts
20
+ var MissingApiKeyError = class extends Error {
21
+ constructor() {
22
+ super("OPENROUTER_API_KEY is not set");
23
+ this.name = "MissingApiKeyError";
24
+ }
25
+ };
26
+ var FREE_TIER_NOTE = "Free OpenRouter models allow roughly 20 requests/minute and about 200 requests/day. Wait a minute, switch model with `--model <id>`, or add credits on openrouter.ai.";
27
+ function asErrorLike(e) {
28
+ return e && typeof e === "object" ? e : { message: String(e) };
29
+ }
30
+ function unwrap(e) {
31
+ let cur = asErrorLike(e);
32
+ for (let i = 0; i < 6; i++) {
33
+ if (cur.name === "AI_RetryError" && cur.lastError) {
34
+ cur = asErrorLike(cur.lastError);
35
+ continue;
36
+ }
37
+ if (cur.statusCode === void 0 && cur.status === void 0 && cur.cause) {
38
+ const c = asErrorLike(cur.cause);
39
+ if (c.statusCode !== void 0 || c.status !== void 0 || c.name === "AI_RetryError") {
40
+ cur = c;
41
+ continue;
42
+ }
43
+ }
44
+ break;
45
+ }
46
+ return cur;
47
+ }
48
+ var NETWORK_CODES = /* @__PURE__ */ new Set([
49
+ "ECONNREFUSED",
50
+ "ECONNRESET",
51
+ "ENOTFOUND",
52
+ "EAI_AGAIN",
53
+ "ETIMEDOUT",
54
+ "ENETUNREACH",
55
+ "EHOSTUNREACH",
56
+ "UND_ERR_CONNECT_TIMEOUT",
57
+ "UND_ERR_SOCKET"
58
+ ]);
59
+ function findCode(e) {
60
+ let cur = e;
61
+ for (let i = 0; i < 6 && cur && typeof cur === "object"; i++) {
62
+ const c = cur.code;
63
+ if (typeof c === "string") return c;
64
+ cur = cur.cause;
65
+ }
66
+ return void 0;
67
+ }
68
+ function mapAiError(error) {
69
+ const outer = asErrorLike(error);
70
+ if (error instanceof MissingApiKeyError || outer.name === "MissingApiKeyError" || outer.name === "AI_LoadAPIKeyError") {
71
+ return {
72
+ kind: "missing_key",
73
+ title: "No OpenRouter API key configured.",
74
+ hint: "Run `saarthiclaw init` (or set OPENROUTER_API_KEY in your project .env). Get a key at https://openrouter.ai/keys"
75
+ };
76
+ }
77
+ if (outer.name === "AI_NoOutputGeneratedError") {
78
+ return {
79
+ kind: "no_output",
80
+ title: "The model finished without giving an answer.",
81
+ hint: "This happens when a model keeps calling tools until it runs out of steps. Try again, ask a more specific question, or use a stronger model with `--model <id>`."
82
+ };
83
+ }
84
+ if (outer.name === "AI_NoObjectGeneratedError") {
85
+ return {
86
+ kind: "no_output",
87
+ title: "The model did not return a valid plan.",
88
+ hint: "Try again, or use a model that is better at structured output (e.g. `--model openai/gpt-4o-mini`)."
89
+ };
90
+ }
91
+ if (outer.name === "AbortError" || outer.name === "RunCancelledError") {
92
+ return { kind: "cancelled", title: "Cancelled.", hint: "Nothing was written." };
93
+ }
94
+ const e = unwrap(error);
95
+ const status = e.statusCode ?? e.status;
96
+ const body = `${e.message ?? ""} ${e.responseBody ?? ""}`.toLowerCase();
97
+ if (/team ai key/.test(body)) {
98
+ return {
99
+ kind: "missing_key",
100
+ title: "Your team has no AI key yet.",
101
+ hint: "Ask the Admin to add it on the dashboard: Settings → Team AI. (Or run `saarthiclaw init` to use your own key.)",
102
+ status
103
+ };
104
+ }
105
+ if (status === 401 && /access key is not valid|revoked/.test(body)) {
106
+ return {
107
+ kind: "invalid_key",
108
+ title: "The team dashboard did not accept your access key.",
109
+ hint: "Ask the Admin for a new key, then run `saarthiclaw team connect` again.",
110
+ status
111
+ };
112
+ }
113
+ if (e.name === "TimeoutError" || /timed? ?out/.test(body) && status === void 0) {
114
+ return {
115
+ kind: "timeout",
116
+ title: "The AI request timed out.",
117
+ hint: "The model may be overloaded. Try again, or pick a faster model with `--model <id>`."
118
+ };
119
+ }
120
+ if (status === 401) {
121
+ return {
122
+ kind: "invalid_key",
123
+ title: "OpenRouter rejected the API key (401).",
124
+ hint: "Check OPENROUTER_API_KEY or run `saarthiclaw init` to replace it. Keys: https://openrouter.ai/keys",
125
+ status
126
+ };
127
+ }
128
+ if (status === 402) {
129
+ return {
130
+ kind: "payment",
131
+ title: "OpenRouter says this request needs credits (402).",
132
+ hint: "Use a `:free` model (e.g. qwen/qwen3-coder:free) or add credits at https://openrouter.ai/credits",
133
+ status
134
+ };
135
+ }
136
+ if (status === 403) {
137
+ return {
138
+ kind: "forbidden",
139
+ title: "OpenRouter refused the request (403).",
140
+ hint: "Your key may lack permission for this model, or the input was flagged by moderation. Try another model.",
141
+ status
142
+ };
143
+ }
144
+ if (status === 429) {
145
+ return {
146
+ kind: "rate_limit",
147
+ title: "Rate limited by OpenRouter (429), even after retrying with backoff.",
148
+ hint: FREE_TIER_NOTE,
149
+ status
150
+ };
151
+ }
152
+ if (status === 404 || status === 400 && /(not a valid model|no endpoints found|model .*not (found|exist)|unknown model)/.test(body)) {
153
+ return {
154
+ kind: "model_not_found",
155
+ title: "That model is not available on OpenRouter.",
156
+ hint: "Free model lineups rotate. Pick another with `saarthiclaw init` or `--model <id>` (see https://openrouter.ai/models?q=free).",
157
+ status
158
+ };
159
+ }
160
+ const code = findCode(error);
161
+ if (code && NETWORK_CODES.has(code) || /fetch failed|network|socket hang up|getaddrinfo/.test(body)) {
162
+ return {
163
+ kind: "network",
164
+ title: "Could not reach OpenRouter (network error).",
165
+ hint: "Check your internet connection, proxy or firewall, then try again."
166
+ };
167
+ }
168
+ if (status !== void 0 && status >= 500) {
169
+ return {
170
+ kind: "unknown",
171
+ title: `OpenRouter had a server error (${status}).`,
172
+ hint: "This is usually temporary — try again in a moment or switch model.",
173
+ status
174
+ };
175
+ }
176
+ return {
177
+ kind: "unknown",
178
+ title: e.message?.split("\n")[0] || "Unexpected AI error.",
179
+ hint: "Run with --debug for details, or `saarthiclaw doctor` to check your setup.",
180
+ status
181
+ };
182
+ }
183
+ var AI_MAX_RETRIES = 3;
184
+
185
+ // ai/ai.config.ts
186
+ function getTeamModel(server, accessKey, modelId) {
187
+ const provider = createOpenRouter({
188
+ apiKey: accessKey,
189
+ baseURL: `${server}/api/cli/ai`,
190
+ headers: { "X-Title": "SaarthiClaw" }
191
+ });
192
+ return provider(modelId || DEFAULT_MODEL);
193
+ }
194
+ function getAgentModel(options = {}) {
195
+ let apiKey = options.apiKey?.trim();
196
+ let modelId = options.model?.trim();
197
+ if (!apiKey || !modelId) {
198
+ const cfg = loadConfig({ root: findWorkspaceRoot() });
199
+ apiKey ||= cfg.openrouterApiKey;
200
+ modelId ||= cfg.model;
201
+ }
202
+ if (!apiKey) throw new MissingApiKeyError();
203
+ const provider = createOpenRouter({
204
+ apiKey,
205
+ headers: {
206
+ "HTTP-Referer": "https://github.com/hritik0447/SaarthiClaw",
207
+ "X-Title": "SaarthiClaw"
208
+ }
209
+ });
210
+ return provider(modelId || DEFAULT_MODEL);
211
+ }
212
+
213
+ // modes/agent/path-safety.ts
214
+ import fs from "node:fs";
215
+ import path from "node:path";
216
+ var PathSafetyError = class extends Error {
217
+ constructor(message) {
218
+ super(message);
219
+ this.name = "PathSafetyError";
220
+ }
221
+ };
222
+ var SECRET_PATTERNS = [
223
+ ".env",
224
+ ".env.*",
225
+ "*.pem",
226
+ "*.key",
227
+ "*.p12",
228
+ "*.pfx",
229
+ "id_rsa*",
230
+ "id_dsa*",
231
+ "id_ecdsa*",
232
+ "id_ed25519*",
233
+ ".npmrc",
234
+ ".yarnrc.yml",
235
+ ".pypirc",
236
+ ".netrc",
237
+ ".pgpass",
238
+ ".ssh",
239
+ ".aws",
240
+ ".saarthiclaw"
241
+ ];
242
+ function toPosix(p) {
243
+ return p.replace(/\\/g, "/");
244
+ }
245
+ var regexCache = /* @__PURE__ */ new Map();
246
+ function globToRegExp(glob) {
247
+ const cached = regexCache.get(glob);
248
+ if (cached) return cached;
249
+ let re = "";
250
+ for (let i = 0; i < glob.length; i++) {
251
+ const c = glob[i];
252
+ if (c === "*") {
253
+ if (glob[i + 1] === "*") {
254
+ re += ".*";
255
+ i++;
256
+ if (glob[i + 1] === "/") i++;
257
+ } else {
258
+ re += "[^/]*";
259
+ }
260
+ } else if (c === "?") {
261
+ re += "[^/]";
262
+ } else {
263
+ re += c.replace(/[.+^${}()|[\]\\]/g, "\\$&");
264
+ }
265
+ }
266
+ const out = new RegExp(`^${re}$`, "i");
267
+ regexCache.set(glob, out);
268
+ return out;
269
+ }
270
+ function matchesPattern(relPosix, pattern) {
271
+ const p = toPosix(pattern).replace(/^\.\//, "").replace(/\/$/, "");
272
+ if (!p) return false;
273
+ const norm = relPosix.replace(/^\.\//, "");
274
+ const segments = norm.split("/").filter((s) => s && s !== ".");
275
+ if (!p.includes("/")) {
276
+ const re2 = globToRegExp(p);
277
+ return segments.some((s) => re2.test(s));
278
+ }
279
+ const re = globToRegExp(p);
280
+ for (let i = 1; i <= segments.length; i++) {
281
+ if (re.test(segments.slice(0, i).join("/"))) return true;
282
+ }
283
+ return false;
284
+ }
285
+ function isSecretPath(relPosix) {
286
+ return SECRET_PATTERNS.some((p) => matchesPattern(relPosix, p));
287
+ }
288
+ function isExcludedPath(relPosix, patterns) {
289
+ return patterns.some((p) => matchesPattern(relPosix, p));
290
+ }
291
+ function lexists(p) {
292
+ try {
293
+ fs.lstatSync(p);
294
+ return true;
295
+ } catch {
296
+ return false;
297
+ }
298
+ }
299
+ function isInside(root, target) {
300
+ const rel = path.relative(root, target);
301
+ return rel === "" || !rel.startsWith(`..${path.sep}`) && rel !== ".." && !path.isAbsolute(rel);
302
+ }
303
+ var realRootCache;
304
+ function realRootOf(rootAbs) {
305
+ if (realRootCache?.root === rootAbs) return realRootCache.real;
306
+ const real = fs.realpathSync(rootAbs);
307
+ realRootCache = { root: rootAbs, real };
308
+ return real;
309
+ }
310
+ function resolveInsideRoot(root, input) {
311
+ if (typeof input !== "string") throw new PathSafetyError("Path must be a string");
312
+ if (input.includes("\0")) throw new PathSafetyError("Path contains a NUL byte");
313
+ let p = toPosix(input.trim());
314
+ if (!p) p = ".";
315
+ const rootAbs = path.resolve(root);
316
+ if (process.platform !== "win32" && (/^[a-zA-Z]:\//.test(p) || p.startsWith("//"))) {
317
+ throw new PathSafetyError(`Path escapes workspace: ${input}`);
318
+ }
319
+ const abs = path.resolve(rootAbs, p);
320
+ if (!isInside(rootAbs, abs)) {
321
+ throw new PathSafetyError(`Path escapes workspace: ${input}`);
322
+ }
323
+ const realRoot = realRootOf(rootAbs);
324
+ let probe = abs;
325
+ while (!lexists(probe)) {
326
+ const parent = path.dirname(probe);
327
+ if (parent === probe) break;
328
+ probe = parent;
329
+ }
330
+ let realProbe;
331
+ try {
332
+ realProbe = fs.realpathSync(probe);
333
+ } catch {
334
+ throw new PathSafetyError(`Path is a dangling symlink: ${input}`);
335
+ }
336
+ if (!isInside(realRoot, realProbe)) {
337
+ throw new PathSafetyError(`Path resolves outside workspace via symlink: ${input}`);
338
+ }
339
+ return abs;
340
+ }
341
+ function relativePosix(root, abs) {
342
+ const rel = path.relative(path.resolve(root), abs);
343
+ return rel ? toPosix(rel) : ".";
344
+ }
345
+
346
+ // cli/errors.ts
347
+ var UserFacingError = class extends Error {
348
+ constructor(message, hint) {
349
+ super(message);
350
+ this.hint = hint;
351
+ this.name = "UserFacingError";
352
+ }
353
+ hint;
354
+ };
355
+ function looksLikeAiError(e) {
356
+ if (!e || typeof e !== "object") return false;
357
+ const name = e.name ?? "";
358
+ return name.startsWith("AI_") || name === "MissingApiKeyError" || "statusCode" in e;
359
+ }
360
+ function reportError(error, debug) {
361
+ let title;
362
+ let hint;
363
+ if (error instanceof UserFacingError) {
364
+ title = error.message;
365
+ hint = error.hint;
366
+ } else if (error instanceof ConfigError) {
367
+ title = "Configuration problem";
368
+ hint = `${error.message}
369
+ Fix the file above or re-run \`saarthiclaw init\`.`;
370
+ } else if (error instanceof NonInteractiveError || error instanceof PathSafetyError) {
371
+ title = error.message;
372
+ } else if (looksLikeAiError(error)) {
373
+ const f = mapAiError(error);
374
+ title = f.title;
375
+ hint = f.hint;
376
+ } else {
377
+ title = error instanceof Error ? error.message : String(error);
378
+ hint = debug ? void 0 : "Run again with --debug for details, or `saarthiclaw doctor` to check your setup.";
379
+ }
380
+ console.error(`
381
+ ${chalk.red("✖")} ${chalk.bold(title)}`);
382
+ if (hint) for (const line of hint.split("\n")) console.error(chalk.dim(` ${line}`));
383
+ if (debug && error instanceof Error && error.stack) {
384
+ console.error(chalk.dim(`
385
+ ${error.stack}`));
386
+ const cause = error.cause;
387
+ if (cause) console.error(chalk.dim(`Caused by: ${cause instanceof Error ? cause.stack : String(cause)}`));
388
+ }
389
+ console.error("");
390
+ }
391
+
392
+ export {
393
+ MissingApiKeyError,
394
+ mapAiError,
395
+ AI_MAX_RETRIES,
396
+ getTeamModel,
397
+ getAgentModel,
398
+ PathSafetyError,
399
+ toPosix,
400
+ globToRegExp,
401
+ isSecretPath,
402
+ isExcludedPath,
403
+ resolveInsideRoot,
404
+ relativePosix,
405
+ UserFacingError,
406
+ reportError
407
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createWebTools
3
- } from "./chunk-OICPXSO2.js";
3
+ } from "./chunk-HFMRQTXE.js";
4
4
  import {
5
5
  REPEAT_NOTE,
6
6
  createAgentTools,
@@ -10,18 +10,18 @@ import {
10
10
  finishOnLastStep,
11
11
  generateWithProgress,
12
12
  renderTerminalMarkdown
13
- } from "./chunk-QFVMJJQY.js";
13
+ } from "./chunk-44LLGJXH.js";
14
14
  import {
15
15
  ToolExecutor,
16
16
  clipOutput
17
- } from "./chunk-OS5GVLKA.js";
17
+ } from "./chunk-CGJ4VEUD.js";
18
18
  import {
19
19
  Activity
20
20
  } from "./chunk-QRAFFI5V.js";
21
21
  import {
22
22
  describeTeamMode,
23
23
  getTeamContext
24
- } from "./chunk-SKYTL7AH.js";
24
+ } from "./chunk-OLL2WJVK.js";
25
25
  import {
26
26
  RunCancelledError,
27
27
  runCancellable
@@ -31,10 +31,10 @@ import {
31
31
  createTracker,
32
32
  instructionsFor,
33
33
  readOnlyAgentConfig
34
- } from "./chunk-4YYY2YOT.js";
34
+ } from "./chunk-KAWTUWO2.js";
35
35
  import {
36
36
  AI_MAX_RETRIES
37
- } from "./chunk-BTFIQWAE.js";
37
+ } from "./chunk-R4PMMMD5.js";
38
38
 
39
39
  // modes/plan/orchestrator.ts
40
40
  import fs from "node:fs";
@@ -3,13 +3,11 @@ import {
3
3
  TeamApiError,
4
4
  TeamClient,
5
5
  TeamNetworkError
6
- } from "./chunk-EG5A2Q6X.js";
7
- import "./chunk-G6GCAEKE.js";
8
- import "./chunk-IT46XDPQ.js";
9
- import "./chunk-XTVJWMUH.js";
10
- import "./chunk-BTFIQWAE.js";
6
+ } from "./chunk-OJCC4JH2.js";
7
+ import "./chunk-R4PMMMD5.js";
11
8
  import "./chunk-2GDAWRT7.js";
12
9
  import "./chunk-MMIJKDOU.js";
10
+ import "./chunk-IT46XDPQ.js";
13
11
  export {
14
12
  LEVEL_LABEL,
15
13
  TeamApiError,
@@ -3,15 +3,13 @@ import {
3
3
  describeTeamMode,
4
4
  getTeamContext,
5
5
  teamClientFor
6
- } from "./chunk-SKYTL7AH.js";
7
- import "./chunk-E4DRW4AW.js";
8
- import "./chunk-EG5A2Q6X.js";
9
- import "./chunk-G6GCAEKE.js";
10
- import "./chunk-IT46XDPQ.js";
11
- import "./chunk-XTVJWMUH.js";
12
- import "./chunk-BTFIQWAE.js";
6
+ } from "./chunk-OLL2WJVK.js";
7
+ import "./chunk-OJCC4JH2.js";
8
+ import "./chunk-H2FAKNUI.js";
9
+ import "./chunk-R4PMMMD5.js";
13
10
  import "./chunk-2GDAWRT7.js";
14
11
  import "./chunk-MMIJKDOU.js";
12
+ import "./chunk-IT46XDPQ.js";
15
13
  export {
16
14
  assertProjectOpen,
17
15
  describeTeamMode,
@@ -5,13 +5,17 @@ import {
5
5
  MIN_NODE,
6
6
  nodeVersionOk
7
7
  } from "./chunk-SANS45ER.js";
8
+ import {
9
+ teamAiFor
10
+ } from "./chunk-H2FAKNUI.js";
8
11
  import {
9
12
  mapAiError
10
- } from "./chunk-BTFIQWAE.js";
13
+ } from "./chunk-R4PMMMD5.js";
11
14
  import "./chunk-2GDAWRT7.js";
12
15
  import {
13
16
  projectStateDir
14
17
  } from "./chunk-MMIJKDOU.js";
18
+ import "./chunk-IT46XDPQ.js";
15
19
 
16
20
  // cli/doctor.ts
17
21
  import fs from "node:fs";
@@ -62,10 +66,11 @@ function staticChecks(cfg) {
62
66
  detail: found.length ? found.join("; ") : "none found — run `saarthiclaw init`",
63
67
  required: false
64
68
  });
69
+ const teamAi = teamAiFor(cfg.root);
65
70
  checks.push({
66
71
  name: "OPENROUTER_API_KEY",
67
- status: cfg.openrouterApiKey ? "pass" : "fail",
68
- detail: cfg.openrouterApiKey ? `${maskSecret(cfg.openrouterApiKey)}${src(cfg, "openrouterApiKey")}` : "missing — run `saarthiclaw init` (keys: https://openrouter.ai/keys)",
72
+ status: cfg.openrouterApiKey || teamAi ? "pass" : "fail",
73
+ detail: teamAi ? `not needed — using the team's AI key through ${teamAi.server}` : cfg.openrouterApiKey ? `${maskSecret(cfg.openrouterApiKey)}${src(cfg, "openrouterApiKey")}` : "missing — run `saarthiclaw init` (keys: https://openrouter.ai/keys), or ask your team Admin for a Team AI key",
69
74
  required: true
70
75
  });
71
76
  checks.push({ name: "Model", status: "info", detail: `${cfg.model}${src(cfg, "model")}`, required: false });
@@ -94,7 +99,7 @@ function staticChecks(cfg) {
94
99
  }
95
100
  async function liveCheck(session) {
96
101
  const name = "Live model call";
97
- if (!session.config.openrouterApiKey) {
102
+ if (!session.config.openrouterApiKey && !teamAiFor(session.root, session.env ?? process.env)) {
98
103
  return { name, status: "fail", detail: "skipped — no API key", required: true };
99
104
  }
100
105
  const started = Date.now();
@@ -118,14 +123,14 @@ function printChecks(checks) {
118
123
  for (const c of checks) console.log(` ${ICON[c.status]} ${c.name.padEnd(width)} ${c.detail}`);
119
124
  }
120
125
  async function checkTeam(session, live) {
121
- const { readTeamLink, readKey } = await import("./store-KW257WIV.js");
126
+ const { readTeamLink, readKey } = await import("./store-JG5OKLEO.js");
122
127
  const env = session.env ?? process.env;
123
128
  const link = readTeamLink(session.root, env);
124
129
  if (!link) return { name: "Team dashboard", status: "info", detail: "solo mode (not connected)", required: false };
125
130
  if (!readKey(link.server, session.root, env)) return { name: "Team dashboard", status: "warn", detail: `no key saved for ${link.server} — run \`saarthiclaw team connect\``, required: false };
126
131
  if (!live) return { name: "Team dashboard", status: "info", detail: `${link.server} (not contacted: --offline)`, required: false };
127
132
  try {
128
- const { TeamClient } = await import("./client-5WRI2PBK.js");
133
+ const { TeamClient } = await import("./client-O4UP5DCM.js");
129
134
  const me = await new TeamClient(link.server, readKey(link.server, session.root, env), session.teamFetch, 8e3).whoami();
130
135
  return { name: "Team dashboard", status: "pass", detail: `${me.name} (${me.permissionLevel.replace("_", " ")}) at ${link.server}`, required: false };
131
136
  } catch (e) {
@@ -1,12 +1,10 @@
1
1
  import {
2
2
  UserFacingError,
3
3
  reportError
4
- } from "./chunk-G6GCAEKE.js";
5
- import "./chunk-IT46XDPQ.js";
6
- import "./chunk-XTVJWMUH.js";
7
- import "./chunk-BTFIQWAE.js";
4
+ } from "./chunk-R4PMMMD5.js";
8
5
  import "./chunk-2GDAWRT7.js";
9
6
  import "./chunk-MMIJKDOU.js";
7
+ import "./chunk-IT46XDPQ.js";
10
8
  export {
11
9
  UserFacingError,
12
10
  reportError
@@ -0,0 +1,23 @@
1
+ import {
2
+ onlyDescribedTheChange,
3
+ runAgentMode,
4
+ runAgentTask
5
+ } from "./chunk-CGTA77EE.js";
6
+ import "./chunk-44LLGJXH.js";
7
+ import "./chunk-CGJ4VEUD.js";
8
+ import "./chunk-QRAFFI5V.js";
9
+ import "./chunk-OLL2WJVK.js";
10
+ import "./chunk-OJCC4JH2.js";
11
+ import "./chunk-HGBZ55ND.js";
12
+ import "./chunk-KAWTUWO2.js";
13
+ import "./chunk-5WH3FNFK.js";
14
+ import "./chunk-H2FAKNUI.js";
15
+ import "./chunk-R4PMMMD5.js";
16
+ import "./chunk-2GDAWRT7.js";
17
+ import "./chunk-MMIJKDOU.js";
18
+ import "./chunk-IT46XDPQ.js";
19
+ export {
20
+ onlyDescribedTheChange,
21
+ runAgentMode,
22
+ runAgentTask
23
+ };
@@ -5,23 +5,21 @@ import {
5
5
  runAskOnce,
6
6
  saveAnswer,
7
7
  validateMdFilename
8
- } from "./chunk-GSBUJPPF.js";
9
- import "./chunk-OICPXSO2.js";
10
- import "./chunk-QFVMJJQY.js";
11
- import "./chunk-OS5GVLKA.js";
8
+ } from "./chunk-BBQ26JQA.js";
9
+ import "./chunk-HFMRQTXE.js";
10
+ import "./chunk-44LLGJXH.js";
11
+ import "./chunk-CGJ4VEUD.js";
12
12
  import "./chunk-QRAFFI5V.js";
13
- import "./chunk-SKYTL7AH.js";
14
- import "./chunk-E4DRW4AW.js";
13
+ import "./chunk-OLL2WJVK.js";
14
+ import "./chunk-OJCC4JH2.js";
15
15
  import "./chunk-HGBZ55ND.js";
16
- import "./chunk-4YYY2YOT.js";
16
+ import "./chunk-KAWTUWO2.js";
17
17
  import "./chunk-5WH3FNFK.js";
18
- import "./chunk-EG5A2Q6X.js";
19
- import "./chunk-G6GCAEKE.js";
20
- import "./chunk-IT46XDPQ.js";
21
- import "./chunk-XTVJWMUH.js";
22
- import "./chunk-BTFIQWAE.js";
18
+ import "./chunk-H2FAKNUI.js";
19
+ import "./chunk-R4PMMMD5.js";
23
20
  import "./chunk-2GDAWRT7.js";
24
21
  import "./chunk-MMIJKDOU.js";
22
+ import "./chunk-IT46XDPQ.js";
25
23
  export {
26
24
  asMd,
27
25
  askQuestion,
@@ -0,0 +1,22 @@
1
+ import {
2
+ runPlanMode,
3
+ stepPrompt
4
+ } from "./chunk-XNIFO3FV.js";
5
+ import "./chunk-HFMRQTXE.js";
6
+ import "./chunk-44LLGJXH.js";
7
+ import "./chunk-CGJ4VEUD.js";
8
+ import "./chunk-QRAFFI5V.js";
9
+ import "./chunk-OLL2WJVK.js";
10
+ import "./chunk-OJCC4JH2.js";
11
+ import "./chunk-HGBZ55ND.js";
12
+ import "./chunk-KAWTUWO2.js";
13
+ import "./chunk-5WH3FNFK.js";
14
+ import "./chunk-H2FAKNUI.js";
15
+ import "./chunk-R4PMMMD5.js";
16
+ import "./chunk-2GDAWRT7.js";
17
+ import "./chunk-MMIJKDOU.js";
18
+ import "./chunk-IT46XDPQ.js";
19
+ export {
20
+ runPlanMode,
21
+ stepPrompt
22
+ };
@@ -1,18 +1,21 @@
1
1
  import {
2
2
  createSession,
3
3
  createTracker,
4
+ hasAiAccess,
4
5
  hasWebTools,
5
6
  instructionsFor,
6
7
  reportAiError
7
- } from "./chunk-4YYY2YOT.js";
8
+ } from "./chunk-KAWTUWO2.js";
8
9
  import "./chunk-5WH3FNFK.js";
9
- import "./chunk-XTVJWMUH.js";
10
- import "./chunk-BTFIQWAE.js";
10
+ import "./chunk-H2FAKNUI.js";
11
+ import "./chunk-R4PMMMD5.js";
11
12
  import "./chunk-2GDAWRT7.js";
12
13
  import "./chunk-MMIJKDOU.js";
14
+ import "./chunk-IT46XDPQ.js";
13
15
  export {
14
16
  createSession,
15
17
  createTracker,
18
+ hasAiAccess,
16
19
  hasWebTools,
17
20
  instructionsFor,
18
21
  reportAiError