@kenkaiiii/gg-core 5.16.0 → 5.18.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/dist/index.cjs CHANGED
@@ -59,6 +59,7 @@ __export(index_exports, {
59
59
  getSessionId: () => getSessionId,
60
60
  getSummaryModel: () => getSummaryModel,
61
61
  getSupportedThinkingLevels: () => getSupportedThinkingLevels,
62
+ getToolResultCharLimit: () => getToolResultCharLimit,
62
63
  getVideoByteLimit: () => getVideoByteLimit,
63
64
  isKimiCodingEndpoint: () => isKimiCodingEndpoint,
64
65
  isLoggerOpen: () => isLoggerOpen,
@@ -97,6 +98,8 @@ function getAppPaths() {
97
98
  return {
98
99
  agentDir,
99
100
  sessionsDir: import_node_path.default.join(agentDir, "sessions"),
101
+ subagentSessionsDir: import_node_path.default.join(agentDir, "subagent-sessions"),
102
+ subagentsDir: import_node_path.default.join(agentDir, "subagents"),
100
103
  settingsFile: import_node_path.default.join(agentDir, "settings.json"),
101
104
  authFile: import_node_path.default.join(agentDir, "auth.json"),
102
105
  telegramFile: import_node_path.default.join(agentDir, "telegram.json"),
@@ -141,11 +144,13 @@ var import_node_path3 = __toESM(require("path"), 1);
141
144
  var import_node_fs = __toESM(require("fs"), 1);
142
145
  var import_node_path2 = __toESM(require("path"), 1);
143
146
  var import_node_crypto = require("crypto");
147
+ var import_gg_ai = require("@kenkaiiii/gg-ai");
144
148
  var MAX_BYTES = 10 * 1024 * 1024;
145
149
  var fd = null;
146
150
  var sessionId = "";
147
151
  var appName = "app";
148
152
  var cleanups = [];
153
+ var exactSecrets = [];
149
154
  function rotateIfNeeded(filePath) {
150
155
  try {
151
156
  const st = import_node_fs.default.statSync(filePath);
@@ -162,6 +167,7 @@ function rotateIfNeeded(filePath) {
162
167
  function openLog(filePath, name) {
163
168
  if (fd !== null) return false;
164
169
  appName = name;
170
+ exactSecrets = (0, import_gg_ai.environmentSecrets)(process.env);
165
171
  try {
166
172
  import_node_fs.default.mkdirSync(import_node_path2.default.dirname(filePath), { recursive: true, mode: 448 });
167
173
  } catch {
@@ -188,9 +194,15 @@ function isLoggerOpen() {
188
194
  function log(level, category, message, data) {
189
195
  if (fd === null) return;
190
196
  const ts = (/* @__PURE__ */ new Date()).toISOString();
191
- let line = `[${ts}] [sid=${sessionId}] [${level}] [${category}] ${message}`;
197
+ const safeMessage = (0, import_gg_ai.redactText)(message, { secrets: exactSecrets });
198
+ let line = `[${ts}] [sid=${sessionId}] [${level}] [${category}] ${safeMessage}`;
192
199
  if (data) {
193
- const pairs = Object.entries(data).map(([k, v]) => `${k}=${typeof v === "string" ? v : JSON.stringify(v)}`).join(" ");
200
+ const safeData = (0, import_gg_ai.redactValue)(data, { secrets: exactSecrets });
201
+ const pairs = Object.entries(safeData).map(([k, v]) => {
202
+ if (typeof v === "string") return `${k}=${v}`;
203
+ if (typeof v === "bigint") return `${k}=${String(v)}`;
204
+ return `${k}=${JSON.stringify(v)}`;
205
+ }).join(" ");
194
206
  if (pairs) line += ` ${pairs}`;
195
207
  }
196
208
  line += "\n";
@@ -210,6 +222,7 @@ function closeLogger(opts) {
210
222
  } catch {
211
223
  }
212
224
  fd = null;
225
+ exactSecrets = [];
213
226
  for (const unsub of cleanups) unsub();
214
227
  cleanups = [];
215
228
  }
@@ -1526,13 +1539,11 @@ var MODELS = [
1526
1539
  maxThinkingLevel: "high"
1527
1540
  },
1528
1541
  // ── OpenAI (Codex) ─────────────────────────────────────
1529
- // GPT-5.6 family — three agentic coding tiers launched July 2026. All share a
1530
- // 372K context window: the Codex repo's models.json lists both `context_window`
1531
- // AND `max_context_window` as 372000 for every 5.6 variant, so (unlike 5.4/5.5,
1532
- // whose public-API 1M window exceeds the Codex-product cap) there's no split
1533
- // between the API and Codex-transport windows — a single `contextWindow` is
1534
- // correct in both code paths. All three take text+image input, freeform
1535
- // apply_patch, text+image web search, and parallel tool calls.
1542
+ // GPT-5.6 family — three agentic coding tiers launched July 2026. The public
1543
+ // Responses API advertises a 1.05M context window; OpenAI's Codex product
1544
+ // catalog advertises 372K on the ChatGPT OAuth route. All three take
1545
+ // text+image input, freeform apply_patch, text+image web search, and parallel
1546
+ // tool calls.
1536
1547
  {
1537
1548
  // Sol — "Latest frontier agentic coding model." (priority 1, default low).
1538
1549
  // Reasoning ladder: low → medium → high → xhigh → max → ultra. Ultra is a
@@ -1541,7 +1552,8 @@ var MODELS = [
1541
1552
  id: "gpt-5.6-sol",
1542
1553
  name: "GPT-5.6 Sol",
1543
1554
  provider: "openai",
1544
- contextWindow: 372e3,
1555
+ contextWindow: 105e4,
1556
+ codexContextWindow: 372e3,
1545
1557
  maxOutputTokens: 128e3,
1546
1558
  supportsThinking: true,
1547
1559
  supportsImages: true,
@@ -1551,11 +1563,12 @@ var MODELS = [
1551
1563
  },
1552
1564
  {
1553
1565
  // Terra — "Balanced agentic coding model for everyday work." (priority 2,
1554
- // default medium). Same 372K context + ultra reasoning ladder as Sol.
1566
+ // default medium).
1555
1567
  id: "gpt-5.6-terra",
1556
1568
  name: "GPT-5.6 Terra",
1557
1569
  provider: "openai",
1558
- contextWindow: 372e3,
1570
+ contextWindow: 105e4,
1571
+ codexContextWindow: 372e3,
1559
1572
  maxOutputTokens: 128e3,
1560
1573
  supportsThinking: true,
1561
1574
  supportsImages: true,
@@ -1565,11 +1578,12 @@ var MODELS = [
1565
1578
  },
1566
1579
  {
1567
1580
  // Luna — "Fast and affordable agentic coding model." (priority 3, default
1568
- // medium). Same 372K context; reasoning tops out at `max` (no `ultra` rung).
1581
+ // medium). Reasoning tops out at `max`.
1569
1582
  id: "gpt-5.6-luna",
1570
1583
  name: "GPT-5.6 Luna",
1571
1584
  provider: "openai",
1572
- contextWindow: 372e3,
1585
+ contextWindow: 105e4,
1586
+ codexContextWindow: 372e3,
1573
1587
  maxOutputTokens: 128e3,
1574
1588
  supportsThinking: true,
1575
1589
  supportsImages: true,
@@ -1667,9 +1681,28 @@ var MODELS = [
1667
1681
  maxThinkingLevel: "high"
1668
1682
  },
1669
1683
  // ── Moonshot (Kimi) ────────────────────────────────────
1684
+ // K3 is Kimi's 2.8T-parameter flagship for long-horizon coding, knowledge
1685
+ // work, and deep reasoning. It always reasons at the `max` effort; the public
1686
+ // API uses `reasoning_effort`, while Kimi Code OAuth keeps its managed wire shape.
1687
+ {
1688
+ id: "kimi-k3",
1689
+ name: "Kimi K3",
1690
+ provider: "moonshot",
1691
+ contextWindow: 1048576,
1692
+ // The API can be raised as high as the full context window, but 131K is the
1693
+ // documented default and keeps room for input in AgentSession's fixed cap.
1694
+ maxOutputTokens: 131072,
1695
+ supportsThinking: true,
1696
+ supportsImages: true,
1697
+ supportsVideo: true,
1698
+ maxVideoBytes: 100 * 1024 * 1024,
1699
+ costTier: "high",
1700
+ maxThinkingLevel: "max"
1701
+ },
1702
+ // Retain the cheaper dedicated coding model as an explicit alternative.
1670
1703
  {
1671
1704
  id: "kimi-k2.7-code",
1672
- name: "Kimi K2.7",
1705
+ name: "Kimi K2.7 Code",
1673
1706
  provider: "moonshot",
1674
1707
  contextWindow: 262144,
1675
1708
  maxOutputTokens: 262144,
@@ -1859,7 +1892,7 @@ function getDefaultModel(provider) {
1859
1892
  if (provider === "openai") return MODELS.find((m) => m.id === "gpt-5.6-sol");
1860
1893
  if (provider === "gemini") return MODELS.find((m) => m.id === "gemini-3.1-flash-lite");
1861
1894
  if (provider === "glm") return MODELS.find((m) => m.id === "glm-5.2");
1862
- if (provider === "moonshot") return MODELS.find((m) => m.id === "kimi-k2.7-code");
1895
+ if (provider === "moonshot") return MODELS.find((m) => m.id === "kimi-k3");
1863
1896
  if (provider === "minimax") return MODELS.find((m) => m.id === "MiniMax-M3");
1864
1897
  if (provider === "deepseek") return MODELS.find((m) => m.id === "deepseek-v4-pro");
1865
1898
  if (provider === "openrouter") return MODELS.find((m) => m.id === "qwen/qwen3.6-plus");
@@ -1869,6 +1902,9 @@ function getDefaultModel(provider) {
1869
1902
  function usesOpenAICodexTransport(options) {
1870
1903
  return options?.provider === "openai" && Boolean(options.accountId);
1871
1904
  }
1905
+ function getToolResultCharLimit(_modelId, options) {
1906
+ return usesOpenAICodexTransport(options) ? 1e4 * 4 : void 0;
1907
+ }
1872
1908
  function getContextWindow(modelId, options) {
1873
1909
  const model = getModel(modelId);
1874
1910
  if (!model) return 2e5;
@@ -2616,6 +2652,7 @@ function createAutoUpdater(config) {
2616
2652
  getSessionId,
2617
2653
  getSummaryModel,
2618
2654
  getSupportedThinkingLevels,
2655
+ getToolResultCharLimit,
2619
2656
  getVideoByteLimit,
2620
2657
  isKimiCodingEndpoint,
2621
2658
  isLoggerOpen,