co-maintainer 0.6.1 → 0.6.4

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 (99) hide show
  1. package/THIRD_PARTY_NOTICES +161 -0
  2. package/dist/package.json +4 -2
  3. package/dist/src/ai/batch.js +7 -0
  4. package/dist/src/ai/oauth/ids.d.ts +10 -0
  5. package/dist/src/ai/oauth/ids.js +10 -0
  6. package/dist/src/ai/oauth/registry.d.ts +33 -0
  7. package/dist/src/ai/oauth/registry.js +40 -0
  8. package/dist/src/ai/oauth/sign-in-with-chatgpt.d.ts +56 -0
  9. package/dist/src/ai/oauth/sign-in-with-chatgpt.js +552 -0
  10. package/dist/src/ai/openai.d.ts +18 -1
  11. package/dist/src/ai/openai.js +68 -5
  12. package/dist/src/ai/provider.d.ts +3 -0
  13. package/dist/src/ai/provider.js +11 -2
  14. package/dist/src/cli/args.js +61 -21
  15. package/dist/src/cli/commands/oauth.d.ts +1 -0
  16. package/dist/src/cli/commands/oauth.js +73 -0
  17. package/dist/src/cli/commands/registry.js +79 -3
  18. package/dist/src/cli/commands/serve.js +31 -3
  19. package/dist/src/cli/commands/set.js +54 -0
  20. package/dist/src/cli/main.js +5 -0
  21. package/dist/src/cli/review_args.js +5 -0
  22. package/dist/src/config.d.ts +14 -0
  23. package/dist/src/github/client.js +13 -0
  24. package/dist/src/github/collect.d.ts +2 -2
  25. package/dist/src/github/collect.js +60 -23
  26. package/dist/src/github/permissions.js +8 -0
  27. package/dist/src/knowledge/types.d.ts +3 -4
  28. package/dist/src/pr/reviewer.js +5 -4
  29. package/dist/src/server/api/jobs.js +8 -1
  30. package/dist/src/server/api/repos.js +73 -11
  31. package/dist/src/server/api/settings.js +6 -0
  32. package/dist/src/server/app.d.ts +5 -0
  33. package/dist/src/server/app.js +7 -0
  34. package/dist/src/server/http.d.ts +3 -0
  35. package/dist/src/server/http.js +5 -0
  36. package/dist/src/server/pages/activity.js +412 -19
  37. package/dist/src/server/pages/add_repo.js +6 -1
  38. package/dist/src/server/pages/analytics.js +99 -31
  39. package/dist/src/server/pages/catalog.d.ts +1 -0
  40. package/dist/src/server/pages/catalog.js +145 -0
  41. package/dist/src/server/pages/client.d.ts +1 -1
  42. package/dist/src/server/pages/client.js +1 -1
  43. package/dist/src/server/pages/home.d.ts +14 -4
  44. package/dist/src/server/pages/home.js +83 -49
  45. package/dist/src/server/pages/icons.d.ts +3 -0
  46. package/dist/src/server/pages/icons.js +3 -0
  47. package/dist/src/server/pages/knowledge.js +10 -5
  48. package/dist/src/server/pages/layout.d.ts +19 -3
  49. package/dist/src/server/pages/layout.js +156 -33
  50. package/dist/src/server/pages/pr.js +4 -3
  51. package/dist/src/server/pages/rate_limit_waits.d.ts +5 -0
  52. package/dist/src/server/pages/rate_limit_waits.js +74 -0
  53. package/dist/src/server/pages/repo.js +100 -66
  54. package/dist/src/server/pages/repo_prs.js +4 -3
  55. package/dist/src/server/pages/repo_remote.js +4 -3
  56. package/dist/src/server/pages/repo_settings.d.ts +2 -2
  57. package/dist/src/server/pages/repo_settings.js +420 -46
  58. package/dist/src/server/pages/router.d.ts +5 -0
  59. package/dist/src/server/pages/router.js +82 -31
  60. package/dist/src/server/pages/settings.d.ts +10 -1
  61. package/dist/src/server/pages/settings.js +351 -207
  62. package/dist/src/server/pages/setup.d.ts +2 -5
  63. package/dist/src/server/pages/setup.js +21 -23
  64. package/dist/src/server/pages/styles.d.ts +1 -1
  65. package/dist/src/server/pages/styles.js +1 -1
  66. package/dist/src/server/pages/ui.d.ts +117 -0
  67. package/dist/src/server/pages/ui.js +166 -0
  68. package/dist/src/services/clear.js +2 -0
  69. package/dist/src/services/cli_repos.d.ts +2 -0
  70. package/dist/src/services/cli_repos.js +50 -0
  71. package/dist/src/services/concurrency.d.ts +39 -0
  72. package/dist/src/services/concurrency.js +88 -0
  73. package/dist/src/services/dashboard.d.ts +43 -1
  74. package/dist/src/services/dashboard.js +10 -2
  75. package/dist/src/services/jobs.js +5 -3
  76. package/dist/src/services/nav_counts.d.ts +8 -0
  77. package/dist/src/services/nav_counts.js +19 -0
  78. package/dist/src/services/rate_limit.d.ts +33 -0
  79. package/dist/src/services/rate_limit.js +78 -0
  80. package/dist/src/services/repo_list.d.ts +19 -0
  81. package/dist/src/services/repo_list.js +38 -0
  82. package/dist/src/services/review.d.ts +23 -1
  83. package/dist/src/services/review.js +104 -5
  84. package/dist/src/services/search.d.ts +13 -0
  85. package/dist/src/services/search.js +72 -0
  86. package/dist/src/services/setup.js +17 -16
  87. package/dist/src/services/setup_checklist.d.ts +1 -1
  88. package/dist/src/services/setup_checklist.js +26 -47
  89. package/dist/src/store/cache_db.js +1 -1
  90. package/dist/src/store/findings.d.ts +1 -1
  91. package/dist/src/store/findings.js +3 -3
  92. package/dist/src/store/migrations.js +7 -0
  93. package/dist/src/store/repos.d.ts +5 -0
  94. package/dist/src/store/repos.js +12 -0
  95. package/dist/src/store/reviews.d.ts +12 -1
  96. package/dist/src/store/reviews.js +34 -2
  97. package/dist/src/store/rows.d.ts +6 -0
  98. package/dist/src/types.d.ts +5 -1
  99. package/package.json +4 -2
@@ -0,0 +1,161 @@
1
+ This project bundles the following third-party assets. Their licenses are
2
+ reproduced below and apply to those assets only, not to the rest of
3
+ co-maintainer, which is distributed under the MIT License (see LICENSE).
4
+
5
+ 1. Outfit (font files under src/server/pages/fonts/)
6
+ 2. Lucide (icon SVGs under src/server/pages/icons/)
7
+ 3. Feather-derived icons (a subset of the Lucide icons listed below)
8
+
9
+
10
+ ================================================================================
11
+ 1. Outfit
12
+ ================================================================================
13
+
14
+ Copyright 2021 The Outfit Project Authors (https://github.com/Outfitio/Outfit-Fonts)
15
+
16
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
17
+ This license is copied below, and is also available with a FAQ at:
18
+ https://scripts.sil.org/OFL
19
+
20
+
21
+ -----------------------------------------------------------
22
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
23
+ -----------------------------------------------------------
24
+
25
+ PREAMBLE
26
+ The goals of the Open Font License (OFL) are to stimulate worldwide
27
+ development of collaborative font projects, to support the font creation
28
+ efforts of academic and linguistic communities, and to provide a free and
29
+ open framework in which fonts may be shared and improved in partnership
30
+ with others.
31
+
32
+ The OFL allows the licensed fonts to be used, studied, modified and
33
+ redistributed freely as long as they are not sold by themselves. The
34
+ fonts, including any derivative works, can be bundled, embedded,
35
+ redistributed and/or sold with any software provided that any reserved
36
+ names are not used by derivative works. The fonts and derivatives,
37
+ however, cannot be released under any other type of license. The
38
+ requirement for fonts to remain under this license does not apply
39
+ to any document created using the fonts or their derivatives.
40
+
41
+ DEFINITIONS
42
+ "Font Software" refers to the set of files released by the Copyright
43
+ Holder(s) under this license and clearly marked as such. This may
44
+ include source files, build scripts and documentation.
45
+
46
+ "Reserved Font Name" refers to any names specified as such after the
47
+ copyright statement(s).
48
+
49
+ "Original Version" refers to the collection of Font Software components as
50
+ distributed by the Copyright Holder(s).
51
+
52
+ "Modified Version" refers to any derivative made by adding to, deleting,
53
+ or substituting -- in part or in whole -- any of the components of the
54
+ Original Version, by changing formats or by porting the Font Software to a
55
+ new environment.
56
+
57
+ "Author" refers to any designer, engineer, programmer, technical
58
+ writer or other person who contributed to the Font Software.
59
+
60
+ PERMISSION & CONDITIONS
61
+ Permission is hereby granted, free of charge, to any person obtaining
62
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
63
+ redistribute, and sell modified and unmodified copies of the Font
64
+ Software, subject to the following conditions:
65
+
66
+ 1) Neither the Font Software nor any of its individual components,
67
+ in Original or Modified Versions, may be sold by itself.
68
+
69
+ 2) Original or Modified Versions of the Font Software may be bundled,
70
+ redistributed and/or sold with any software, provided that each copy
71
+ contains the above copyright notice and this license. These can be
72
+ included either as stand-alone text files, human-readable headers or
73
+ in the appropriate machine-readable metadata fields within text or
74
+ binary files as long as those fields can be easily viewed by the user.
75
+
76
+ 3) No Modified Version of the Font Software may use the Reserved Font
77
+ Name(s) unless explicit written permission is granted by the corresponding
78
+ Copyright Holder. This restriction only applies to the primary font name as
79
+ presented to the users.
80
+
81
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
82
+ Software shall not be used to promote, endorse or advertise any
83
+ Modified Version, except to acknowledge the contribution(s) of the
84
+ Copyright Holder(s) and the Author(s) or with their explicit written
85
+ permission.
86
+
87
+ 5) The Font Software, modified or unmodified, in part or in whole,
88
+ must be distributed entirely under this license, and must not be
89
+ distributed under any other license. The requirement for fonts to
90
+ remain under this license does not apply to any document created
91
+ using the Font Software.
92
+
93
+ TERMINATION
94
+ This license becomes null and void if any of the above conditions are
95
+ not met.
96
+
97
+ DISCLAIMER
98
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
99
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
100
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
101
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
102
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
103
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
104
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
105
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
106
+ OTHER DEALINGS IN THE FONT SOFTWARE.
107
+
108
+
109
+ ================================================================================
110
+ 2. Lucide
111
+ ================================================================================
112
+
113
+ ISC License
114
+
115
+ Copyright (c) 2026 Lucide Icons and Contributors
116
+
117
+ Permission to use, copy, modify, and/or distribute this software for any
118
+ purpose with or without fee is hereby granted, provided that the above
119
+ copyright notice and this permission notice appear in all copies.
120
+
121
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
122
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
123
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
124
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
125
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
126
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
127
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
128
+
129
+
130
+ ================================================================================
131
+ 3. Feather-derived icons (MIT)
132
+ ================================================================================
133
+
134
+ The following icons used by this project are derived from the Feather
135
+ project and are licensed under the MIT License:
136
+
137
+ check, chevron-right, circle, copy, download, external-link, github,
138
+ info, list, loader, lock, log-out, menu, moon, plus, search, server,
139
+ square, terminal, users
140
+
141
+ The MIT License (MIT)
142
+
143
+ Copyright (c) 2013-present Cole Bemis
144
+
145
+ Permission is hereby granted, free of charge, to any person obtaining a copy
146
+ of this software and associated documentation files (the "Software"), to deal
147
+ in the Software without restriction, including without limitation the rights
148
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
149
+ copies of the Software, and to permit persons to whom the Software is
150
+ furnished to do so, subject to the following conditions:
151
+
152
+ The above copyright notice and this permission notice shall be included in all
153
+ copies or substantial portions of the Software.
154
+
155
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
156
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
157
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
158
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
159
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
160
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
161
+ SOFTWARE.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "co-maintainer",
3
- "version": "0.6.1",
3
+ "version": "0.6.4",
4
4
  "description": "An imitator of yours, A PR review tool like co-maintainer.",
5
5
  "keywords": [
6
6
  "ai",
@@ -24,7 +24,8 @@
24
24
  "files": [
25
25
  "dist/",
26
26
  "LICENSE",
27
- "README.md"
27
+ "README.md",
28
+ "THIRD_PARTY_NOTICES"
28
29
  ],
29
30
  "type": "module",
30
31
  "exports": {
@@ -52,6 +53,7 @@
52
53
  "bench-core-v3": "node benchmark/core_v3/run.ts",
53
54
  "swe-prbench-prepare": "node benchmark/swe-prbench/prepare_dataset.ts",
54
55
  "e2e": "node scripts/e2e.ts",
56
+ "e2e:fake": "node scripts/e2e_fake.ts",
55
57
  "review-local-e2e": "node scripts/review_local_e2e.ts",
56
58
  "docs:build": "node scripts/build_docs.ts",
57
59
  "pack:smoke": "node scripts/pack_smoke.ts",
@@ -1,6 +1,7 @@
1
1
  import { cacheGet, cacheSet } from "../store/cache_db.js";
2
2
  import { isNotFound, readTextFile } from "../util/runtime.js";
3
3
  import { formatError } from "../cli/error.js";
4
+ import { recordRateLimitWait } from "../services/rate_limit.js";
4
5
  /** A provider call and an unusable response are both retried this many times
5
6
  * before the batch gives up and the run fails. */
6
7
  export const MAX_ATTEMPTS = 3;
@@ -128,6 +129,12 @@ export class AiBatch {
128
129
  if (attempt < limit) {
129
130
  const wait = retryDelayMs(reason, attempt);
130
131
  if (wait > 0) {
132
+ recordRateLimitWait({
133
+ service: "openrouter",
134
+ stage: item.request.job,
135
+ reason,
136
+ seconds: wait / 1000,
137
+ });
131
138
  console.log(`[ai] waiting ${Math.round(wait / 1000)}s before retry (provider is rate limiting)`);
132
139
  await new Promise((resolve) => setTimeout(resolve, wait));
133
140
  }
@@ -0,0 +1,10 @@
1
+ /** The OAuth provider ids and labels, in a leaf module.
2
+ *
3
+ * `registry.ts` and `sign-in-with-chatgpt.ts` both need these strings, and
4
+ * `sign-in-with-chatgpt.ts` reaches `openai.ts` which reaches `provider.ts`
5
+ * which reaches `registry.ts`. Keeping the constants here, with no imports,
6
+ * lets both sides read them without a cycle that leaves them undefined. */
7
+ export declare const SIWC_PROVIDER = "sign-in-with-chatgpt";
8
+ export declare const SIWC_LABEL = "Sign in with ChatGPT";
9
+ /** The alias users may type instead of the full provider id. */
10
+ export declare const SIWC_ALIAS = "siwc";
@@ -0,0 +1,10 @@
1
+ /** The OAuth provider ids and labels, in a leaf module.
2
+ *
3
+ * `registry.ts` and `sign-in-with-chatgpt.ts` both need these strings, and
4
+ * `sign-in-with-chatgpt.ts` reaches `openai.ts` which reaches `provider.ts`
5
+ * which reaches `registry.ts`. Keeping the constants here, with no imports,
6
+ * lets both sides read them without a cycle that leaves them undefined. */
7
+ export const SIWC_PROVIDER = "sign-in-with-chatgpt";
8
+ export const SIWC_LABEL = "Sign in with ChatGPT";
9
+ /** The alias users may type instead of the full provider id. */
10
+ export const SIWC_ALIAS = "siwc";
@@ -0,0 +1,33 @@
1
+ /** The OAuth providers `co-maintainer oauth` knows.
2
+ *
3
+ * One entry today, Sign in with ChatGPT. A future provider (say Claude under
4
+ * a subscription) is a new id plus a new ops object here, with no change to
5
+ * the command or to the experimental flag's plumbing. */
6
+ import type { AiProvider } from "../../types.ts";
7
+ import { CliError } from "../../cli/error.ts";
8
+ import { type Credentials, type ModelInfo } from "./sign-in-with-chatgpt.ts";
9
+ export declare const OAUTH_PROVIDER_IDS: readonly ["sign-in-with-chatgpt"];
10
+ export type OAuthProviderId = (typeof OAUTH_PROVIDER_IDS)[number];
11
+ /** The provider `--experimental-siwc` selects. Kept here so the flag's
12
+ * plumbing never names a provider string directly. */
13
+ export declare const EXPERIMENTAL_OAUTH_PROVIDER: OAuthProviderId;
14
+ /** The plain alias for a given id, if it has one. */
15
+ export declare function oauthAlias(id: OAuthProviderId): string;
16
+ /** `--provider` value to a known id, or undefined. Accepts the short alias. */
17
+ export declare function resolveOAuthProvider(value: string | undefined): OAuthProviderId | undefined;
18
+ export declare function oauthUnknownProvider(value: string | undefined): CliError;
19
+ export type OAuthOps = {
20
+ label: string;
21
+ credentialsPath(): string;
22
+ /** The browser flow; always starts a new sign-in. */
23
+ login(): Promise<Credentials>;
24
+ logout(): Promise<boolean>;
25
+ refresh(): Promise<Credentials>;
26
+ ping(): Promise<{
27
+ credentials: Credentials;
28
+ models: ModelInfo[];
29
+ }>;
30
+ listModels(): Promise<ModelInfo[]>;
31
+ createProvider(model: string): AiProvider;
32
+ };
33
+ export declare function oauthOps(id: OAuthProviderId): OAuthOps;
@@ -0,0 +1,40 @@
1
+ import { CliError, EXIT_USAGE } from "../../cli/error.js";
2
+ import { SIWC_ALIAS, SIWC_LABEL, SIWC_PROVIDER } from "./ids.js";
3
+ import { SignInWithChatGptProvider, credentialsPath, listModels, login, logout, refresh, requireCredentials, } from "./sign-in-with-chatgpt.js";
4
+ export const OAUTH_PROVIDER_IDS = [SIWC_PROVIDER];
5
+ /** The provider `--experimental-siwc` selects. Kept here so the flag's
6
+ * plumbing never names a provider string directly. */
7
+ export const EXPERIMENTAL_OAUTH_PROVIDER = SIWC_PROVIDER;
8
+ /** The plain alias for a given id, if it has one. */
9
+ export function oauthAlias(id) {
10
+ return id === SIWC_PROVIDER ? SIWC_ALIAS : id;
11
+ }
12
+ /** `--provider` value to a known id, or undefined. Accepts the short alias. */
13
+ export function resolveOAuthProvider(value) {
14
+ if (!value)
15
+ return undefined;
16
+ if (value === SIWC_PROVIDER || value === SIWC_ALIAS)
17
+ return SIWC_PROVIDER;
18
+ return undefined;
19
+ }
20
+ export function oauthUnknownProvider(value) {
21
+ return new CliError("oauth_unknown_provider", `Unknown OAuth provider ${value ? `"${value}"` : ""}.`, `Pass --provider=${SIWC_PROVIDER} (or ${SIWC_ALIAS}).`, EXIT_USAGE);
22
+ }
23
+ const SIWC_OPS = {
24
+ label: SIWC_LABEL,
25
+ credentialsPath,
26
+ login,
27
+ logout,
28
+ refresh: async () => refresh(await requireCredentials()),
29
+ ping: async () => {
30
+ const credentials = await requireCredentials();
31
+ return { credentials, models: await listModels(credentials) };
32
+ },
33
+ listModels: async () => listModels(await requireCredentials()),
34
+ createProvider: (model) => new SignInWithChatGptProvider(model),
35
+ };
36
+ export function oauthOps(id) {
37
+ if (id === SIWC_PROVIDER)
38
+ return SIWC_OPS;
39
+ throw oauthUnknownProvider(id);
40
+ }
@@ -0,0 +1,56 @@
1
+ import type { AiProvider, AiRequest, AiResponse } from "../../types.ts";
2
+ import { SIWC_ALIAS, SIWC_LABEL, SIWC_PROVIDER } from "./ids.ts";
3
+ export { SIWC_ALIAS, SIWC_LABEL, SIWC_PROVIDER };
4
+ export declare function credentialsDir(): string;
5
+ export declare function credentialsPath(): string;
6
+ export type Credentials = {
7
+ email?: string;
8
+ issuer: string;
9
+ subject: string;
10
+ client_id: string;
11
+ ext_agent_host_id: string;
12
+ id_token: string;
13
+ access_token: string;
14
+ refresh_token: string;
15
+ token_type: string;
16
+ expires_in: number;
17
+ expires_at: number;
18
+ scopes: string[];
19
+ saved_at: string;
20
+ };
21
+ /** OpenRouter-style ids carry a provider prefix (`openai/gpt-6-luna`) the
22
+ * plan route does not know. Stripping it lets the same value work on both. */
23
+ export declare function normalizeModel(model: string): string;
24
+ export declare function loadCredentials(): Credentials | undefined;
25
+ export declare function logout(): Promise<boolean>;
26
+ type BrowserOpener = (url: string) => void;
27
+ /** Tests replace the browser with a helper that completes the callback; the
28
+ * real opener shells out to the platform's open command. */
29
+ export declare function setBrowserOpener(opener: BrowserOpener | undefined): void;
30
+ /** The browser flow. Always runs, so a user can switch accounts; `logout`
31
+ * first if the old one should not be reused. */
32
+ export declare function login(): Promise<Credentials>;
33
+ export declare function refresh(creds: Credentials): Promise<Credentials>;
34
+ /** Credentials for a run: reuse the freshest token this process has seen,
35
+ * refresh an expired one, or start the browser flow. `inflight` dedups so
36
+ * `init`'s low and high providers never open two browsers; `cached` keeps a
37
+ * 401 refresh done inside `complete()` visible to later callers. */
38
+ export declare function ensureCredentials(): Promise<Credentials>;
39
+ export type ModelInfo = {
40
+ slug: string;
41
+ displayName: string;
42
+ };
43
+ /** For `oauth refresh|ping|list-models`, which operate on an existing login
44
+ * and must not start a browser flow. A live token is reused, an expired one
45
+ * refreshed; no login at all is a clear error. */
46
+ export declare function requireCredentials(): Promise<Credentials>;
47
+ export declare function listModels(creds: Credentials): Promise<ModelInfo[]>;
48
+ /** The model slugs a user can pick, for prompts and error messages. */
49
+ export declare function availableModelSlugs(): Promise<string[]>;
50
+ export declare class SignInWithChatGptProvider implements AiProvider {
51
+ readonly supportsTools = true;
52
+ private readonly model;
53
+ constructor(model: string);
54
+ private post;
55
+ complete(request: AiRequest): Promise<AiResponse>;
56
+ }