@kenkaiiii/gg-core 5.92.0 → 5.94.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/NOTICE +1 -1
- package/README.md +52 -36
- package/dist/{chunk-2X5L6U4Z.js → chunk-GXOFTHM5.js} +4 -2
- package/dist/chunk-GXOFTHM5.js.map +1 -0
- package/dist/{chunk-SDUIKPGO.js → chunk-JLEBGMG4.js} +649 -164
- package/dist/chunk-JLEBGMG4.js.map +1 -0
- package/dist/index.cjs +826 -228
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +180 -37
- package/dist/index.d.ts +180 -37
- package/dist/index.js +170 -57
- package/dist/index.js.map +1 -1
- package/dist/model-registry.cjs +53 -16
- package/dist/model-registry.cjs.map +1 -1
- package/dist/model-registry.js +2 -2
- package/dist/paths.cjs +3 -1
- package/dist/paths.cjs.map +1 -1
- package/dist/paths.d.cts +4 -0
- package/dist/paths.d.ts +4 -0
- package/dist/paths.js +1 -1
- package/package.json +17 -4
- package/dist/chunk-2X5L6U4Z.js.map +0 -1
- package/dist/chunk-SDUIKPGO.js.map +0 -1
package/NOTICE
CHANGED
package/README.md
CHANGED
|
@@ -1,68 +1,84 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">@kenkaiiii/gg-core</h1>
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<strong>Model
|
|
4
|
+
<strong>Model list, sign-in and local model discovery for apps built on gg-ai.</strong>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
<a href="https://www.npmjs.com/package/@kenkaiiii/gg-core"><img src="https://img.shields.io/npm/v/@kenkaiiii/gg-core?style=for-the-badge" alt="npm version"></a>
|
|
9
|
-
<a href="
|
|
8
|
+
<a href="https://www.npmjs.com/package/@kenkaiiii/gg-core"><img src="https://img.shields.io/npm/v/@kenkaiiii/gg-core?style=for-the-badge&color=blue" alt="npm version"></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/@kenkaiiii/gg-core"><img src="https://img.shields.io/npm/dm/@kenkaiiii/gg-core?style=for-the-badge&color=2ecc71" alt="npm downloads per month"></a>
|
|
10
|
+
<a href="https://github.com/KenKaiii/gg-framework/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-AGPL--3.0-blue.svg?style=for-the-badge" alt="AGPL-3.0 License"></a>
|
|
10
11
|
</p>
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
gg-core is the shared base under [GG Coder](https://github.com/KenKaiii/gg-framework)'s desktop app and CLI. It knows every supported model (context window, image and video support, thinking levels), signs users in to their AI subscriptions, keeps those credentials fresh, and finds models running on the user's machine.
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
---
|
|
15
|
+
It has no UI and no agent loop. Its only framework dependency is [`@kenkaiiii/gg-ai`](https://www.npmjs.com/package/@kenkaiiii/gg-ai).
|
|
17
16
|
|
|
18
17
|
## Install
|
|
19
18
|
|
|
20
19
|
```bash
|
|
21
|
-
npm
|
|
20
|
+
npm install @kenkaiiii/gg-core
|
|
22
21
|
```
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
## What's inside
|
|
27
|
-
|
|
28
|
-
| Area | Main exports |
|
|
29
|
-
| --------------- | ----------------------------------------------------------------------------------------- |
|
|
30
|
-
| Model registry | `getModel`, `getAllModels`, `getModelsForProvider`, `getDefaultModel`, `getContextWindow` |
|
|
31
|
-
| Thinking levels | `getSupportedThinkingLevels`, `getMaxThinkingLevel`, `getDefaultThinkingLevel` |
|
|
32
|
-
| Auth storage | `AuthStorage` (reads and writes `~/.gg/auth.json`, refreshes OAuth tokens) |
|
|
33
|
-
| OAuth | Anthropic, OpenAI, Gemini, Kimi and xAI login flows |
|
|
34
|
-
| Local models | `discoverLocalModels` (Ollama, LM Studio, llama.cpp, vLLM, custom endpoints) |
|
|
35
|
-
| Paths | `getAppPaths` (every file under `~/.gg/`) |
|
|
36
|
-
| Other | Logger, file lock, usage limits, Telegram, voice transcription, auto-update |
|
|
23
|
+
Needs Node.js 22 or newer. Ships ESM and CommonJS builds with TypeScript types.
|
|
37
24
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
```ts
|
|
41
|
-
import { getModel } from "@kenkaiiii/gg-core/models";
|
|
42
|
-
import { getAppPaths } from "@kenkaiiii/gg-core/paths";
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## Example
|
|
25
|
+
## Quick start
|
|
48
26
|
|
|
49
27
|
```ts
|
|
50
28
|
import { AuthStorage, discoverLocalModels, getModel } from "@kenkaiiii/gg-core";
|
|
51
29
|
|
|
52
30
|
const model = getModel("claude-sonnet-5-5");
|
|
53
|
-
console.log(model?.contextWindow);
|
|
31
|
+
console.log(model?.contextWindow, model?.supportsImages); // 1000000 true
|
|
54
32
|
|
|
33
|
+
// Credentials saved by `ggcoder login` or the GG Coder app, refreshed when they expire.
|
|
55
34
|
const auth = new AuthStorage();
|
|
56
35
|
const token = await auth.resolveToken("anthropic");
|
|
57
36
|
|
|
37
|
+
// Models on a running Ollama server.
|
|
58
38
|
const { models } = await discoverLocalModels();
|
|
59
39
|
console.log(models.map((m) => m.id));
|
|
60
40
|
```
|
|
61
41
|
|
|
62
|
-
`
|
|
42
|
+
`resolveToken()` throws `NotLoggedInError` when the provider has no saved credentials.
|
|
43
|
+
|
|
44
|
+
## What's inside
|
|
45
|
+
|
|
46
|
+
| Area | Main exports |
|
|
47
|
+
| --------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
48
|
+
| Models | `getModel`, `getAllModels`, `getModelsForProvider`, `getDefaultModel`, `getContextWindow`, `MODELS` |
|
|
49
|
+
| Thinking levels | `getSupportedThinkingLevels`, `getMaxThinkingLevel`, `getDefaultThinkingLevel`, `getNextThinkingLevel` |
|
|
50
|
+
| Credentials | `AuthStorage`: reads and writes `~/.gg/auth.json`, refreshes sign-in tokens, safe across processes |
|
|
51
|
+
| Sign-in | `loginOpenAI`, `loginKimi`, `loginXai`, `loginGemini` and matching `refresh…Token` functions; `loginClaudeCode` for Claude |
|
|
52
|
+
| Provider list | `AUTH_PROVIDERS`: each provider's name, models and sign-in methods, ready for a login screen |
|
|
53
|
+
| Local models | `discoverLocalModels`, `probeEndpoint`: Ollama by default, plus LM Studio, llama.cpp, vLLM or any custom URL |
|
|
54
|
+
| Plan usage | `fetchSubscriptionUsage`: remaining Claude, ChatGPT and Kimi plan usage |
|
|
55
|
+
| Paths | `getAppPaths`: every file GG Coder keeps under `~/.gg/` |
|
|
56
|
+
| Other | Logger, file lock, Telegram bot, voice transcription, auto-update |
|
|
57
|
+
|
|
58
|
+
`AuthStorage` shares `~/.gg/auth.json` with GG Coder, so a user who has signed in there is already signed in to your tool. Pass a different file path to the constructor to keep your own.
|
|
59
|
+
|
|
60
|
+
## Lighter imports
|
|
61
|
+
|
|
62
|
+
Two subpaths load only what they need, which keeps startup fast:
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
import { getModel } from "@kenkaiiii/gg-core/models";
|
|
66
|
+
import { getAppPaths } from "@kenkaiiii/gg-core/paths";
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Voice transcription uses two optional dependencies (`@huggingface/transformers`, `ogg-opus-decoder`). Everything else works without them.
|
|
70
|
+
|
|
71
|
+
## The GG Framework
|
|
72
|
+
|
|
73
|
+
| Package | What it does |
|
|
74
|
+
| ------------------------------------------------------------------------ | -------------------------------------------------------------------------------- |
|
|
75
|
+
| [@kenkaiiii/gg-ai](https://www.npmjs.com/package/@kenkaiiii/gg-ai) | One streaming API for every provider |
|
|
76
|
+
| [@kenkaiiii/gg-agent](https://www.npmjs.com/package/@kenkaiiii/gg-agent) | The agent loop: runs tools and feeds results back to the model |
|
|
77
|
+
| **@kenkaiiii/gg-core** | Model list, sign-in and stored credentials, local model discovery (this package) |
|
|
78
|
+
| [@kenkaiiii/ggcoder](https://www.npmjs.com/package/@kenkaiiii/ggcoder) | The GG Coder coding agent: CLI, tools and sessions |
|
|
63
79
|
|
|
64
|
-
|
|
80
|
+
Source, issues and the desktop app: [github.com/KenKaiii/gg-framework](https://github.com/KenKaiii/gg-framework).
|
|
65
81
|
|
|
66
82
|
## License
|
|
67
83
|
|
|
68
|
-
AGPL-3.0-only
|
|
84
|
+
[AGPL-3.0-only](https://github.com/KenKaiii/gg-framework/blob/main/LICENSE). You can build on it; if you distribute your changes or run them as a network service, share their source under the same license.
|
|
@@ -21,11 +21,13 @@ function getAppPaths() {
|
|
|
21
21
|
agentsDir: path.join(agentDir, "agents"),
|
|
22
22
|
progressFile: path.join(agentDir, "progress.json"),
|
|
23
23
|
progressBackupFile: path.join(agentDir, "progress.backup.json"),
|
|
24
|
-
trophiesFile: path.join(agentDir, "trophies.json")
|
|
24
|
+
trophiesFile: path.join(agentDir, "trophies.json"),
|
|
25
|
+
claudeCodeDir: path.join(agentDir, "claude-code"),
|
|
26
|
+
claudeCodeConfigDir: path.join(agentDir, "claude-code", "config")
|
|
25
27
|
};
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
export {
|
|
29
31
|
getAppPaths
|
|
30
32
|
};
|
|
31
|
-
//# sourceMappingURL=chunk-
|
|
33
|
+
//# sourceMappingURL=chunk-GXOFTHM5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/paths.ts"],"sourcesContent":["import path from \"node:path\";\nimport os from \"node:os\";\n\nexport interface AppPaths {\n agentDir: string;\n sessionsDir: string;\n subagentSessionsDir: string;\n subagentsDir: string;\n settingsFile: string;\n authFile: string;\n telegramFile: string;\n agentHomeFile: string;\n mcpFile: string;\n mcpAuthFile: string;\n /** Cached MCP tool catalog, so a cold start can answer tool_search honestly. */\n mcpCatalogFile: string;\n logFile: string;\n skillsDir: string;\n extensionsDir: string;\n agentsDir: string;\n progressFile: string;\n progressBackupFile: string;\n /** Earned trophies and the counters that unlock them. */\n trophiesFile: string;\n /** On-demand Claude Code binaries for \"Sign in with Claude\", one dir per version. */\n claudeCodeDir: string;\n /** GG Coder's own Claude Code login (CLAUDE_CONFIG_DIR), separate from the user's. */\n claudeCodeConfigDir: string;\n}\n\nexport function getAppPaths(): AppPaths {\n const agentDir = path.join(os.homedir(), \".gg\");\n return {\n agentDir,\n sessionsDir: path.join(agentDir, \"sessions\"),\n subagentSessionsDir: path.join(agentDir, \"subagent-sessions\"),\n subagentsDir: path.join(agentDir, \"subagents\"),\n settingsFile: path.join(agentDir, \"settings.json\"),\n authFile: path.join(agentDir, \"auth.json\"),\n telegramFile: path.join(agentDir, \"telegram.json\"),\n agentHomeFile: path.join(agentDir, \"agent-home.json\"),\n mcpFile: path.join(agentDir, \"mcp.json\"),\n mcpAuthFile: path.join(agentDir, \"mcp-auth.json\"),\n mcpCatalogFile: path.join(agentDir, \"mcp-catalog.json\"),\n logFile: path.join(agentDir, \"debug.log\"),\n skillsDir: path.join(agentDir, \"skills\"),\n extensionsDir: path.join(agentDir, \"extensions\"),\n agentsDir: path.join(agentDir, \"agents\"),\n progressFile: path.join(agentDir, \"progress.json\"),\n progressBackupFile: path.join(agentDir, \"progress.backup.json\"),\n trophiesFile: path.join(agentDir, \"trophies.json\"),\n claudeCodeDir: path.join(agentDir, \"claude-code\"),\n claudeCodeConfigDir: path.join(agentDir, \"claude-code\", \"config\"),\n };\n}\n"],"mappings":";AAAA,OAAO,UAAU;AACjB,OAAO,QAAQ;AA6BR,SAAS,cAAwB;AACtC,QAAM,WAAW,KAAK,KAAK,GAAG,QAAQ,GAAG,KAAK;AAC9C,SAAO;AAAA,IACL;AAAA,IACA,aAAa,KAAK,KAAK,UAAU,UAAU;AAAA,IAC3C,qBAAqB,KAAK,KAAK,UAAU,mBAAmB;AAAA,IAC5D,cAAc,KAAK,KAAK,UAAU,WAAW;AAAA,IAC7C,cAAc,KAAK,KAAK,UAAU,eAAe;AAAA,IACjD,UAAU,KAAK,KAAK,UAAU,WAAW;AAAA,IACzC,cAAc,KAAK,KAAK,UAAU,eAAe;AAAA,IACjD,eAAe,KAAK,KAAK,UAAU,iBAAiB;AAAA,IACpD,SAAS,KAAK,KAAK,UAAU,UAAU;AAAA,IACvC,aAAa,KAAK,KAAK,UAAU,eAAe;AAAA,IAChD,gBAAgB,KAAK,KAAK,UAAU,kBAAkB;AAAA,IACtD,SAAS,KAAK,KAAK,UAAU,WAAW;AAAA,IACxC,WAAW,KAAK,KAAK,UAAU,QAAQ;AAAA,IACvC,eAAe,KAAK,KAAK,UAAU,YAAY;AAAA,IAC/C,WAAW,KAAK,KAAK,UAAU,QAAQ;AAAA,IACvC,cAAc,KAAK,KAAK,UAAU,eAAe;AAAA,IACjD,oBAAoB,KAAK,KAAK,UAAU,sBAAsB;AAAA,IAC9D,cAAc,KAAK,KAAK,UAAU,eAAe;AAAA,IACjD,eAAe,KAAK,KAAK,UAAU,aAAa;AAAA,IAChD,qBAAqB,KAAK,KAAK,UAAU,eAAe,QAAQ;AAAA,EAClE;AACF;","names":[]}
|