@tiny-fish/cli 0.34.1-next.284 → 0.34.1-next.285

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/README.md CHANGED
@@ -57,8 +57,8 @@ interactive walkthrough with one command:
57
57
  npx -y @tiny-fish/cli@latest connect codex --launch --api-key sk-tinyfish-...
58
58
  ```
59
59
 
60
- One-command OAuth requires a Codex release whose `codex mcp add` command supports
61
- `--oauth-resource`. Update Codex if support is unavailable, or add TinyFish manually with
60
+ One-command OAuth requires a Codex release whose `codex mcp add` command supports `--url`, plus
61
+ `codex mcp login`. Update Codex if support is unavailable, or add TinyFish manually with
62
62
  `codex mcp add`.
63
63
 
64
64
  With `--api-key`, Codex reads the key from `TINYFISH_API_KEY` instead of signing in — the command
@@ -75,11 +75,10 @@ function refuseKeylessInstall(client, keyAuthSupported) {
75
75
  `Run: tinyfish auth login, then ${rerun}`, 'invalid_config', { failureDetail: 'keyless_install_refused' });
76
76
  }
77
77
  /** Resolved before the removals, so a refusal strands no registration. */
78
- function keylessAddArgs(client, keyAuthSupported, oauthResource) {
78
+ function keylessAddArgs(client, keyAuthSupported) {
79
79
  if (!client.addArgs)
80
80
  refuseKeylessInstall(client, keyAuthSupported);
81
- const addArgs = client.addArgs;
82
- return (mcpUrl) => addArgs(mcpUrl, oauthResource);
81
+ return client.addArgs;
83
82
  }
84
83
  /** Runs before any write: a refused key strands nothing. */
85
84
  async function verifyKeyBeforeSeeding(apiKey, displayName, mcpUrl) {
@@ -157,7 +156,7 @@ async function prepareInstallAuth(client, options, keyAuthSupported) {
157
156
  // Refuses here when key-required; others keep their OAuth argv.
158
157
  const buildAddArgs = keyedAdd
159
158
  ? (mcpUrl) => keyedAdd.spec.addArgs(mcpUrl, keyedAdd.key)
160
- : keylessAddArgs(client, keyAuthSupported, options.mcpUrl);
159
+ : keylessAddArgs(client, keyAuthSupported);
161
160
  if (options.keyAuthOnly && !keyedAdd) {
162
161
  // All native clients have keyAuth; missing flags mean an old install.
163
162
  if (client.keyAuth) {
@@ -217,7 +217,9 @@ function repairsFor(checks, statuses) {
217
217
  for (const status of statuses) {
218
218
  // `unknown` earns nothing: connect would contradict the check's detail.
219
219
  // A registered entry that still fails earns one too.
220
- const brokenRegistration = checks.some((c) => c.harness === status.harness && c.status === 'fail');
220
+ // `connected: false` is the harness's own no; it only warns, so it earns a repair here.
221
+ const brokenRegistration = status.connected === false ||
222
+ checks.some((c) => c.harness === status.harness && c.status === 'fail');
221
223
  if (!status.detected || (status.registered !== Registered.No && !brokenRegistration))
222
224
  continue;
223
225
  repairs.push({
@@ -78,7 +78,7 @@ interface BaseMcpClient extends SupportedCommand {
78
78
  /** Keyless installs use this argv; the harness signs itself in. */
79
79
  export interface OauthCapableMcpClient extends BaseMcpClient {
80
80
  keyRequired?: false;
81
- addArgs: (mcpUrl: string, oauthResource: string) => string[];
81
+ addArgs: (mcpUrl: string) => string[];
82
82
  }
83
83
  /** No sign-in exists here, so connect refuses a keyless install (Hermes). */
84
84
  export interface KeyRequiredMcpClient extends BaseMcpClient {
@@ -21,10 +21,15 @@ const CLAUDE_CODE_DEFERRED_AUTH_NOTE = 'TinyFish is registered in Claude Code bu
21
21
  'one-command sign-in (`claude mcp login`). Open Claude Code and run `/mcp` to sign in to ' +
22
22
  'TinyFish. `claude update` gets you one-command sign-in. Already have a TinyFish API key? ' +
23
23
  'Run `tinyfish connect claude-code --api-key <key>` instead.';
24
- const CODEX_OAUTH_RESOURCE_UNAVAILABLE_MESSAGE = 'Could not confirm this Codex installation supports one-command MCP authentication: `codex ' +
25
- 'mcp add --help` did not list `--oauth-resource`. Update Codex and retry, or add TinyFish ' +
26
- 'manually with `codex mcp add`.' +
24
+ const CODEX_MCP_URL_UNAVAILABLE_MESSAGE = 'Could not confirm this Codex installation supports remote MCP servers: `codex mcp add ' +
25
+ '--help` did not list `--url`. Update Codex and retry, or add TinyFish manually with ' +
26
+ '`codex mcp add`.' +
27
27
  SUPPORT_CHECK_DEBUG_HINT;
28
+ const CODEX_KEYED_FALLBACK_NOTE = 'Using your stored TinyFish API key: this Codex cannot report whether an OAuth sign-in ' +
29
+ 'finished, so no browser sign-in is attempted.';
30
+ const CODEX_DEFERRED_AUTH_NOTE = 'TinyFish is registered in Codex but not signed in: this Codex predates reliable sign-in ' +
31
+ 'reporting. Run `codex mcp login tinyfish` to sign in, or update Codex with ' +
32
+ '`npm install -g @openai/codex@latest` for one-command sign-in.';
28
33
  const HERMES_OAUTH_UNAVAILABLE_MESSAGE = 'Could not confirm this Hermes installation supports one-command MCP authentication: `hermes ' +
29
34
  'mcp add --help` did not list `--auth oauth`. Update Hermes and retry, or add TinyFish ' +
30
35
  'manually with `hermes mcp add`.' +
@@ -174,21 +179,28 @@ export const CODEX = {
174
179
  displayName: 'Codex',
175
180
  supportCheck: {
176
181
  args: ['mcp', 'add', '--help'],
177
- patterns: [/--oauth-resource(?:\s|<)/],
182
+ patterns: [/--url(?:[\s<=]|$)/m],
183
+ // Codex before ~0.142 reports `o_auth` for a server it never signed in to, so the
184
+ // sign-in probe lies; `--oauth-resource` is the only marker separating the two.
185
+ optionalPatterns: [/--oauth-resource(?:[\s<=]|$)/m],
178
186
  keyAuthPattern: /(?:^|\s)--bearer-token-env-var(?:[\s<=]|$)/m,
179
- unavailableMessage: CODEX_OAUTH_RESOURCE_UNAVAILABLE_MESSAGE,
187
+ unavailableMessage: CODEX_MCP_URL_UNAVAILABLE_MESSAGE,
188
+ },
189
+ degradedAuthNotes: {
190
+ keyed: CODEX_KEYED_FALLBACK_NOTE,
191
+ deferred: CODEX_DEFERRED_AUTH_NOTE,
180
192
  },
181
193
  // Codex has no `--header`; the MCP server takes a key as `Bearer sk-…`.
182
- // Omitting `--oauth-resource` is what keeps `mcp add` from running OAuth.
183
194
  keyAuth: {
184
195
  envVar: TINYFISH_API_KEY_VAR,
185
196
  addArgs: (mcpUrl) => [...urlAddArgs(mcpUrl), '--bearer-token-env-var', TINYFISH_API_KEY_VAR],
186
197
  },
187
198
  detachedLaunch: launchCodexWalkthrough,
188
- // Retry only: running it after a finished inline OAuth is a second browser hop.
189
199
  loginArgs: ['mcp', 'login', 'tinyfish'],
190
200
  removals: [{ args: ['mcp', 'remove', 'tinyfish'], label: 'TinyFish registration from Codex' }],
191
- addArgs: (mcpUrl, oauthResource) => [...urlAddArgs(mcpUrl), '--oauth-resource', oauthResource],
201
+ // `--oauth-resource` duplicates the resource Codex discovers; Clerk rejects both.
202
+ // `mcp add` still runs OAuth inline, so `loginArgs` stays a retry.
203
+ addArgs: urlAddArgs,
192
204
  };
193
205
  const grokAddArgs = (mcpUrl) => [
194
206
  'mcp',
@@ -13,6 +13,12 @@ import { detectInstalledHarnesses, harnessConfigPath, harnessDisplayPath, AuthMo
13
13
  // A list, verified against codex 0.146. A name-keyed map was accepted here too, but every
14
14
  // field is optional, so that arm parsed *any* object-of-objects: a wrapper like
15
15
  // `{"servers": {...}}` decoded as one entry named `servers` and reported TinyFish absent.
16
+ // Codex's wire values, verified against 0.146; anything else stays unknown.
17
+ var CodexAuthStatus;
18
+ (function (CodexAuthStatus) {
19
+ CodexAuthStatus["OAuth"] = "o_auth";
20
+ CodexAuthStatus["NotLoggedIn"] = "not_logged_in";
21
+ })(CodexAuthStatus || (CodexAuthStatus = {}));
16
22
  const codexEntrySchema = z.looseObject({
17
23
  name: z.string().optional(),
18
24
  auth_status: z.string().optional(),
@@ -216,9 +222,9 @@ export function codexOauthCompleted() {
216
222
  if ('reason' in read)
217
223
  return undefined;
218
224
  const status = read.entry?.auth_status;
219
- if (status === 'o_auth')
225
+ if (status === CodexAuthStatus.OAuth)
220
226
  return true;
221
- if (status === 'not_logged_in')
227
+ if (status === CodexAuthStatus.NotLoggedIn)
222
228
  return false;
223
229
  return undefined;
224
230
  }
@@ -255,10 +261,16 @@ function probeCodex() {
255
261
  const codexUrl = entry.transport?.url;
256
262
  // Read from this entry: codex emits `bearer_token_env_var` on every HTTP server, so testing
257
263
  // the whole payload reports api-key for TinyFish because some other server carries a key.
258
- const envVar = entry.auth_status === 'o_auth' ? undefined : entry.transport?.bearer_token_env_var;
264
+ const envVar = entry.auth_status === CodexAuthStatus.OAuth ? undefined : entry.transport?.bearer_token_env_var;
259
265
  return {
260
266
  registered: Registered.Yes,
261
- authMode: entry.auth_status === 'o_auth' ? AuthMode.OAuth : envVar ? AuthMode.ApiKey : AuthMode.Unknown,
267
+ authMode: entry.auth_status === CodexAuthStatus.OAuth
268
+ ? AuthMode.OAuth
269
+ : envVar
270
+ ? AuthMode.ApiKey
271
+ : AuthMode.Unknown,
272
+ // Codex's own verdict: a stale `oauth_resource` strands installs here.
273
+ ...(entry.auth_status === CodexAuthStatus.NotLoggedIn && !envVar ? { connected: false } : {}),
262
274
  ...(codexUrl ? { registeredUrl: codexUrl } : {}),
263
275
  ...(envVar ? envKeyVerdict(envVar) : {}),
264
276
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiny-fish/cli",
3
- "version": "0.34.1-next.284",
3
+ "version": "0.34.1-next.285",
4
4
  "description": "TinyFish CLI — run web automations from your terminal",
5
5
  "type": "module",
6
6
  "bin": {