@glbgpt/cli 0.1.0-test.4 → 0.1.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 (143) hide show
  1. package/README.md +79 -6
  2. package/dist/src/auth/authClient.d.ts +21 -2
  3. package/dist/src/auth/authClient.js +67 -3
  4. package/dist/src/auth/authClient.js.map +1 -1
  5. package/dist/src/auth/loginFlow.js +5 -2
  6. package/dist/src/auth/loginFlow.js.map +1 -1
  7. package/dist/src/auth/loopbackServer.d.ts +2 -1
  8. package/dist/src/auth/loopbackServer.js +6 -3
  9. package/dist/src/auth/loopbackServer.js.map +1 -1
  10. package/dist/src/commands/accountCommand.js +10 -4
  11. package/dist/src/commands/accountCommand.js.map +1 -1
  12. package/dist/src/commands/configCommand.d.ts +5 -0
  13. package/dist/src/commands/configCommand.js +15 -2
  14. package/dist/src/commands/configCommand.js.map +1 -1
  15. package/dist/src/commands/execCommand.d.ts +6 -0
  16. package/dist/src/commands/execCommand.js +61 -9
  17. package/dist/src/commands/execCommand.js.map +1 -1
  18. package/dist/src/commands/loginCommand.js +9 -6
  19. package/dist/src/commands/loginCommand.js.map +1 -1
  20. package/dist/src/commands/mediaCommand.js +3 -2
  21. package/dist/src/commands/mediaCommand.js.map +1 -1
  22. package/dist/src/commands/skillCommand.d.ts +30 -0
  23. package/dist/src/commands/skillCommand.js +160 -0
  24. package/dist/src/commands/skillCommand.js.map +1 -0
  25. package/dist/src/config/configFile.d.ts +12 -0
  26. package/dist/src/config/configFile.js +12 -0
  27. package/dist/src/config/configFile.js.map +1 -1
  28. package/dist/src/config/env.d.ts +18 -0
  29. package/dist/src/config/env.js +57 -7
  30. package/dist/src/config/env.js.map +1 -1
  31. package/dist/src/core/catalog.d.ts +8 -1
  32. package/dist/src/core/catalog.js +13 -2
  33. package/dist/src/core/catalog.js.map +1 -1
  34. package/dist/src/core/contextPrune.d.ts +13 -0
  35. package/dist/src/core/contextPrune.js +61 -0
  36. package/dist/src/core/contextPrune.js.map +1 -0
  37. package/dist/src/core/httpChatBackend.js +22 -5
  38. package/dist/src/core/httpChatBackend.js.map +1 -1
  39. package/dist/src/core/runChat.d.ts +9 -5
  40. package/dist/src/core/runChat.js +10 -7
  41. package/dist/src/core/runChat.js.map +1 -1
  42. package/dist/src/core/session.d.ts +15 -0
  43. package/dist/src/core/session.js +29 -1
  44. package/dist/src/core/session.js.map +1 -1
  45. package/dist/src/core/toolRegistry.d.ts +14 -3
  46. package/dist/src/core/toolRegistry.js +24 -15
  47. package/dist/src/core/toolRegistry.js.map +1 -1
  48. package/dist/src/core/turnLoop.d.ts +4 -0
  49. package/dist/src/core/turnLoop.js +62 -13
  50. package/dist/src/core/turnLoop.js.map +1 -1
  51. package/dist/src/core/types.d.ts +6 -0
  52. package/dist/src/core/updateCheck.d.ts +46 -0
  53. package/dist/src/core/updateCheck.js +139 -0
  54. package/dist/src/core/updateCheck.js.map +1 -0
  55. package/dist/src/exec/media.d.ts +32 -0
  56. package/dist/src/exec/media.js +70 -0
  57. package/dist/src/exec/media.js.map +1 -0
  58. package/dist/src/exec/output.d.ts +16 -0
  59. package/dist/src/exec/output.js +41 -0
  60. package/dist/src/exec/output.js.map +1 -1
  61. package/dist/src/fs/globTool.d.ts +8 -0
  62. package/dist/src/fs/globTool.js +117 -0
  63. package/dist/src/fs/globTool.js.map +1 -0
  64. package/dist/src/fs/grepTool.d.ts +4 -0
  65. package/dist/src/fs/grepTool.js +146 -0
  66. package/dist/src/fs/grepTool.js.map +1 -0
  67. package/dist/src/fs/index.d.ts +8 -0
  68. package/dist/src/fs/index.js +13 -0
  69. package/dist/src/fs/index.js.map +1 -0
  70. package/dist/src/fs/limits.d.ts +34 -0
  71. package/dist/src/fs/limits.js +74 -0
  72. package/dist/src/fs/limits.js.map +1 -0
  73. package/dist/src/fs/listDirTool.d.ts +2 -0
  74. package/dist/src/fs/listDirTool.js +68 -0
  75. package/dist/src/fs/listDirTool.js.map +1 -0
  76. package/dist/src/fs/readFileTool.d.ts +2 -0
  77. package/dist/src/fs/readFileTool.js +102 -0
  78. package/dist/src/fs/readFileTool.js.map +1 -0
  79. package/dist/src/fs/walk.d.ts +11 -0
  80. package/dist/src/fs/walk.js +38 -0
  81. package/dist/src/fs/walk.js.map +1 -0
  82. package/dist/src/fs/workspaceGuard.d.ts +27 -0
  83. package/dist/src/fs/workspaceGuard.js +96 -0
  84. package/dist/src/fs/workspaceGuard.js.map +1 -0
  85. package/dist/src/index.js +47 -3
  86. package/dist/src/index.js.map +1 -1
  87. package/dist/src/mcp/mediaTools.d.ts +63 -0
  88. package/dist/src/mcp/mediaTools.js +385 -0
  89. package/dist/src/mcp/mediaTools.js.map +1 -0
  90. package/dist/src/mcp/server.d.ts +6 -2
  91. package/dist/src/mcp/server.js +19 -9
  92. package/dist/src/mcp/server.js.map +1 -1
  93. package/dist/src/media/aiApiClient.d.ts +5 -0
  94. package/dist/src/media/aiApiClient.js +12 -1
  95. package/dist/src/media/aiApiClient.js.map +1 -1
  96. package/dist/src/media/budget.d.ts +42 -0
  97. package/dist/src/media/budget.js +95 -0
  98. package/dist/src/media/budget.js.map +1 -0
  99. package/dist/src/media/executor.d.ts +9 -0
  100. package/dist/src/media/executor.js +1 -1
  101. package/dist/src/media/executor.js.map +1 -1
  102. package/dist/src/media/generateImageTool.d.ts +20 -2
  103. package/dist/src/media/generateImageTool.js +102 -2
  104. package/dist/src/media/generateImageTool.js.map +1 -1
  105. package/dist/src/media/promptSanitizer.d.ts +11 -0
  106. package/dist/src/media/promptSanitizer.js +33 -0
  107. package/dist/src/media/promptSanitizer.js.map +1 -0
  108. package/dist/src/media/taskManager.d.ts +8 -1
  109. package/dist/src/media/taskManager.js +1 -1
  110. package/dist/src/media/taskManager.js.map +1 -1
  111. package/dist/src/tui/App.js +38 -8
  112. package/dist/src/tui/App.js.map +1 -1
  113. package/dist/src/tui/ParamEditor.d.ts +11 -2
  114. package/dist/src/tui/ParamEditor.js +48 -3
  115. package/dist/src/tui/ParamEditor.js.map +1 -1
  116. package/dist/src/tui/atPopup.d.ts +8 -0
  117. package/dist/src/tui/atPopup.js +1 -1
  118. package/dist/src/tui/atPopup.js.map +1 -1
  119. package/dist/src/tui/attachments.d.ts +12 -0
  120. package/dist/src/tui/attachments.js +12 -1
  121. package/dist/src/tui/attachments.js.map +1 -1
  122. package/dist/src/tui/chatController.d.ts +73 -2
  123. package/dist/src/tui/chatController.js +272 -43
  124. package/dist/src/tui/chatController.js.map +1 -1
  125. package/dist/src/tui/models.d.ts +6 -0
  126. package/dist/src/tui/models.js +14 -6
  127. package/dist/src/tui/models.js.map +1 -1
  128. package/dist/src/tui/run.js +55 -16
  129. package/dist/src/tui/run.js.map +1 -1
  130. package/dist/src/util/brokenPipe.d.ts +10 -0
  131. package/dist/src/util/brokenPipe.js +19 -0
  132. package/dist/src/util/brokenPipe.js.map +1 -0
  133. package/package.json +3 -2
  134. package/skills/globalgpt/SKILL.md +94 -0
  135. package/skills/globalgpt/references/troubleshooting.md +34 -0
  136. package/skills/globalgpt-coding/SKILL.md +65 -0
  137. package/skills/globalgpt-coding/references/troubleshooting.md +34 -0
  138. package/skills/globalgpt-image/SKILL.md +109 -0
  139. package/skills/globalgpt-image/references/recipes.md +52 -0
  140. package/skills/globalgpt-image/references/troubleshooting.md +49 -0
  141. package/skills/globalgpt-video/SKILL.md +109 -0
  142. package/skills/globalgpt-video/references/recipes.md +50 -0
  143. package/skills/globalgpt-video/references/troubleshooting.md +49 -0
@@ -10,6 +10,8 @@
10
10
  export interface ModelInfo {
11
11
  id: string;
12
12
  label: string;
13
+ /** Catalog tool_use capability: model may be offered gated (fs) tools. Absent = false. */
14
+ toolUse?: boolean;
13
15
  }
14
16
  /** Baked-in fallback (offline / no token / first run before the catalog cache exists). */
15
17
  export declare const CHAT_MODELS: ModelInfo[];
@@ -22,12 +24,16 @@ export declare function getChatModels(): ModelInfo[];
22
24
  export declare function getDefaultChatModel(): string;
23
25
  /** Test hook: restore the baked-in list. */
24
26
  export declare function resetChatCatalog(): void;
27
+ /** Whether the catalog marks this model as tool-capable (absent/unknown id → false). */
28
+ export declare function modelSupportsTools(id: string): boolean;
25
29
  /**
26
30
  * Display string for a chat model: the id (name) is ALWAYS shown, with the description as a
27
31
  * suffix when present. Server labels are plain descriptions ("balanced reasoning"); the
28
32
  * baked-in fallback labels already carry an "id — " prefix — strip it so we never double the id.
29
33
  */
30
34
  export declare function modelDisplay(m: ModelInfo): string;
35
+ /** The bare description for a chat model (label with any leading "id — " prefix stripped). */
36
+ export declare function modelDescription(m: ModelInfo): string;
31
37
  /**
32
38
  * Resolve a chat model id, erroring with close candidates on a typo (no silent fuzzy match).
33
39
  * Mirrors the media manifest's resolveModel UX. The backend whitelist is authoritative;
@@ -2,9 +2,9 @@
2
2
  export const CHAT_MODELS = [
3
3
  // All three verified end to end on 2026-07-15: backend whitelist (application-newtest.yml),
4
4
  // robot pricing rows (703-705), live reply + billing row each.
5
- { id: 'gpt-5.6-sol', label: 'gpt-5.6-sol — balanced reasoning' },
6
- { id: 'gpt-5.6-luna', label: 'gpt-5.6-luna — fastest, cheapest' },
7
- { id: 'gpt-5.6-terra', label: 'gpt-5.6-terra — mid-tier' },
5
+ { id: 'gpt-5.6-sol', label: 'gpt-5.6-sol — balanced reasoning', toolUse: true },
6
+ { id: 'gpt-5.6-luna', label: 'gpt-5.6-luna — fastest, cheapest', toolUse: true },
7
+ { id: 'gpt-5.6-terra', label: 'gpt-5.6-terra — mid-tier', toolUse: true },
8
8
  ];
9
9
  export const DEFAULT_CHAT_MODEL = 'gpt-5.6-sol';
10
10
  // Server-driven state (applied by src/core/catalog.ts; module-level so every consumer —
@@ -15,7 +15,7 @@ let currentDefault = DEFAULT_CHAT_MODEL;
15
15
  export function applyChatCatalog(models, defaultId) {
16
16
  if (models.length === 0)
17
17
  return; // never apply an empty list — keep the fallback
18
- currentModels = models.map((m) => ({ id: m.id, label: m.label || m.id }));
18
+ currentModels = models.map((m) => ({ id: m.id, label: m.label || m.id, toolUse: m.toolUse === true }));
19
19
  currentDefault = currentModels.some((m) => m.id === defaultId) ? defaultId : currentModels[0].id;
20
20
  }
21
21
  /** The chat models currently in effect (server-driven when available, else baked-in). */
@@ -31,16 +31,24 @@ export function resetChatCatalog() {
31
31
  currentModels = CHAT_MODELS;
32
32
  currentDefault = DEFAULT_CHAT_MODEL;
33
33
  }
34
+ /** Whether the catalog marks this model as tool-capable (absent/unknown id → false). */
35
+ export function modelSupportsTools(id) {
36
+ return currentModels.find((m) => m.id === id)?.toolUse === true;
37
+ }
34
38
  /**
35
39
  * Display string for a chat model: the id (name) is ALWAYS shown, with the description as a
36
40
  * suffix when present. Server labels are plain descriptions ("balanced reasoning"); the
37
41
  * baked-in fallback labels already carry an "id — " prefix — strip it so we never double the id.
38
42
  */
39
43
  export function modelDisplay(m) {
40
- const raw = m.label && m.label !== m.id ? m.label : '';
41
- const desc = raw.startsWith(m.id) ? raw.slice(m.id.length).replace(/^\s*[—-]\s*/, '') : raw;
44
+ const desc = modelDescription(m);
42
45
  return desc ? `${m.id} — ${desc}` : m.id;
43
46
  }
47
+ /** The bare description for a chat model (label with any leading "id — " prefix stripped). */
48
+ export function modelDescription(m) {
49
+ const raw = m.label && m.label !== m.id ? m.label : '';
50
+ return raw.startsWith(m.id) ? raw.slice(m.id.length).replace(/^\s*[—-]\s*/, '') : raw;
51
+ }
44
52
  /**
45
53
  * Resolve a chat model id, erroring with close candidates on a typo (no silent fuzzy match).
46
54
  * Mirrors the media manifest's resolveModel UX. The backend whitelist is authoritative;
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/tui/models.ts"],"names":[],"mappings":"AAcA,0FAA0F;AAC1F,MAAM,CAAC,MAAM,WAAW,GAAgB;IACtC,4FAA4F;IAC5F,+DAA+D;IAC/D,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,kCAAkC,EAAE;IAChE,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,kCAAkC,EAAE;IAC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AG,CAAC;AACxF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAU;IACzC,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC3C,IAAI,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;QAAE,OAAO,EAAE,CAAC;IAChC,mGAAmG;IACnG,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,CAC3B,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,eAAe,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,CAC/E,CAAC;IACF,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,kBAAkB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,eAAe,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;IAC/G,MAAM,IAAI,KAAK,CAAC,uBAAuB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,eAAe,CAAC,CAAS,EAAE,CAAS;IAC3C,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAAE,CAAC,IAAI,CAAC,CAAC;IAC7D,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -3,7 +3,7 @@ import { render } from 'ink';
3
3
  import { App } from './App.js';
4
4
  import { sessionsDir } from '../config/paths.js';
5
5
  import { ChatController } from './chatController.js';
6
- import { AuthClient } from '../auth/authClient.js';
6
+ import { AuthClient, describeCredits } from '../auth/authClient.js';
7
7
  import { getDefaultChatModel } from './models.js';
8
8
  import { Session } from '../core/session.js';
9
9
  import { newId } from '../core/id.js';
@@ -18,13 +18,16 @@ import { GenerationExecutor } from '../media/executor.js';
18
18
  import { TaskManager } from '../media/taskManager.js';
19
19
  import { TaskLedger } from '../media/taskLedger.js';
20
20
  import { ConfirmationBridge, TuiConfirmer } from './confirmationBridge.js';
21
+ import { maybeCheckForUpdate } from '../core/updateCheck.js';
22
+ import { VERSION } from '../version.js';
21
23
  import { createInputHistory } from './inputHistory.js';
22
24
  import { resolveToken } from '../auth/token.js';
23
25
  import { CredentialStore } from '../auth/credentialStore.js';
24
26
  import { browserLogin } from '../auth/loginFlow.js';
25
27
  import { openBrowser } from '../util/openBrowser.js';
26
- import { apiBaseUrl, webBaseUrl, lang } from '../config/env.js';
28
+ import { apiBaseUrl, webBaseUrl, lang, apiBaseUrlOverride, baseUrlOverrideWarnings } from '../config/env.js';
27
29
  import { ensureCatalog } from '../core/catalog.js';
30
+ import { createFsTools, workspaceRoot } from '../fs/index.js';
28
31
  import path from 'node:path';
29
32
  /**
30
33
  * Wire the chat engine to the Ink TUI and render it.
@@ -60,14 +63,24 @@ export async function runTui(options = {}) {
60
63
  const confirmationBridge = new ConfirmationBridge();
61
64
  let taskManager;
62
65
  const registry = new ToolRegistry();
66
+ // fs read tools: available to every session (no token needed — they run locally),
67
+ // but only OFFERED to models the catalog marks tool_use (gated registration).
68
+ const wsRoot = await workspaceRoot();
69
+ for (const t of createFsTools(wsRoot))
70
+ registry.register(t, { gated: true });
63
71
  const extras = {};
72
+ let controllerRef; // assigned after construction; tools resolve refs lazily
64
73
  if (!options.imageTool && token) {
65
74
  mediaClient = new AiApiClient({ baseUrl: apiBaseUrl(), token });
66
75
  const executor = new GenerationExecutor(mediaClient, new TuiConfirmer(confirmationBridge));
67
76
  taskManager = new TaskManager(mediaClient, { outputDir: path.join(process.cwd(), 'glbgpt-output') });
68
77
  const ledger = new TaskLedger();
69
- const imageTool = createGenerateImageTool({ executor, taskManager, ledger });
70
- const videoTool = createGenerateVideoTool({ executor, taskManager, ledger });
78
+ // The tools are built before the controller, so reference resolution reads it lazily.
79
+ const resolveReference = (ref) => controllerRef?.resolveMediaReference(ref);
80
+ const pendingReferences = () => controllerRef?.getPendingReferenceImages() ?? [];
81
+ const knownMediaRefs = () => controllerRef?.getKnownMediaRefs() ?? [];
82
+ const imageTool = createGenerateImageTool({ executor, taskManager, ledger, resolveReference, pendingReferences, knownMediaRefs });
83
+ const videoTool = createGenerateVideoTool({ executor, taskManager, ledger, resolveReference, pendingReferences, knownMediaRefs });
71
84
  registry.register(imageTool);
72
85
  registry.register(videoTool);
73
86
  // Slash commands run the same tool instances the model uses (same confirm/ledger/polling path).
@@ -75,26 +88,28 @@ export async function runTui(options = {}) {
75
88
  extras.listRecentTasks = () => ledger.list(10);
76
89
  extras.fetchAccountLine = async () => {
77
90
  const info = await new AuthClient({ baseUrl: apiBaseUrl() }).userInfo(currentToken);
78
- const bits = [info.plan && `plan: ${info.plan}`, info.balance !== undefined && `balance: ${info.balance}`];
91
+ const bits = [info.plan && `plan: ${info.plan}`, describeCredits(info) && `balance: ${describeCredits(info)}`];
79
92
  return bits.filter(Boolean).join(' · ') || null;
80
93
  };
81
94
  extras.fetchAccount = async () => {
82
95
  const info = await new AuthClient({ baseUrl: apiBaseUrl() }).userInfo(currentToken);
83
96
  const lines = [`account: ${info.email ?? '(unknown)'}`];
84
97
  if (info.plan)
85
- lines.push(`plan: ${info.plan}`);
86
- if (info.balance !== undefined)
87
- lines.push(`balance: ${info.balance} credits`);
98
+ lines.push(`plan: ${info.plan}${info.planEndDate ? ` (through ${info.planEndDate})` : ''}`);
99
+ const balance = describeCredits(info);
100
+ if (balance)
101
+ lines.push(`balance: ${balance}`);
102
+ if (info.totalCredits !== undefined && info.totalCredits <= 0) {
103
+ lines.push(info.plan
104
+ ? 'Top up at glbgpt.com if you need credits before they reset.'
105
+ : 'Top up or subscribe at glbgpt.com to start generating.');
106
+ }
88
107
  return lines.join('\n');
89
108
  };
90
109
  extras.fetchTransactions = async () => {
91
110
  const bills = await new AuthClient({ baseUrl: apiBaseUrl() }).bills(currentToken, 1, 10);
92
- if (bills.length === 0)
93
- return 'No transactions yet.';
94
111
  // cost is USD; show credits (1 credit ≈ $0.001) to match the generation estimates.
95
- return bills
96
- .map((b) => `${(b.createdAt ?? '').padEnd(20)} ${String(Math.round(b.cost * 1000)).padStart(6)} cr ${b.model}`)
97
- .join('\n');
112
+ return bills.map((b) => ({ createdAt: b.createdAt ?? '', credits: Math.round(b.cost * 1000), model: b.model }));
98
113
  };
99
114
  }
100
115
  else {
@@ -112,9 +127,13 @@ export async function runTui(options = {}) {
112
127
  credentialStore: cs,
113
128
  // No concurrent paste inside the TUI (Ink owns stdin) — the loopback path only. A remote
114
129
  // TUI user should exit and run `glbgpt login --code`; we surface that URL too.
115
- openUrl: ({ loopbackUrl, codeUrl }) => {
116
- controller.note(`Open this URL to authorize (only if you started this login yourself):\n ${loopbackUrl}\n` +
117
- `On a remote machine? Exit and run \`glbgpt login --code\`, or authorize at:\n ${codeUrl}`);
130
+ openUrl: ({ loopbackUrl }) => {
131
+ // no-browser mode never launches anything, so the URL is the primary path
132
+ // there — "if it didn't open" would be nonsense.
133
+ const lead = mode === 'browser'
134
+ ? `Authorize in the browser (only if you started this login yourself).\nIf it didn't open, visit:`
135
+ : `Open this URL in a browser to authorize (only if you started this login yourself):`;
136
+ controller.note(`${lead}\n ${loopbackUrl}\n(On a remote machine? Exit and run \`glbgpt login --code\`.)`);
118
137
  if (mode === 'browser')
119
138
  openBrowser(loopbackUrl);
120
139
  },
@@ -138,6 +157,20 @@ export async function runTui(options = {}) {
138
157
  };
139
158
  const turnLoop = new TurnLoop(backend, registry);
140
159
  const controller = new ChatController(session, turnLoop, extras);
160
+ controllerRef = controller;
161
+ extras.baseUrlOverride = apiBaseUrlOverride;
162
+ // Advise-only update check: cache-only for this start (never blocks; the
163
+ // background refresh lands by the next one). Failures stay silent.
164
+ let updateNotice = null;
165
+ extras.updateNotice = () => updateNotice;
166
+ void maybeCheckForUpdate()
167
+ .then((notice) => {
168
+ if (notice) {
169
+ updateNotice = notice;
170
+ controller.note(`Update available: ${VERSION} → ${notice.latest} — run ${notice.command}`);
171
+ }
172
+ })
173
+ .catch(() => { });
141
174
  const store = new SessionStore(sessionsDir());
142
175
  if (taskManager) {
143
176
  taskManager.subscribe((e) => {
@@ -156,6 +189,12 @@ export async function runTui(options = {}) {
156
189
  // Resuming: show the prior conversation in the timeline.
157
190
  controller.hydrateFromSession(options.timeline);
158
191
  }
192
+ // Non-default base URLs are surfaced loudly (Codex-style): ordinary users never change
193
+ // them, so an override is either us testing or someone redirecting the CLI's traffic.
194
+ // MUST come after hydrateFromSession — hydrating REPLACES the timeline, and the resume
195
+ // path silently swallowing this warning is exactly the failure it exists to prevent.
196
+ for (const warning of baseUrlOverrideWarnings())
197
+ controller.warn(warning);
159
198
  // Persist the current session after each turn so `resume` has data (/new swaps to a new session).
160
199
  let wasBusy = false;
161
200
  controller.subscribe((state) => {
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/tui/run.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAyB,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AA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AAE,OAAO,IAAI,CAAC;QACvB,OAAO,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzC,CAAC;IACD,IAAI,CAAC;QACH,OAAO,MAAM,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * EPIPE guard for the process output streams.
3
+ *
4
+ * `glbgpt exec ... | head` closes stdout as soon as head has enough lines; every
5
+ * later write raises EPIPE as a stream 'error' event, which without a listener
6
+ * crashes the process with an unhandled-error stack (observed in the 2026-07-19
7
+ * live smoke). Unix convention: a closed downstream pipe ends the program
8
+ * quietly and successfully. Any other stream error stays loud.
9
+ */
10
+ export declare function guardBrokenPipe(stream: NodeJS.WriteStream, exit?: (code: number) => never): void;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * EPIPE guard for the process output streams.
3
+ *
4
+ * `glbgpt exec ... | head` closes stdout as soon as head has enough lines; every
5
+ * later write raises EPIPE as a stream 'error' event, which without a listener
6
+ * crashes the process with an unhandled-error stack (observed in the 2026-07-19
7
+ * live smoke). Unix convention: a closed downstream pipe ends the program
8
+ * quietly and successfully. Any other stream error stays loud.
9
+ */
10
+ export function guardBrokenPipe(stream, exit = process.exit) {
11
+ stream.on('error', (err) => {
12
+ if (err.code === 'EPIPE') {
13
+ exit(0);
14
+ return; // reached only in tests, where `exit` is a spy that returns
15
+ }
16
+ throw err;
17
+ });
18
+ }
19
+ //# sourceMappingURL=brokenPipe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brokenPipe.js","sourceRoot":"","sources":["../../../src/util/brokenPipe.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,MAA0B,EAC1B,OAAgC,OAAO,CAAC,IAAI;IAE5C,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAA0B,EAAE,EAAE;QAChD,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YACzB,IAAI,CAAC,CAAC,CAAC,CAAC;YACR,OAAO,CAAC,4DAA4D;QACtE,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glbgpt/cli",
3
- "version": "0.1.0-test.4",
3
+ "version": "0.1.0",
4
4
  "description": "GlobalGPT in your terminal — chat, image and video generation, and an exec entry point for scripts and agents.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,6 +9,7 @@
9
9
  },
10
10
  "files": [
11
11
  "dist/src/",
12
+ "skills/",
12
13
  "README.md"
13
14
  ],
14
15
  "engines": {
@@ -42,4 +43,4 @@
42
43
  "typescript": "^5.6.0",
43
44
  "vitest": "^2.1.0"
44
45
  }
45
- }
46
+ }
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: globalgpt
3
+ description: >
4
+ The all-in-one entry to the user's GlobalGPT account via the glbgpt CLI: generate
5
+ images and videos, delegate code or text work to GlobalGPT chat models, and check
6
+ the account — balance, billing, models, and generation tasks. Use when the user
7
+ mentions GlobalGPT or glbgpt itself (their balance, spend, account, a past
8
+ generation task, or "what can GlobalGPT do"), or invokes /globalgpt. When the user
9
+ asks for a specific job in natural conversation — an image, a video, delegated
10
+ code — prefer the specialized skills instead: globalgpt-image, globalgpt-video,
11
+ globalgpt-coding.
12
+ ---
13
+
14
+ # GlobalGPT
15
+
16
+ The one entry point to everything on the user's GlobalGPT account. Invoked bare,
17
+ show what is available and the balance; invoked with a request, just do it using
18
+ the commands below.
19
+
20
+ <!-- shared:banner -->
21
+ > **Generation spends real credits.** Price a job without running it using
22
+ > `--estimate`; show the balance with `glbgpt account`.
23
+ <!-- /shared:banner -->
24
+
25
+ ## Before the first call
26
+
27
+ <!-- shared:setup -->
28
+ Run `glbgpt whoami`. If the command is not found, tell the user to install it with
29
+ `npm i -g @glbgpt/cli`. If it reports that nobody is signed in, ask the user to
30
+ run `glbgpt login` themselves — it opens a browser. Never try to authenticate for
31
+ them.
32
+ <!-- /shared:setup -->
33
+
34
+ ## When invoked bare
35
+
36
+ Run `glbgpt account` and present a short menu:
37
+
38
+ 1. **Images** — describe one and I'll generate it (`/globalgpt-image` for the full
39
+ workflow: model menu, recipes, editing).
40
+ 2. **Video** — same, minutes-long (`/globalgpt-video` for start/end frames and recipes).
41
+ 3. **Delegate code or text** to a GlobalGPT chat model (`/globalgpt-coding` for the
42
+ full flow).
43
+ 4. **Account** — balance, recent spend, past generation tasks, available models.
44
+
45
+ Then do whatever the user picks, right here, with the commands below.
46
+
47
+ ## Generate
48
+
49
+ ```bash
50
+ glbgpt image "a red fox in falling snow, cinematic lighting" # blocks until saved
51
+ glbgpt video "slow waves on a beach at sunset" --ar 16:9 # minutes; also blocks
52
+ glbgpt image "a red fox in snow" --estimate # price only
53
+ ```
54
+
55
+ Files land in `./glbgpt-output/`. Reference images go in `-i ./ref.png`
56
+ (image-to-image) or `--start-image` / `--end-image` (video) — never pasted into the
57
+ prompt text. When the user says what to make, generate with the default model —
58
+ do NOT show a model menu first; offer `glbgpt model list image|video` only when
59
+ they ask to choose. The money rules: never retry a failed generation
60
+ automatically, ask before generating more than two or three items, and never
61
+ describe a result you have not seen.
62
+
63
+ ## Delegate to a chat model
64
+
65
+ ```bash
66
+ glbgpt model list chat # pick one first
67
+ glbgpt exec "add JSDoc to every exported function" --file src/util.ts -m <model>
68
+ ```
69
+
70
+ The prompt must come before `--file`. Each call is a fresh, stateless turn.
71
+ Everything the delegate reads is sent to GlobalGPT's backend — no secrets. Review
72
+ the output yourself before applying it anywhere.
73
+
74
+ ## Account and tasks
75
+
76
+ All read-only and free:
77
+
78
+ ```bash
79
+ glbgpt account # membership + credit balance
80
+ glbgpt account transactions # recent spend (authoritative billing)
81
+ glbgpt task list # recent generation tasks
82
+ glbgpt task show last # one task's status
83
+ glbgpt task download last # fetch a finished result
84
+ glbgpt model list # everything available on this account
85
+ ```
86
+
87
+ ## When something fails
88
+
89
+ Read the error — the CLI says what went wrong (not signed in, not enough credits, a
90
+ parameter the model rejects). A genuine generation failure is not charged. Never
91
+ retry blindly; report and let the user decide. Common cases:
92
+ [references/troubleshooting.md](references/troubleshooting.md). For deeper
93
+ workflows, hand over to the specialized skill: `/globalgpt-image`,
94
+ `/globalgpt-video`, `/globalgpt-coding`.
@@ -0,0 +1,34 @@
1
+ # Troubleshooting
2
+
3
+ <!-- shared:login -->
4
+ ## "Not signed in"
5
+
6
+ The user must run `glbgpt login` themselves — it opens a browser. On a headless box
7
+ or over SSH, `glbgpt login --code` prints a URL instead: the user opens it on any
8
+ machine with a browser, authorizes there, and pastes the code the page shows back
9
+ into the terminal. Do not
10
+ attempt to authenticate for them.
11
+ <!-- /shared:login -->
12
+
13
+ ## Not enough credits, or a plan restriction
14
+
15
+ The command reports a payment problem instead of generating. Show the user
16
+ `glbgpt account` (balance and membership) and stop — do not retry, and do not try a
17
+ different model hoping it is cheaper unless the user asks.
18
+
19
+ ## "Unknown model"
20
+
21
+ The catalog is server-driven. Run `glbgpt model list` (optionally `chat`, `image`,
22
+ or `video`) and use a name it prints.
23
+
24
+ ## A generation failed or seems stuck
25
+
26
+ A genuine failure is not charged — the CLI says so when it reports one. A video
27
+ that seems to hang is usually still generating (minutes are normal); if the process
28
+ was interrupted, `glbgpt task list` finds the task and `glbgpt task download <id>`
29
+ fetches the result once ready. Never retry automatically.
30
+
31
+ ## Anything deeper
32
+
33
+ Hand over to the specialized skill: `/globalgpt-image`, `/globalgpt-video`, or
34
+ `/globalgpt-coding` — each carries its own detailed troubleshooting.
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: globalgpt-coding
3
+ description: >
4
+ Delegates code-writing subtasks to a GlobalGPT chat model the user picks, via the
5
+ glbgpt CLI — useful for offloading boilerplate, getting a second model's take, or
6
+ working while other model quotas are tight. Use ONLY when the user invokes
7
+ /globalgpt-coding or explicitly asks to have a GlobalGPT model do the work.
8
+ Never volunteer it: for ordinary coding, debugging, refactoring, or review
9
+ requests, do the work yourself and do not mention this skill. NOT for images or
10
+ videos — use globalgpt-image or globalgpt-video.
11
+ ---
12
+
13
+ # GlobalGPT coding delegation
14
+
15
+ Hand a code-writing subtask to a GlobalGPT chat model of the user's choice. You
16
+ stay the engineer: you frame the task, review what comes back, and apply it to
17
+ files yourself — the delegate only produces text.
18
+
19
+ > **Costs and privacy.** Delegated work bills the user's GlobalGPT account per
20
+ > token, and everything the delegate reads — the prompt, attached files, and any
21
+ > repository files it opens itself — is sent to GlobalGPT's backend. Do not
22
+ > delegate work involving secrets, credentials, or code the user would not send
23
+ > to a third-party service.
24
+
25
+ <!-- shared:setup -->
26
+ Run `glbgpt whoami`. If the command is not found, tell the user to install it with
27
+ `npm i -g @glbgpt/cli`. If it reports that nobody is signed in, ask the user to
28
+ run `glbgpt login` themselves — it opens a browser. Never try to authenticate for
29
+ them.
30
+ <!-- /shared:setup -->
31
+
32
+ ## Flow
33
+
34
+ 1. Run `glbgpt model list chat` and show the models as a menu — use your host's native option picker if it has one, else a numbered list. Let the
35
+ user pick; there is no default here — the choice is the point of this skill.
36
+ 2. Frame ONE well-scoped task. The prompt comes first, then flags:
37
+
38
+ ```bash
39
+ glbgpt exec "add JSDoc comments to every exported function in this file" \
40
+ --file src/utils/date.ts -m <model>
41
+ ```
42
+
43
+ 3. Tool-capable models can also explore the repository themselves — inside
44
+ `glbgpt exec` they have read-only file tools (list, read, glob, grep) jailed
45
+ to the current directory — so for multi-file context you can describe the
46
+ task and let the delegate read what it needs instead of attaching everything.
47
+ 4. Review the returned code yourself, then apply it to files. The delegate never
48
+ writes files; correctness stays your responsibility.
49
+
50
+ ## Footguns
51
+
52
+ - **Each `glbgpt exec` call is a fresh, stateless turn.** Iterating means
53
+ re-sending the context (or re-attaching files) — there is no conversation to
54
+ continue.
55
+ - **The prompt must come before `--file`.** `--file` takes one or more paths and
56
+ swallows everything after it; a prompt placed after it reads as a file path
57
+ and the command fails with "No prompt provided".
58
+ - **Scope one task per call.** "Fix this function" works; "refactor the app"
59
+ produces unreviewable output.
60
+ - Costs scale with what the delegate reads. Attach or point at the files that
61
+ matter, not the whole tree.
62
+
63
+ ## When something fails
64
+
65
+ See [references/troubleshooting.md](references/troubleshooting.md).
@@ -0,0 +1,34 @@
1
+ # Troubleshooting
2
+
3
+ <!-- shared:login -->
4
+ ## "Not signed in"
5
+
6
+ The user must run `glbgpt login` themselves — it opens a browser. On a headless box
7
+ or over SSH, `glbgpt login --code` prints a URL instead: the user opens it on any
8
+ machine with a browser, authorizes there, and pastes the code the page shows back
9
+ into the terminal. Do not
10
+ attempt to authenticate for them.
11
+ <!-- /shared:login -->
12
+
13
+ ## "No prompt provided"
14
+
15
+ `--file` takes one or more paths (`--file <path...>`) and keeps eating positionals
16
+ until it hits a flag, so a prompt written after it is swallowed as another file path.
17
+ Put the prompt first: `glbgpt exec "summarise the decisions" --file notes.md`, not
18
+ `glbgpt exec --file notes.md "summarise the decisions"`.
19
+
20
+ ## Not enough credits, or a plan restriction
21
+
22
+ The command reports a payment problem instead of running the delegation. Show the
23
+ user `glbgpt account` (balance and membership) and stop — do not retry, and do not
24
+ try a different model hoping it is cheaper unless the user asks.
25
+
26
+ ## "Unknown model"
27
+
28
+ The catalog is server-driven and the name you used no longer exists (or never did).
29
+ Run `glbgpt model list chat` and use a name it prints.
30
+
31
+ ## The delegate's code does not compile
32
+
33
+ The delegate cannot run your build. Treat its output as a draft: fix or re-delegate
34
+ with the error text attached (`--file` the build log, prompt first).