@schuttdev/gigai 0.1.0-beta.7 → 0.1.0-beta.8
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.
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
GigaiConfigSchema,
|
|
12
12
|
GigaiError,
|
|
13
13
|
decrypt,
|
|
14
|
+
encrypt,
|
|
14
15
|
generateEncryptionKey
|
|
15
16
|
} from "./chunk-4XUWD3DZ.js";
|
|
16
17
|
|
|
@@ -45,6 +46,7 @@ import { writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
|
45
46
|
import { resolve as resolve4, join as join3 } from "path";
|
|
46
47
|
import { execFile } from "child_process";
|
|
47
48
|
import { promisify } from "util";
|
|
49
|
+
import { randomBytes as randomBytes2 } from "crypto";
|
|
48
50
|
import { input as input2 } from "@inquirer/prompts";
|
|
49
51
|
import { readFile as readFile4, writeFile as writeFile3 } from "fs/promises";
|
|
50
52
|
import { resolve as resolve5 } from "path";
|
|
@@ -61,7 +63,7 @@ function connectWithToken(store, encryptedToken, orgUuid, encryptionKey, session
|
|
|
61
63
|
} catch {
|
|
62
64
|
throw new GigaiError(ErrorCode.TOKEN_DECRYPT_FAILED, "Failed to decrypt token");
|
|
63
65
|
}
|
|
64
|
-
if (decrypted.orgUuid !== orgUuid) {
|
|
66
|
+
if (decrypted.orgUuid !== "*" && decrypted.orgUuid !== orgUuid) {
|
|
65
67
|
throw new GigaiError(ErrorCode.ORG_MISMATCH, "Organization UUID mismatch");
|
|
66
68
|
}
|
|
67
69
|
return store.createSession(orgUuid, sessionTtlSeconds);
|
|
@@ -1042,20 +1044,21 @@ This skill gives you access to tools running on the user's machine via the gigai
|
|
|
1042
1044
|
- All tool execution happens on the user's machine, not in this container
|
|
1043
1045
|
`;
|
|
1044
1046
|
await writeFile2(join3(skillDir, "SKILL.md"), skillMd);
|
|
1047
|
+
const tokenPayload = {
|
|
1048
|
+
orgUuid: "*",
|
|
1049
|
+
serverFingerprint: randomBytes2(16).toString("hex"),
|
|
1050
|
+
createdAt: Date.now()
|
|
1051
|
+
};
|
|
1052
|
+
const encryptedToken = encrypt(tokenPayload, encryptionKey);
|
|
1045
1053
|
const skillConfig = {
|
|
1046
1054
|
server: serverUrl,
|
|
1047
|
-
token:
|
|
1055
|
+
token: JSON.stringify(encryptedToken)
|
|
1048
1056
|
};
|
|
1049
|
-
await writeFile2(join3(skillDir, "config.json"), JSON.stringify(skillConfig, null, 2) + "\n");
|
|
1057
|
+
await writeFile2(join3(skillDir, "config.json"), JSON.stringify(skillConfig, null, 2) + "\n", { mode: 384 });
|
|
1050
1058
|
console.log(` Skill template written to: ${skillDir}/`);
|
|
1051
|
-
const store = new AuthStore();
|
|
1052
|
-
const code = generatePairingCode(store, config.auth.pairingTtlSeconds);
|
|
1053
|
-
console.log(`
|
|
1054
|
-
Pairing code: ${code}`);
|
|
1055
|
-
console.log(` Expires in ${config.auth.pairingTtlSeconds / 60} minutes.`);
|
|
1056
1059
|
console.log(`
|
|
1057
1060
|
Start the server with: gigai server start${httpsConfig ? "" : " --dev"}`);
|
|
1058
|
-
|
|
1061
|
+
console.log(` Then upload gigai-skill/ contents to your Claude Project.`);
|
|
1059
1062
|
}
|
|
1060
1063
|
async function loadConfigFile(path) {
|
|
1061
1064
|
const configPath = resolve5(path ?? "gigai.config.json");
|
package/dist/index.js
CHANGED
|
@@ -438,7 +438,7 @@ function runCitty() {
|
|
|
438
438
|
dev: { type: "boolean", description: "Development mode (no HTTPS)" }
|
|
439
439
|
},
|
|
440
440
|
async run({ args }) {
|
|
441
|
-
const { startServer } = await import("./dist-
|
|
441
|
+
const { startServer } = await import("./dist-YHKBLFWY.js");
|
|
442
442
|
const extraArgs = [];
|
|
443
443
|
if (args.config) extraArgs.push("--config", args.config);
|
|
444
444
|
if (args.dev) extraArgs.push("--dev");
|
|
@@ -449,7 +449,7 @@ function runCitty() {
|
|
|
449
449
|
init: defineCommand({
|
|
450
450
|
meta: { name: "init", description: "Interactive setup wizard" },
|
|
451
451
|
async run() {
|
|
452
|
-
const { runInit } = await import("./dist-
|
|
452
|
+
const { runInit } = await import("./dist-YHKBLFWY.js");
|
|
453
453
|
await runInit();
|
|
454
454
|
}
|
|
455
455
|
}),
|
|
@@ -459,7 +459,7 @@ function runCitty() {
|
|
|
459
459
|
config: { type: "string", alias: "c", description: "Config file path" }
|
|
460
460
|
},
|
|
461
461
|
async run({ args }) {
|
|
462
|
-
const { generateServerPairingCode } = await import("./dist-
|
|
462
|
+
const { generateServerPairingCode } = await import("./dist-YHKBLFWY.js");
|
|
463
463
|
await generateServerPairingCode(args.config);
|
|
464
464
|
}
|
|
465
465
|
}),
|
|
@@ -486,21 +486,21 @@ function runCitty() {
|
|
|
486
486
|
cli: defineCommand({
|
|
487
487
|
meta: { name: "cli", description: "Wrap a CLI command" },
|
|
488
488
|
async run() {
|
|
489
|
-
const { wrapCli } = await import("./dist-
|
|
489
|
+
const { wrapCli } = await import("./dist-YHKBLFWY.js");
|
|
490
490
|
await wrapCli();
|
|
491
491
|
}
|
|
492
492
|
}),
|
|
493
493
|
mcp: defineCommand({
|
|
494
494
|
meta: { name: "mcp", description: "Wrap an MCP server" },
|
|
495
495
|
async run() {
|
|
496
|
-
const { wrapMcp } = await import("./dist-
|
|
496
|
+
const { wrapMcp } = await import("./dist-YHKBLFWY.js");
|
|
497
497
|
await wrapMcp();
|
|
498
498
|
}
|
|
499
499
|
}),
|
|
500
500
|
script: defineCommand({
|
|
501
501
|
meta: { name: "script", description: "Wrap a script" },
|
|
502
502
|
async run() {
|
|
503
|
-
const { wrapScript } = await import("./dist-
|
|
503
|
+
const { wrapScript } = await import("./dist-YHKBLFWY.js");
|
|
504
504
|
await wrapScript();
|
|
505
505
|
}
|
|
506
506
|
}),
|
|
@@ -510,7 +510,7 @@ function runCitty() {
|
|
|
510
510
|
path: { type: "positional", description: "Path to config file", required: true }
|
|
511
511
|
},
|
|
512
512
|
async run({ args }) {
|
|
513
|
-
const { wrapImport } = await import("./dist-
|
|
513
|
+
const { wrapImport } = await import("./dist-YHKBLFWY.js");
|
|
514
514
|
await wrapImport(args.path);
|
|
515
515
|
}
|
|
516
516
|
})
|
|
@@ -522,7 +522,7 @@ function runCitty() {
|
|
|
522
522
|
name: { type: "positional", description: "Tool name", required: true }
|
|
523
523
|
},
|
|
524
524
|
async run({ args }) {
|
|
525
|
-
const { unwrapTool } = await import("./dist-
|
|
525
|
+
const { unwrapTool } = await import("./dist-YHKBLFWY.js");
|
|
526
526
|
await unwrapTool(args.name);
|
|
527
527
|
}
|
|
528
528
|
});
|