@kenkaiiii/gg-core 5.92.0 → 5.93.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.
Files changed (3) hide show
  1. package/NOTICE +1 -1
  2. package/README.md +52 -36
  3. package/package.json +17 -4
package/NOTICE CHANGED
@@ -1,5 +1,5 @@
1
1
  GG Coder
2
- Copyright (C) 2025-2026 KenKai
2
+ Copyright (C) 2025-2026 Ken Kai
3
3
 
4
4
  This program is free software: you can redistribute it and/or modify it under
5
5
  the terms of the GNU Affero General Public License as published by the Free
package/README.md CHANGED
@@ -1,68 +1,84 @@
1
- # @kenkaiiii/gg-core
1
+ <h1 align="center">@kenkaiiii/gg-core</h1>
2
2
 
3
3
  <p align="center">
4
- <strong>Model registry, auth storage and local-model discovery. No UI, no agent loop.</strong>
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="../../LICENSE"><img src="https://img.shields.io/badge/License-AGPL--3.0-blue.svg?style=for-the-badge" alt="AGPL-3.0 License"></a>
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
- The shared foundation under GG Coder's app and CLI. It depends only on [`@kenkaiiii/gg-ai`](../gg-ai/README.md), never on React, Ink or the agent loop.
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
- Part of the [GG Framework](../../README.md) monorepo.
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 i @kenkaiiii/gg-core
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
- Two lighter subpath entries skip the rest of the package:
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
- `AuthStorage` throws `NotLoggedInError` when a provider has no stored credentials.
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 | `loginAnthropic`, `loginOpenAI`, `loginKimi`, `loginXai`, `loginGemini` and matching `refresh…Token` functions |
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. See [LICENSE](../../LICENSE).
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.
package/package.json CHANGED
@@ -1,17 +1,30 @@
1
1
  {
2
2
  "name": "@kenkaiiii/gg-core",
3
- "version": "5.92.0",
3
+ "version": "5.93.0",
4
4
  "type": "module",
5
- "description": "Provider-agnostic, UI-free shared foundation: model registry, auth, paths, telegram, voice",
5
+ "description": "Model registry, sign-in and stored credentials, and local model discovery for apps built on gg-ai. No UI, no agent loop.",
6
+ "author": "Ken Kai",
7
+ "keywords": [
8
+ "llm",
9
+ "ai",
10
+ "model-registry",
11
+ "oauth",
12
+ "ollama",
13
+ "local-models"
14
+ ],
6
15
  "license": "AGPL-3.0-only",
7
16
  "engines": {
8
17
  "node": ">=22"
9
18
  },
10
19
  "repository": {
11
20
  "type": "git",
12
- "url": "git+https://github.com/kenkaiiii/gg-framework.git",
21
+ "url": "git+https://github.com/KenKaiii/gg-framework.git",
13
22
  "directory": "packages/gg-core"
14
23
  },
24
+ "homepage": "https://github.com/KenKaiii/gg-framework/tree/main/packages/gg-core#readme",
25
+ "bugs": {
26
+ "url": "https://github.com/KenKaiii/gg-framework/issues"
27
+ },
15
28
  "exports": {
16
29
  ".": {
17
30
  "types": "./dist/index.d.ts",
@@ -37,7 +50,7 @@
37
50
  "NOTICE"
38
51
  ],
39
52
  "dependencies": {
40
- "@kenkaiiii/gg-ai": "5.92.0"
53
+ "@kenkaiiii/gg-ai": "5.93.0"
41
54
  },
42
55
  "optionalDependencies": {
43
56
  "@huggingface/transformers": "4.2.0",