saarthiclaw 0.2.2 → 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.
- package/CHANGELOG.md +8 -0
- package/README.md +2 -0
- package/dist/chunks/{chunk-DSQDVSZS.js → chunk-44LLGJXH.js} +6 -6
- package/dist/chunks/{chunk-TTT3KK46.js → chunk-BBQ26JQA.js} +5 -5
- package/dist/chunks/{chunk-OS5GVLKA.js → chunk-CGJ4VEUD.js} +1 -1
- package/dist/chunks/{chunk-3UFD5346.js → chunk-CGTA77EE.js} +5 -5
- package/dist/chunks/{chunk-ZXVP7JFV.js → chunk-CUC6MUW7.js} +11 -13
- package/dist/chunks/{chunk-E4DRW4AW.js → chunk-H2FAKNUI.js} +10 -2
- package/dist/chunks/{chunk-OICPXSO2.js → chunk-HFMRQTXE.js} +1 -1
- package/dist/chunks/{chunk-GX2I7K4S.js → chunk-KAWTUWO2.js} +15 -5
- package/dist/chunks/{chunk-EG5A2Q6X.js → chunk-OJCC4JH2.js} +1 -1
- package/dist/chunks/{chunk-SKYTL7AH.js → chunk-OLL2WJVK.js} +17 -8
- package/dist/chunks/chunk-R4PMMMD5.js +407 -0
- package/dist/chunks/{chunk-VDYO3QC7.js → chunk-XNIFO3FV.js} +6 -6
- package/dist/chunks/{client-5WRI2PBK.js → client-O4UP5DCM.js} +3 -5
- package/dist/chunks/{context-AP3U34DQ.js → context-OL7JU4XA.js} +5 -7
- package/dist/chunks/{doctor-O3R2YTRO.js → doctor-OBO4MCDY.js} +11 -6
- package/dist/chunks/{errors-ZXTAHCZI.js → errors-OJZTUG74.js} +2 -4
- package/dist/chunks/{orchestrator-NIDJK4C3.js → orchestrator-HUHXYUUM.js} +9 -11
- package/dist/chunks/{orchestrator-KNCW4K57.js → orchestrator-IKYROOM5.js} +10 -12
- package/dist/chunks/orchestrator-QAFNDXD2.js +22 -0
- package/dist/chunks/{session-CRFC3IEU.js → session-ZC5D2O77.js} +6 -3
- package/dist/chunks/{store-KW257WIV.js → store-JG5OKLEO.js} +5 -5
- package/dist/chunks/{sync-S2A65FIE.js → sync-LTPGXMRU.js} +7 -9
- package/dist/chunks/{team-RBSOK3HT.js → team-AOMHCEDT.js} +25 -20
- package/dist/chunks/{telegram-JSGRYPIX.js → telegram-KO7VH46G.js} +14 -16
- package/dist/chunks/{wakeup-4IP4JXVF.js → wakeup-YZNEVSVH.js} +16 -18
- package/dist/index.js +20 -19
- package/package.json +1 -1
- package/dist/chunks/chunk-BTFIQWAE.js +0 -185
- package/dist/chunks/chunk-G6GCAEKE.js +0 -64
- package/dist/chunks/chunk-XTVJWMUH.js +0 -143
- package/dist/chunks/orchestrator-JFJU4FGP.js +0 -24
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented here. This project follows [Semantic Versioning](https://semver.org/).
|
|
4
4
|
|
|
5
|
+
## 0.2.3 — 2026-11-19
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **Team AI.** The Admin adds one OpenRouter key on the dashboard (Settings → Team AI). Every team member's AI requests then go through the dashboard, which adds that key and uses the Admin's chosen model, so nobody else needs an AI key. Only the team access key is sent from the terminal; the AI key never leaves the dashboard.
|
|
9
|
+
- `team connect` and `team status` say which AI is used, and `doctor` accepts Team AI in place of a local key.
|
|
10
|
+
- The model is picked without a network call, using `teamAi` stored in `.saarthiclaw/team.json`; it is refreshed on every dashboard check.
|
|
11
|
+
- Set `SAARTHICLAW_OWN_AI_KEY=1` to use your own key instead.
|
|
12
|
+
|
|
5
13
|
## 0.2.2 — 2026-11-19
|
|
6
14
|
|
|
7
15
|
### Fixed
|
package/README.md
CHANGED
|
@@ -175,6 +175,8 @@ npx saarthiclaw agent "validate todo text"
|
|
|
175
175
|
```
|
|
176
176
|
Closed the terminal before the Admin decided? `npx saarthiclaw team sync` applies whatever was approved since.
|
|
177
177
|
|
|
178
|
+
**AI for the whole team (one key):** the Admin adds an OpenRouter key on the dashboard under **Settings → Team AI**. From then on every teammate's `ask`, `plan` and `agent` use it through the dashboard, so teammates need **no AI key of their own**. The key never leaves the dashboard, and everyone uses the model the Admin chose. (`SAARTHICLAW_OWN_AI_KEY=1` makes a terminal use its own key instead.)
|
|
179
|
+
|
|
178
180
|
How it stays safe:
|
|
179
181
|
- **The dashboard never touches files.** It stores the proposal and the decision; your own terminal applies it.
|
|
180
182
|
- **No overwriting newer work.** Each proposal carries a hash of the file it was based on. If the file changed since, `team sync` does not apply it and reports it as failed; ask the agent again.
|
|
@@ -8,17 +8,17 @@ import {
|
|
|
8
8
|
} from "./chunk-QRAFFI5V.js";
|
|
9
9
|
import {
|
|
10
10
|
getTeamContext
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import {
|
|
13
|
-
sha256Hex
|
|
14
|
-
} from "./chunk-E4DRW4AW.js";
|
|
11
|
+
} from "./chunk-OLL2WJVK.js";
|
|
15
12
|
import {
|
|
16
13
|
RunCancelledError,
|
|
17
14
|
runCancellable
|
|
18
15
|
} from "./chunk-HGBZ55ND.js";
|
|
16
|
+
import {
|
|
17
|
+
sha256Hex
|
|
18
|
+
} from "./chunk-H2FAKNUI.js";
|
|
19
19
|
import {
|
|
20
20
|
resolveInsideRoot
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-R4PMMMD5.js";
|
|
22
22
|
|
|
23
23
|
// modes/agent/agent-tools.ts
|
|
24
24
|
import { tool } from "ai";
|
|
@@ -361,7 +361,7 @@ async function sendForApproval(session, tracker, info, team) {
|
|
|
361
361
|
📨 Sent ${res.ids.length} change${res.ids.length === 1 ? "" : "s"} to the Admin for approval.`) + chalk2.dim(" Nothing was written yet.\n"));
|
|
362
362
|
const wait = session.prompter.interactive ? await session.prompter.confirm({ message: "Wait here for the Admin's decision? (approved changes are applied here right after)", initialValue: true }) : false;
|
|
363
363
|
if (wait) {
|
|
364
|
-
const { runTeamSync } = await import("./sync-
|
|
364
|
+
const { runTeamSync } = await import("./sync-LTPGXMRU.js");
|
|
365
365
|
const summary = await runTeamSync(session, { wait: true });
|
|
366
366
|
return { approved: summary.applied > 0, sent: res.ids.length };
|
|
367
367
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createWebTools
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HFMRQTXE.js";
|
|
4
4
|
import {
|
|
5
5
|
createReadOnlyTools,
|
|
6
6
|
dedupeReadOnlyTools,
|
|
@@ -8,19 +8,19 @@ import {
|
|
|
8
8
|
finishOnLastStep,
|
|
9
9
|
generateWithProgress,
|
|
10
10
|
renderTerminalMarkdown
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-44LLGJXH.js";
|
|
12
12
|
import {
|
|
13
13
|
ToolExecutor
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-CGJ4VEUD.js";
|
|
15
15
|
import {
|
|
16
16
|
agentConfigFrom,
|
|
17
17
|
createTracker,
|
|
18
18
|
instructionsFor,
|
|
19
19
|
readOnlyAgentConfig
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-KAWTUWO2.js";
|
|
21
21
|
import {
|
|
22
22
|
AI_MAX_RETRIES
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-R4PMMMD5.js";
|
|
24
24
|
|
|
25
25
|
// modes/ask/orchestrator.ts
|
|
26
26
|
import fs from "node:fs";
|
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
finishOnLastStep,
|
|
5
5
|
generateWithProgress,
|
|
6
6
|
renderTerminalMarkdown
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-44LLGJXH.js";
|
|
8
8
|
import {
|
|
9
9
|
ToolExecutor
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-CGJ4VEUD.js";
|
|
11
11
|
import {
|
|
12
12
|
assertProjectOpen,
|
|
13
13
|
describeTeamMode,
|
|
14
14
|
getTeamContext
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-OLL2WJVK.js";
|
|
16
16
|
import {
|
|
17
17
|
RunCancelledError
|
|
18
18
|
} from "./chunk-HGBZ55ND.js";
|
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
agentConfigFrom,
|
|
21
21
|
createTracker,
|
|
22
22
|
instructionsFor
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-KAWTUWO2.js";
|
|
24
24
|
import {
|
|
25
25
|
AI_MAX_RETRIES
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-R4PMMMD5.js";
|
|
27
27
|
|
|
28
28
|
// modes/agent/orchestrator.ts
|
|
29
29
|
import chalk from "chalk";
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clipOutput
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CGJ4VEUD.js";
|
|
4
4
|
import {
|
|
5
5
|
colorizePatch,
|
|
6
6
|
riskBadge
|
|
7
7
|
} from "./chunk-QRAFFI5V.js";
|
|
8
8
|
import {
|
|
9
9
|
getTeamContext
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import {
|
|
12
|
-
readSyncState,
|
|
13
|
-
sha256Hex,
|
|
14
|
-
writeSyncState
|
|
15
|
-
} from "./chunk-E4DRW4AW.js";
|
|
10
|
+
} from "./chunk-OLL2WJVK.js";
|
|
16
11
|
import {
|
|
17
12
|
RunCancelledError,
|
|
18
13
|
runCancellable
|
|
@@ -21,16 +16,19 @@ import {
|
|
|
21
16
|
createAuditLogger
|
|
22
17
|
} from "./chunk-5WH3FNFK.js";
|
|
23
18
|
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} from "./chunk-IT46XDPQ.js";
|
|
19
|
+
readSyncState,
|
|
20
|
+
sha256Hex,
|
|
21
|
+
writeSyncState
|
|
22
|
+
} from "./chunk-H2FAKNUI.js";
|
|
29
23
|
import {
|
|
24
|
+
UserFacingError,
|
|
30
25
|
isSecretPath,
|
|
31
26
|
relativePosix,
|
|
32
27
|
resolveInsideRoot
|
|
33
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-R4PMMMD5.js";
|
|
29
|
+
import {
|
|
30
|
+
NonInteractiveError
|
|
31
|
+
} from "./chunk-IT46XDPQ.js";
|
|
34
32
|
|
|
35
33
|
// team/sync.ts
|
|
36
34
|
import { spawnSync } from "node:child_process";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UserFacingError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-R4PMMMD5.js";
|
|
4
4
|
import {
|
|
5
5
|
userConfigDir
|
|
6
6
|
} from "./chunk-2GDAWRT7.js";
|
|
@@ -106,6 +106,13 @@ function readSyncState(root) {
|
|
|
106
106
|
function writeSyncState(root, state) {
|
|
107
107
|
writeJson(syncStateFile(root), { seen: state.seen.slice(-2e3), lastSyncAt: state.lastSyncAt });
|
|
108
108
|
}
|
|
109
|
+
function teamAiFor(root, env = process.env) {
|
|
110
|
+
if (env.SAARTHICLAW_OWN_AI_KEY === "1") return void 0;
|
|
111
|
+
const link = readTeamLink(root, env);
|
|
112
|
+
if (!link?.teamAi) return void 0;
|
|
113
|
+
const key = readKey(link.server, root, env);
|
|
114
|
+
return key ? { server: link.server, key } : void 0;
|
|
115
|
+
}
|
|
109
116
|
|
|
110
117
|
export {
|
|
111
118
|
KEY_PATTERN,
|
|
@@ -122,5 +129,6 @@ export {
|
|
|
122
129
|
saveKey,
|
|
123
130
|
removeKey,
|
|
124
131
|
readSyncState,
|
|
125
|
-
writeSyncState
|
|
132
|
+
writeSyncState,
|
|
133
|
+
teamAiFor
|
|
126
134
|
};
|
|
@@ -2,12 +2,14 @@ import {
|
|
|
2
2
|
attachAuditLog
|
|
3
3
|
} from "./chunk-5WH3FNFK.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
5
|
+
teamAiFor
|
|
6
|
+
} from "./chunk-H2FAKNUI.js";
|
|
7
7
|
import {
|
|
8
8
|
getAgentModel,
|
|
9
|
+
getTeamModel,
|
|
10
|
+
isSecretPath,
|
|
9
11
|
mapAiError
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-R4PMMMD5.js";
|
|
11
13
|
|
|
12
14
|
// modes/session.ts
|
|
13
15
|
import chalk from "chalk";
|
|
@@ -352,7 +354,11 @@ function createSession(opts) {
|
|
|
352
354
|
config,
|
|
353
355
|
prompter: opts.prompter,
|
|
354
356
|
debug: Boolean(opts.debug),
|
|
355
|
-
model: opts.model ?? (() =>
|
|
357
|
+
model: opts.model ?? (() => {
|
|
358
|
+
const team = teamAiFor(config.root, opts.env ?? process.env);
|
|
359
|
+
if (team) return getTeamModel(team.server, team.key, config.model);
|
|
360
|
+
return getAgentModel({ apiKey: config.openrouterApiKey, model: config.model });
|
|
361
|
+
}),
|
|
356
362
|
teamFetch: opts.teamFetch,
|
|
357
363
|
env: opts.env,
|
|
358
364
|
teamPollMs: opts.teamPollMs
|
|
@@ -385,6 +391,9 @@ ${chalk.red("✖")} ${chalk.bold(f.title)}`);
|
|
|
385
391
|
if (debug && error instanceof Error && error.stack) console.error(chalk.dim(error.stack));
|
|
386
392
|
console.error("");
|
|
387
393
|
}
|
|
394
|
+
function hasAiAccess(session) {
|
|
395
|
+
return Boolean(session.config.openrouterApiKey) || Boolean(teamAiFor(session.root, session.env ?? process.env));
|
|
396
|
+
}
|
|
388
397
|
|
|
389
398
|
export {
|
|
390
399
|
agentConfigFrom,
|
|
@@ -393,5 +402,6 @@ export {
|
|
|
393
402
|
hasWebTools,
|
|
394
403
|
instructionsFor,
|
|
395
404
|
createTracker,
|
|
396
|
-
reportAiError
|
|
405
|
+
reportAiError,
|
|
406
|
+
hasAiAccess
|
|
397
407
|
};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
readKey,
|
|
3
|
-
readTeamLink
|
|
4
|
-
} from "./chunk-E4DRW4AW.js";
|
|
5
1
|
import {
|
|
6
2
|
LEVEL_LABEL,
|
|
7
3
|
TeamClient,
|
|
8
4
|
TeamNetworkError
|
|
9
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-OJCC4JH2.js";
|
|
6
|
+
import {
|
|
7
|
+
readKey,
|
|
8
|
+
readTeamLink,
|
|
9
|
+
writeTeamLink
|
|
10
|
+
} from "./chunk-H2FAKNUI.js";
|
|
10
11
|
import {
|
|
11
12
|
UserFacingError
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-R4PMMMD5.js";
|
|
13
14
|
|
|
14
15
|
// team/context.ts
|
|
15
16
|
import chalk from "chalk";
|
|
@@ -36,7 +37,14 @@ async function resolve(session) {
|
|
|
36
37
|
const { client, link } = found;
|
|
37
38
|
try {
|
|
38
39
|
const me = await client.whoami();
|
|
39
|
-
|
|
40
|
+
const teamAi = Boolean(me.policy?.teamAi);
|
|
41
|
+
if (link.teamAi !== teamAi && !envOf(session).SAARTHICLAW_TEAM_SERVER) {
|
|
42
|
+
try {
|
|
43
|
+
writeTeamLink(session.root, { ...link, teamAi });
|
|
44
|
+
} catch {
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return { mode: me.permissionLevel, client, me, link: { ...link, teamAi } };
|
|
40
48
|
} catch (e) {
|
|
41
49
|
if (e instanceof TeamNetworkError && link.role === "admin") {
|
|
42
50
|
console.log(chalk.yellow(`⚠ Team dashboard unreachable (${link.server}). Working as Admin; changes won't be logged there this time.`));
|
|
@@ -63,7 +71,8 @@ function describeTeamMode(ctx) {
|
|
|
63
71
|
needs_approval: "your changes are sent to the Admin; nothing is written until they approve.",
|
|
64
72
|
suggest_only: "you can ask and plan, and send suggestions; code changes are not allowed."
|
|
65
73
|
};
|
|
66
|
-
|
|
74
|
+
const ai = ctx.me?.policy?.teamAi ? " AI: the team's key (from the dashboard)." : "";
|
|
75
|
+
return `👥 Team${project}: ${who} — ${how[ctx.mode]}${ai}`;
|
|
67
76
|
}
|
|
68
77
|
function assertProjectOpen(ctx) {
|
|
69
78
|
const status = ctx.me?.project?.status;
|