@garuda-agent/garuda 0.0.1 → 0.14.1

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 (61) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +4 -0
  4. package/README.md +1040 -0
  5. package/SECURITY.md +32 -0
  6. package/dist/anthropic-NQDBCHJU.js +327 -0
  7. package/dist/chunk-35GMLLJW.js +157 -0
  8. package/dist/chunk-36GQIVGT.js +526 -0
  9. package/dist/chunk-3CEPHS4C.js +231 -0
  10. package/dist/chunk-3NJNVZTK.js +123 -0
  11. package/dist/chunk-42DSA4EA.js +116 -0
  12. package/dist/chunk-4P26OKTP.js +100 -0
  13. package/dist/chunk-5DEWP3YX.js +139 -0
  14. package/dist/chunk-6TWBYMY7.js +9 -0
  15. package/dist/chunk-A2QAIRQL.js +45 -0
  16. package/dist/chunk-ATW7BNIG.js +31 -0
  17. package/dist/chunk-D5O5CIWK.js +1339 -0
  18. package/dist/chunk-EU7PA45O.js +324 -0
  19. package/dist/chunk-FARS4R67.js +206 -0
  20. package/dist/chunk-G2AX7MGS.js +36 -0
  21. package/dist/chunk-HUIK3WXO.js +234 -0
  22. package/dist/chunk-ITITLNAR.js +9341 -0
  23. package/dist/chunk-KKB5W47S.js +231 -0
  24. package/dist/chunk-KWRJREUH.js +283 -0
  25. package/dist/chunk-N4I6YS3E.js +73 -0
  26. package/dist/chunk-OUCV3FCT.js +205 -0
  27. package/dist/chunk-PZS3V6P3.js +46 -0
  28. package/dist/chunk-QOW5TK4L.js +320 -0
  29. package/dist/chunk-U4OQVT2T.js +73 -0
  30. package/dist/chunk-V7WPGQLB.js +207 -0
  31. package/dist/chunk-W7BPYQMW.js +173 -0
  32. package/dist/chunk-WMOLXTBU.js +61 -0
  33. package/dist/chunk-YIZWYUBG.js +138 -0
  34. package/dist/chunk-YM6T4J5V.js +1350 -0
  35. package/dist/chunk-YQTGMCU6.js +111 -0
  36. package/dist/chunk-ZAE25JM2.js +158 -0
  37. package/dist/chunk-ZGZ2ZADL.js +49 -0
  38. package/dist/cli/index.js +1191 -0
  39. package/dist/create-Y5SXJUXO.js +223 -0
  40. package/dist/deadline-F5RJJ2QW.js +86 -0
  41. package/dist/detect-LARDSLLZ.js +10 -0
  42. package/dist/evalCommand-5TG2CKZY.js +2795 -0
  43. package/dist/export-HN3CT7AV.js +158 -0
  44. package/dist/inkChat-3J26R24L.js +1190 -0
  45. package/dist/install-XWLU22OH.js +17 -0
  46. package/dist/job-3NYDMP2M.js +31 -0
  47. package/dist/jobCommand-IYWZWTSI.js +30 -0
  48. package/dist/launchd-2FL5UN2U.js +40 -0
  49. package/dist/lspCommand-TJEZBV2E.js +99 -0
  50. package/dist/manager-4PMSXT47.js +14 -0
  51. package/dist/manager-EBTYO2GR.js +847 -0
  52. package/dist/nightCommand-DUNWJASI.js +247 -0
  53. package/dist/oauth-W6OK6XXO.js +23 -0
  54. package/dist/openaiCompatible-CJWVJP5M.js +501 -0
  55. package/dist/policy-EJPLEEXP.js +31 -0
  56. package/dist/proxy-XJAHCZB2.js +192 -0
  57. package/dist/remove-AENULZZE.js +59 -0
  58. package/dist/run-66Y6R2KU.js +886 -0
  59. package/dist/servers-6YDGWOZ6.js +24 -0
  60. package/dist/text-J2GD647J.js +11 -0
  61. package/package.json +83 -3
@@ -0,0 +1,139 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/mcp/trust.ts
4
+ import { randomBytes } from "crypto";
5
+ import { mkdir, readFile, rename, writeFile } from "fs/promises";
6
+ import { homedir } from "os";
7
+ import { dirname, join } from "path";
8
+ import { z } from "zod";
9
+ var TRUST_FILE = join(".garuda", "trust.json");
10
+ var entry = z.object({
11
+ def: z.string().optional(),
12
+ tools: z.string().optional(),
13
+ /** A hash per tool name, to say which tools changed. */
14
+ toolHashes: z.record(z.string(), z.string()).optional()
15
+ });
16
+ var schema = z.object({
17
+ version: z.literal(1),
18
+ mcp: z.record(z.string(), z.record(z.string(), entry)).default({}),
19
+ /** Project root → hash of the approved project hooks. */
20
+ hooks: z.record(z.string(), z.string()).default({}),
21
+ /** Project root → command name → hash of the approved command file (0.4). */
22
+ commands: z.record(z.string(), z.record(z.string(), z.string())).default({}),
23
+ /** Project root → skill name → hash of the approved SKILL.md (0.5). */
24
+ skills: z.record(z.string(), z.record(z.string(), z.string())).default({}),
25
+ /** Project root → agent name → hash of the approved agent file (0.5). */
26
+ agents: z.record(z.string(), z.record(z.string(), z.string())).default({}),
27
+ /** Project root → hash of the approved network allowlist (0.13). */
28
+ network: z.record(z.string(), z.string()).default({}),
29
+ /** Project root → language plugin name → hash of the approved plugin file (0.16). */
30
+ languages: z.record(z.string(), z.record(z.string(), z.string())).default({}),
31
+ /** Project root → hash of the approved settings parts that loosen safety (review, 2026-10). */
32
+ settings: z.record(z.string(), z.string()).default({})
33
+ });
34
+ var USER_SCOPE = "~";
35
+ var TrustStore = class _TrustStore {
36
+ constructor(file) {
37
+ this.file = file;
38
+ }
39
+ file;
40
+ data = {
41
+ version: 1,
42
+ mcp: {},
43
+ hooks: {},
44
+ commands: {},
45
+ skills: {},
46
+ agents: {},
47
+ network: {},
48
+ languages: {},
49
+ settings: {}
50
+ };
51
+ static async open(home = homedir()) {
52
+ const store = new _TrustStore(join(home, TRUST_FILE));
53
+ try {
54
+ const parsed = schema.safeParse(JSON.parse(await readFile(store.file, "utf8")));
55
+ if (parsed.success) store.data = parsed.data;
56
+ } catch {
57
+ }
58
+ return store;
59
+ }
60
+ get(scope, server) {
61
+ return this.data.mcp[scope]?.[server] ?? {};
62
+ }
63
+ hooksHash(root) {
64
+ return this.data.hooks[root];
65
+ }
66
+ async setHooksHash(root, hash) {
67
+ this.data.hooks[root] = hash;
68
+ await this.save();
69
+ }
70
+ commandHash(root, name) {
71
+ return this.data.commands[root]?.[name];
72
+ }
73
+ async setCommandHash(root, name, hash) {
74
+ const commands = this.data.commands[root] ?? {};
75
+ this.data.commands[root] = commands;
76
+ commands[name] = hash;
77
+ await this.save();
78
+ }
79
+ skillHash(root, name) {
80
+ return this.data.skills[root]?.[name];
81
+ }
82
+ async setSkillHash(root, name, hash) {
83
+ const skills = this.data.skills[root] ?? {};
84
+ this.data.skills[root] = skills;
85
+ skills[name] = hash;
86
+ await this.save();
87
+ }
88
+ agentHash(root, name) {
89
+ return this.data.agents[root]?.[name];
90
+ }
91
+ async setAgentHash(root, name, hash) {
92
+ const agents = this.data.agents[root] ?? {};
93
+ this.data.agents[root] = agents;
94
+ agents[name] = hash;
95
+ await this.save();
96
+ }
97
+ networkHash(root) {
98
+ return this.data.network[root];
99
+ }
100
+ async setNetworkHash(root, hash) {
101
+ this.data.network[root] = hash;
102
+ await this.save();
103
+ }
104
+ settingsHash(root) {
105
+ return this.data.settings[root];
106
+ }
107
+ async setSettingsHash(root, hash) {
108
+ this.data.settings[root] = hash;
109
+ await this.save();
110
+ }
111
+ languageHash(root, name) {
112
+ return this.data.languages[root]?.[name];
113
+ }
114
+ async setLanguageHash(root, name, hash) {
115
+ const languages = this.data.languages[root] ?? {};
116
+ this.data.languages[root] = languages;
117
+ languages[name] = hash;
118
+ await this.save();
119
+ }
120
+ async set(scope, server, value) {
121
+ const servers = this.data.mcp[scope] ?? {};
122
+ this.data.mcp[scope] = servers;
123
+ servers[server] = { ...servers[server], ...value };
124
+ await this.save();
125
+ }
126
+ async save() {
127
+ await mkdir(dirname(this.file), { recursive: true, mode: 448 });
128
+ const temp = `${this.file}.${randomBytes(4).toString("hex")}.tmp`;
129
+ await writeFile(temp, `${JSON.stringify(this.data, null, 2)}
130
+ `, { mode: 384, flag: "wx" });
131
+ await rename(temp, this.file);
132
+ }
133
+ };
134
+
135
+ export {
136
+ USER_SCOPE,
137
+ TrustStore
138
+ };
139
+ //# sourceMappingURL=chunk-5DEWP3YX.js.map
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/version.ts
4
+ var VERSION = "0.14.1";
5
+
6
+ export {
7
+ VERSION
8
+ };
9
+ //# sourceMappingURL=chunk-6TWBYMY7.js.map
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/model/serverTools.ts
4
+ function serverCallText(call) {
5
+ const input = call.input ?? {};
6
+ return typeof input.query === "string" ? input.query : JSON.stringify(call.input);
7
+ }
8
+ function serverResultSummary(result) {
9
+ if (result === void 0) return "runs with the next request";
10
+ if (result.error !== void 0) return `error ${result.error}`;
11
+ const n = result.results.length;
12
+ return n === 0 ? "no results" : `${n} result${n === 1 ? "" : "s"}`;
13
+ }
14
+ function serverPairText(call, result) {
15
+ const head = `[Earlier ${result.name}${call === void 0 ? "" : ` "${serverCallText(call)}"`}: ${serverResultSummary(result)}]`;
16
+ return [head, ...result.results.map((r, i) => `${i + 1}. ${r.title} \u2014 ${r.url}`)].join("\n");
17
+ }
18
+ function withoutServerBlocks(content) {
19
+ const calls = /* @__PURE__ */ new Map();
20
+ for (const block of content) if (block.type === "server_tool_use") calls.set(block.id, block);
21
+ const out = [];
22
+ for (const block of content) {
23
+ if (block.type === "server_tool_use") continue;
24
+ if (block.type === "server_tool_result") {
25
+ out.push({ type: "text", text: serverPairText(calls.get(block.toolUseId), block) });
26
+ } else if (block.type === "text" && block.citations !== void 0) {
27
+ out.push({ type: "text", text: block.text });
28
+ } else out.push(block);
29
+ }
30
+ return out;
31
+ }
32
+ function hasServerBlocks(content) {
33
+ return content.some(
34
+ (b) => b.type === "server_tool_use" || b.type === "server_tool_result" || b.type === "text" && b.citations !== void 0
35
+ );
36
+ }
37
+
38
+ export {
39
+ serverCallText,
40
+ serverResultSummary,
41
+ serverPairText,
42
+ withoutServerBlocks,
43
+ hasServerBlocks
44
+ };
45
+ //# sourceMappingURL=chunk-A2QAIRQL.js.map
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/net/address.ts
4
+ import ipaddr from "ipaddr.js";
5
+ function checkAddress(address, allowLocalhost) {
6
+ let parsed;
7
+ try {
8
+ parsed = ipaddr.process(address);
9
+ } catch {
10
+ return { ok: false, range: "invalid" };
11
+ }
12
+ const range = parsed.range();
13
+ if (range === "unicast") return { ok: true };
14
+ if (range === "loopback" && allowLocalhost) return { ok: true };
15
+ return { ok: false, range };
16
+ }
17
+ function isIpLiteral(host) {
18
+ return ipaddr.isValid(host.replace(/^\[|\]$/g, ""));
19
+ }
20
+ function isLoopbackHost(host) {
21
+ const bare = host.replace(/^\[|\]$/g, "");
22
+ if (bare === "localhost") return true;
23
+ return ipaddr.isValid(bare) && ipaddr.process(bare).range() === "loopback";
24
+ }
25
+
26
+ export {
27
+ checkAddress,
28
+ isIpLiteral,
29
+ isLoopbackHost
30
+ };
31
+ //# sourceMappingURL=chunk-ATW7BNIG.js.map