@theokit/agents 6.4.1 → 7.0.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/LICENSE +201 -0
- package/dist/auth.js +1 -1
- package/dist/auth.js.map +1 -1
- package/dist/{bridge-entry-C_jckCIk.d.ts → bridge-entry-F9XyPi0K.d.ts} +73 -4
- package/dist/bridge.d.ts +1 -1
- package/dist/bridge.js +2 -2
- package/dist/bridge.js.map +1 -1
- package/dist/{chunk-C5RUE4DB.js → chunk-3YPKTOJ6.js} +542 -381
- package/dist/chunk-3YPKTOJ6.js.map +1 -0
- package/dist/{chunk-NTDOKNSU.js → chunk-FCGL2PEC.js} +2 -2
- package/dist/chunk-FCGL2PEC.js.map +1 -0
- package/dist/{chunk-7QVYU63E.js → chunk-Z4QWC7IK.js} +1 -1
- package/dist/chunk-Z4QWC7IK.js.map +1 -0
- package/dist/client-react.js +2 -2
- package/dist/client-react.js.map +1 -1
- package/dist/client.js +2 -2
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/interactive.js +1 -1
- package/dist/interactive.js.map +1 -1
- package/dist/persistence.d.ts +1 -1
- package/dist/persistence.js +3 -3
- package/dist/persistence.js.map +1 -1
- package/dist/pty.js +1 -1
- package/dist/pty.js.map +1 -1
- package/dist/sandbox.d.ts +1 -1
- package/dist/sandbox.js +3 -3
- package/dist/sandbox.js.map +1 -1
- package/dist/testing.js +1 -1
- package/dist/testing.js.map +1 -1
- package/dist/tools.js +1 -1
- package/dist/tools.js.map +1 -1
- package/package.json +12 -12
- package/dist/chunk-7QVYU63E.js.map +0 -1
- package/dist/chunk-C5RUE4DB.js.map +0 -1
- package/dist/chunk-NTDOKNSU.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 usetheo.dev
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/dist/auth.js
CHANGED
package/dist/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/auth/auth-provider.ts","../src/auth-entry.ts","../src/auth/device-provider.ts"],"sourcesContent":["import {\n authFilePath,\n ensureFreshCredential,\n openaiDeviceLogin,\n persistOAuthTokens,\n readStoredOAuth,\n} from '@theokit/sdk/auth'\nimport type {\n CredentialStoreConfig,\n OAuthProviderConfig,\n OAuthTokens,\n OpenAIDeviceConfig,\n ResolvedCredential,\n} from '@theokit/sdk/auth'\nimport { withFileLock } from '@theokit/sdk/persistence'\n\n/**\n * M60 — `AuthProvider`, the OO contract that unifies the SDK's free OAuth-lifecycle functions\n * (`openaiDeviceLogin` → `persistOAuthTokens` → `ensureFreshCredential`). Those are stateful across a\n * SHARED `config` (`OAuthProviderConfig`) + `store` (`CredentialStoreConfig`); this class holds that\n * state so a consumer authors `new AuthProvider(config, store).persist(...)` / `.ensureFresh(...)`\n * instead of threading `config`/`store` through every call — the `SDK → Theokit → AgentBuilder`\n * boundary applied to the auth domain (ENRICH, per blueprint D2: auth carries orchestration + state).\n *\n * It DELEGATES, never reimplements (parsimony Rung 9): each method forwards verbatim to the SDK\n * function, so login → persist → refresh produces byte-identical state to calling the SDK directly.\n *\n * SECRET-SAFETY (hard rule): this class NEVER logs, stringifies, or otherwise surfaces token material.\n * Methods return exactly what the SDK returns and add no observability — a token is data that flows\n * through, never something this layer emits. The parity/secret tests pin both properties.\n */\n\n/** The HTTP deps of `ensureFreshCredential` (`{ fetch, now }`) — typed off the SDK to avoid drift. */\ntype EnsureFreshHttpDeps = Parameters<typeof ensureFreshCredential>[2]\n/** The device-flow deps + prompt hook of `openaiDeviceLogin` — typed off the SDK. */\ntype DeviceLoginDeps = Parameters<typeof openaiDeviceLogin>[1]\ntype DeviceLoginHooks = Parameters<typeof openaiDeviceLogin>[2]\n\n/**\n * Falha de refresh, classificada — porque a decisão de tentar de novo depende da classe, não do texto.\n *\n * M74: repetir um `invalid_grant` não é resiliência, é ruído. O refresh token foi revogado e nenhuma\n * tentativa muda isso; o usuário que revogou o login espera três backoffs para ler uma mensagem que já\n * era conhecida na primeira resposta. Rede e 5xx são o oposto: quase sempre passam na segunda.\n *\n * SECRET-SAFETY: a mensagem nunca carrega material de token — só a classe e o motivo.\n */\nexport class RefreshFailure extends Error {\n constructor(\n message: string,\n /** `true` ⇒ vale tentar de novo com backoff. `false` ⇒ terminal, falha na primeira. */\n readonly transitorio: boolean,\n ) {\n super(message)\n this.name = 'RefreshFailure'\n }\n}\n\n/**\n * O que conta como transitório. Lista NOMEADA de propósito: é decisão de produto que envelhece, e\n * espalhá-la em `if` faz cada sítio envelhecer sozinho.\n */\nconst MOTIVOS_TRANSITORIOS = [\n 'ETIMEDOUT',\n 'ECONNRESET',\n 'ECONNREFUSED',\n 'EAI_AGAIN',\n 'ENOTFOUND',\n 'AbortError',\n]\n\n/** Classifica uma falha de refresh. `invalid_grant` é terminal; rede e 5xx são transitórios. */\nexport function classificarFalhaDeRefresh(err: unknown): RefreshFailure {\n const texto = err instanceof Error ? `${err.name}: ${err.message}` : String(err)\n if (/invalid_grant|invalid_request|unauthorized_client/i.test(texto)) {\n return new RefreshFailure(\n 'o refresh token não é mais válido — refaça o login. Tentar de novo não muda o resultado.',\n false,\n )\n }\n const transitorio =\n MOTIVOS_TRANSITORIOS.some((m) => texto.includes(m)) ||\n /\\b(5\\d{2})\\b|timeout|network/i.test(texto)\n return new RefreshFailure(\n transitorio ? 'falha transitória ao refrescar a credencial' : 'falha ao refrescar a credencial',\n transitorio,\n )\n}\n\n/** Espera com jitter: backoff exponencial ±25%, para dois processos não retentarem em uníssono. */\nexport function esperaComJitter(tentativa: number, baseMs = 200, aleatorio = Math.random): number {\n const base = baseMs * 2 ** tentativa\n return Math.round(base * (0.75 + aleatorio() * 0.5))\n}\n\nexport class AuthProvider {\n constructor(\n private readonly config: OAuthProviderConfig,\n private readonly store: CredentialStoreConfig,\n ) {}\n\n /**\n * Refresh a resolved credential if stale. Delegates to `ensureFreshCredential` with the held\n * `config` + `store`; `env` (for reading the store's env overrides) + the `{ fetch, now }` HTTP deps\n * thread through. Returns the fresh `ResolvedCredential` — never logs the rotated token.\n */\n async ensureFresh(\n resolved: ResolvedCredential,\n deps: EnsureFreshHttpDeps,\n env?: Record<string, string | undefined>,\n ): Promise<ResolvedCredential> {\n if (resolved.kind !== 'oauth') {\n // Chave de API não expira: nenhum lock, nenhuma releitura, nenhum I/O. Manter o caminho quente\n // livre é o que torna o resolvedor por-run barato (M74, Risco 1).\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- `CredentialStoreConfig` do subpath /auth resolve sob tsc; o projeto type-aware do eslint o lê como error-typed.\n return ensureFreshCredential(resolved, { config: this.config, store: this.store, env }, deps)\n }\n\n const caminho: string = authFilePath(this.store, env)\n\n // SINGLE-FLIGHT in-process, ANTES do lock (M74, EC-2 do edge-case review).\n //\n // `withFileLock` (proper-lockfile) NÃO é reentrante: se uma run começar de dentro de um contexto\n // que já segura o lock — uma run aninhada, ou um time disparando membros enquanto o pai refresca —\n // a segunda aquisição espera até o timeout e o sintoma é \"a run travou\", sem erro nenhum. Com o\n // resolvedor por-run do M74 isso deixa de ser hipotético: `ensureFresh` passa a ser chamado de\n // dentro do stream. A promise em voo faz a reentrância resolver por composição, não por lock.\n const emVoo = AuthProvider.refreshEmVoo.get(caminho)\n if (emVoo !== undefined) return emVoo\n\n const promessa = this.refrescarSobLock(caminho, resolved, deps, env)\n AuthProvider.refreshEmVoo.set(caminho, promessa)\n try {\n return await promessa\n } finally {\n AuthProvider.refreshEmVoo.delete(caminho)\n }\n }\n\n /** Refresh em voo por caminho de store — a chave é o arquivo, não a instância. */\n private static readonly refreshEmVoo = new Map<string, Promise<ResolvedCredential>>()\n\n /**\n * O refresh propriamente dito, serializado entre PROCESSOS e com re-leitura.\n *\n * A re-leitura não é detalhe: sem ela o lock apenas serializa, e o segundo processo decide com o\n * estado que leu ANTES de esperar — refrescando de novo e invalidando o token que o primeiro acabou\n * de gravar. É o double-checked locking clássico, e é o que o teste de dois processos pega.\n */\n private refrescarSobLock(\n caminho: string,\n resolved: ResolvedCredential,\n deps: EnsureFreshHttpDeps,\n env?: Record<string, string | undefined>,\n ): Promise<ResolvedCredential> {\n /* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- os subpaths `/auth` e `/persistence` do SDK resolvem sob tsc (typecheck da raiz limpo); o projeto type-aware do eslint os lê como error-typed. Mesma nota que este arquivo já carregava para `CredentialStoreConfig`. */\n return withFileLock(caminho, async () => {\n // RE-LEITURA depois de adquirir o lock: outro processo pode ter refrescado enquanto esperávamos.\n const doDisco = readStoredOAuth(this.store, env)\n const atual =\n doDisco !== undefined\n ? { ...resolved, apiKey: doDisco.access, expiresAt: doDisco.expires }\n : resolved\n // Retry SÓ no transitório. Um `invalid_grant` falha na PRIMEIRA: o token foi revogado e nenhuma\n // tentativa muda isso — insistir só atrasa a mensagem que o usuário precisa ler.\n //\n // Este laço já existiu e foi APAGADO por um lint-fix meu que reescreveu o bloco inteiro; o\n // review pegou (`tentativas de POST = 1`, contra as 3 que a DoD exige). Testar o classificador\n // isolado prova que ele classifica, não que está LIGADO — por isso há um gate estrutural.\n const MAX_TENTATIVAS = 3\n for (let tentativa = 0; ; tentativa++) {\n try {\n return await ensureFreshCredential(\n atual,\n { config: this.config, store: this.store, env },\n deps,\n )\n } catch (err) {\n const falha = classificarFalhaDeRefresh(err)\n if (!falha.transitorio || tentativa >= MAX_TENTATIVAS - 1) throw falha\n await new Promise((resolve) => setTimeout(resolve, esperaComJitter(tentativa)))\n }\n }\n }) as Promise<ResolvedCredential>\n /* eslint-enable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */\n }\n\n /**\n * Run the headless OpenAI device-login flow. Delegates to `openaiDeviceLogin` (which JWT-extracts the\n * account id). `deviceConfig` is passed per-call because it is a distinct endpoint set from the\n * refresh `config`. Returns `OAuthTokens` — the caller persists them via {@link AuthProvider.persist}.\n */\n deviceLogin(\n deviceConfig: OpenAIDeviceConfig,\n deps: DeviceLoginDeps,\n hooks: DeviceLoginHooks,\n ): Promise<OAuthTokens> {\n return openaiDeviceLogin(deviceConfig, deps, hooks)\n }\n\n /**\n * Persist freshly-obtained tokens through the held `store`. Delegates to `persistOAuthTokens` and\n * returns the credential-file path (never the token). `env` selects the store's home override.\n */\n persist(provider: string, tokens: OAuthTokens, env?: Record<string, string | undefined>): string {\n return persistOAuthTokens(provider, tokens, this.store, env)\n }\n}\n","// M60 — `@theokit/agents/auth`: the OO auth contract. `AuthProvider` (ENRICH — it holds the shared\n// `config`+`store` state and delegates to the SDK's free OAuth-lifecycle functions), plus the auth\n// domain's types re-exported so a consumer types the whole surface from the Theokit layer, never\n// reaching back to `@theokit/sdk/auth`.\nexport { AuthProvider } from './auth/auth-provider.js'\n\n// M73 — \"enriquecer nunca reduz\". A mecânica de store do SDK atravessa como PASS-THROUGH PURO.\n//\n// Antes disto, este subpath exportava 1 valor e 6 tipos enquanto `@theokit/sdk/auth` exportava 19\n// símbolos: nenhuma função atravessava. Como o consumidor tem regra INQUEBRÁVEL de nunca importar\n// `@theokit/sdk*` direto, **reimplementar era a única saída legal** — e o agent-builder reescreveu\n// seis destes nomes, ~120 linhas de mecânica duplicada. A lacuna era daqui, não indisciplina de lá.\n//\n// PURO, e não wrapper (parsimony Rung 9): estas são funções de I/O sem estado a segurar. A camada\n// enriquece onde há orquestração — é o que `AuthProvider` faz com o par `config`+`store`. Envolver\n// isto acrescentaria indireção sem nada dentro, e **quebraria `instanceof`**: o consumidor faz\n// `err instanceof CredentialError`, o que só vale enquanto a classe for a MESMA referência do SDK.\n// `tests/unit/auth-parity.test.ts` trava essa identidade com `toBe`.\n//\n// `resolveCredential` NÃO atravessa, de propósito: o SDK e o agent-builder têm funções DIFERENTES com\n// esse nome (sync vs async, lança vs `undefined`, lê env vs não lê, infere provider vs recusa), e o\n// próprio SDK declara que a precedência de env, a inferência por prefixo e o provider declarado são\n// app policy do consumidor (`internal/auth/credential-store.ts`). Expor os dois no mesmo escopo seria\n// convite a importar o errado, com falha silenciosa.\nexport {\n authFilePath,\n CredentialError,\n credentialHome,\n readAuthFile,\n readStoredOAuth,\n writeCredential,\n} from '@theokit/sdk/auth'\n\n// M110 — o device flow **RFC 8628** atravessa, pelo MESMO argumento do M73 acima, sobre símbolos que\n// aquele milestone não cobriu.\n//\n// Medido: o SDK implementa o padrão (`deviceLogin`, `requestDeviceCode`, `pollDeviceToken`,\n// `DeviceOAuthConfig`), e este subpath re-exportava **apenas** a variante da OpenAI\n// (`openaiDeviceLogin`, `OpenAIDeviceConfig`). Um consumidor que precisasse do padrão tinha duas\n// saídas: violar a regra INQUEBRÁVEL, ou reimplementar o RFC. É literalmente a frase do M73 — *\"a\n// lacuna era daqui, não indisciplina de lá\"* — reencenada num subsistema vizinho.\n//\n// PURO, não wrapper, pelo critério que o M73 escreveu: são funções de I/O sem estado a segurar.\n// `DeviceDeps` já é injetável, então um consumidor testa o próprio provider sem rede.\n//\n// As duas formas COEXISTEM e nada é unificado: `DeviceOAuthConfig` tem **um** `deviceCodeEndpoint`\n// (RFC), e `OpenAIDeviceConfig` tem **dois** (`deviceUsercodeEndpoint` → `devicePollEndpoint`, com\n// PKCE). Fundi-las quebraria o Codex — o provider que este trabalho existe para facilitar.\n// E `openaiDeviceLogin` atravessa JUNTO, o que a medição do M110 mostrou faltar: ele era **importado**\n// aqui para uso interno do `AuthProvider` e nunca re-exportado. Consequência — o flow do Codex só era\n// alcançável construindo um `AuthProvider` (que exige `config`+`store`), quando o pedido concreto era\n// *\"facilitar usar o provider Codex\"*. Exportá-lo é o mesmo argumento das linhas acima, aplicado à\n// variante que já existia.\nexport {\n deviceLogin,\n openaiDeviceLogin,\n pollDeviceToken,\n requestDeviceCode,\n} from '@theokit/sdk/auth'\nexport type { DeviceCodeGrant, DeviceOAuthConfig } from '@theokit/sdk/auth'\nexport type { ResolveCredentialOptions } from '@theokit/sdk/auth'\nexport type {\n CredentialStoreConfig,\n DeviceDeps,\n OAuthProviderConfig,\n OAuthTokens,\n OpenAIDeviceConfig,\n ResolvedCredential,\n} from '@theokit/sdk/auth'\n\n// M111 — device auth PLUG-AND-PLAY. O M110 fez o flow RFC 8628 atravessar; ele não tocou a ergonomia.\n//\n// Para autenticar no Codex, o consumidor tinha de saber que existem DUAS formas de device flow, copiar\n// um `clientId` e três URLs da OpenAI para dentro do próprio código, montar `{fetch, sleep, now}`,\n// chamar `deviceLogin` e LEMBRAR de chamar `persist` — esquecer o último custa um round-trip OAuth\n// completo que não guarda nada.\n//\n// O desenho veio de medição contra três peers e REFUTOU a proposta original (um descritor plano com\n// discriminante `kind`): nenhum dos três discrimina protocolo por campo. `AuthMethod` é união\n// discriminada e cada método aponta para a SUA função — sem `switch`, e sem tornar representável um\n// método OAuth que não sabe autorizar.\n//\n// ENRIQUECE, não é pass-through: `loginWithDevice` orquestra `authorize` + `persist` (a forma de\n// `run_device_code_login` do codex, que retorna `()`), e `CODEX_PROVIDER` é identidade pública que\n// antes cada consumidor copiava — dois donos do mesmo fato é violação de DRY através da fronteira.\nexport { CODEX_CLIENT_ID_ENV_VAR, CODEX_PROVIDER, loginWithDevice } from './auth/device-provider.js'\nexport type { AuthMethod, DeviceAuthProvider, PromptHooks } from './auth/device-provider.js'\n","import type {\n CredentialStoreConfig,\n DeviceDeps,\n OAuthProviderConfig,\n OAuthTokens,\n OpenAIDeviceConfig,\n} from '@theokit/sdk/auth'\nimport { openaiDeviceLogin } from '@theokit/sdk/auth'\n\nimport { AuthProvider } from './auth-provider.js'\n\n/**\n * M111 — device auth plug-and-play: um provider é um objeto com métodos ROTULADOS, e um login cabe\n * numa chamada.\n *\n * ## O problema, medido\n *\n * O M110 fez o device flow RFC 8628 atravessar esta camada. Ele não tocou a ergonomia: para\n * autenticar no Codex, o consumidor precisava saber que existem **duas** formas de device flow,\n * copiar um `clientId` e três URLs da OpenAI para dentro do próprio código, montar\n * `{ fetch, sleep, now }`, chamar `deviceLogin` e **lembrar** de chamar `persist` — e esquecer o\n * último custa um round-trip OAuth completo que não guarda nada. O docblock de `AuthProvider`\n * instruía exatamente isso: *\"the caller persists them via `AuthProvider.persist`\"*.\n *\n * ## O desenho veio de medição contra três peers, e refutou a proposta original\n *\n * - **`codex`** — `codex-rs/login/src/device_code_auth.rs:234` tem `run_device_code_login`, que\n * retorna `()`: **nada** sai para o chamador persistir, e as duas metades granulares continuam\n * públicas. `loginWithDevice` é a cópia dessa forma.\n * - **`opencode`** — cada provider é um objeto com `methods: [{ label, type, authorize }]`, e três\n * providers escritos por autores diferentes convergem em **3 métodos rotulados** cada. O rótulo é o\n * que a UI mostra: transforma escolha de protocolo em escolha de frase legível.\n * - **REJEITADO — discriminante `kind`.** Nenhum dos três discrimina protocolo por campo. A medição\n * que fecha o caso: no `opencode`, browser e headless do Codex carregam o **mesmo** `type: 'oauth'`\n * — logo o `type` classifica **espécie de credencial**, não protocolo. Um `kind` com despacho\n * interno seria um `switch`, exatamente o defeito que este milestone remove do consumidor.\n * Aqui, cada método aponta para a **sua própria** função.\n *\n * ## Por que a identidade pública mora AQUI\n *\n * `codex` exporta `CLIENT_ID` do crate que implementa o flow (`login/src/lib.rs:32`) e o CLI o\n * **importa**; o `opencode` o declara dentro do plugin. Os dois chegaram ao mesmo lugar\n * independentemente — e com o mesmo valor que o consumidor tinha copiado. Enquanto morasse no\n * consumidor, todo projeto que quisesse Codex copiaria quatro constantes públicas: é violação de DRY\n * através da fronteira, com dois donos do mesmo fato.\n */\n\n/**\n * Uma forma rotulada de obter credencial dentro de um provider.\n *\n * UNIÃO DISCRIMINADA, não um campo `authorize?` opcional. Com opcional, `{ label, type: 'oauth' }`\n * seria representável — um método OAuth que não sabe autorizar, detectado só em runtime, no meio do\n * login do usuário. É a alternativa que o M110 já rejeitou por escrito ao recusar \"um tipo só com\n * campos opcionais\": tornaria representável um config inválido e moveria a detecção do compilador\n * para o runtime.\n */\nexport type AuthMethod =\n | {\n /** O que a interface mostra ao usuário. É a peça que torna o fluxo escolhível sem saber o protocolo. */\n readonly label: string\n readonly type: 'oauth'\n /** A função DESTE método. Sem discriminante: o método aponta para a sua, não para um `switch`. */\n readonly authorize: (deps: DeviceDeps, hooks: PromptHooks) => Promise<OAuthTokens>\n }\n | {\n readonly label: string\n readonly type: 'api'\n }\n\n/** O que o consumidor liga à sua UI para mostrar o código que o usuário digita no outro dispositivo. */\nexport interface PromptHooks {\n onPrompt: (p: { userCode: string; verificationUri: string; expiresIn?: number }) => void\n}\n\n/** Um provider de autenticação: identidade pública + as formas rotuladas de autenticar nele. */\nexport interface DeviceAuthProvider {\n readonly name: string\n readonly oauth: OAuthProviderConfig\n readonly methods: readonly AuthMethod[]\n}\n\n/** Identificadores PÚBLICOS do Codex CLI da OpenAI (publicados na fonte MIT do OpenCode). Não são segredo. */\nconst CODEX_CLIENT_ID = 'app_EMoamEEZ73f0CkXaXp7hrann'\nconst CODEX_ISSUER = 'https://auth.openai.com'\n\n/**\n * Override do `clientId` por ambiente — adotado do `codex`, que exporta `CLIENT_ID` **e**\n * `CLIENT_ID_OVERRIDE_ENV_VAR` (`login/src/lib.rs:32-33`). Dissolve o falso dilema entre constante\n * fixa (inflexível) e parâmetro obrigatório (que devolve a cópia ao consumidor): default no pacote,\n * escape para quem precisa.\n */\nexport const CODEX_CLIENT_ID_ENV_VAR = 'THEOKIT_CODEX_CLIENT_ID'\n\nconst CODEX_OAUTH: OAuthProviderConfig = {\n provider: 'openai',\n clientId: process.env[CODEX_CLIENT_ID_ENV_VAR] ?? CODEX_CLIENT_ID,\n authorizeEndpoint: `${CODEX_ISSUER}/oauth/authorize`,\n tokenEndpoint: `${CODEX_ISSUER}/oauth/token`,\n scopes: ['openid', 'profile', 'email', 'offline_access'],\n redirectUri: `${CODEX_ISSUER}/deviceauth/callback`,\n}\n\n/**\n * A config do device flow da OpenAI — **dois** endpoints, com PKCE. É a variante NÃO-padrão, e é por\n * isso que ela não se funde com `DeviceOAuthConfig` (RFC 8628, **um** endpoint).\n */\nconst CODEX_DEVICE: OpenAIDeviceConfig = {\n ...CODEX_OAUTH,\n deviceUsercodeEndpoint: `${CODEX_ISSUER}/api/accounts/deviceauth/usercode`,\n devicePollEndpoint: `${CODEX_ISSUER}/api/accounts/deviceauth/token`,\n verificationUri: `${CODEX_ISSUER}/codex/device`,\n}\n\n/**\n * O provider do Codex, montado e **congelado**.\n *\n * Congelado porque é identidade pública COMPARTILHADA no processo: um consumidor que a mutasse\n * mudaria o login de todos os outros. `Object.freeze` é raso, então a lista de métodos é congelada\n * separadamente — sem isso, `CODEX_PROVIDER.methods.push(...)` passaria.\n */\nexport const CODEX_PROVIDER: DeviceAuthProvider = Object.freeze({\n name: 'openai',\n oauth: Object.freeze(CODEX_OAUTH),\n methods: Object.freeze([\n Object.freeze({\n label: 'ChatGPT Pro/Plus (headless device code)',\n type: 'oauth' as const,\n // Aponta para a variante da OpenAI. Um provider RFC 8628 apontaria para `deviceLogin`, e é\n // assim que as duas formas coexistem sem discriminante.\n authorize: (deps: DeviceDeps, hooks: PromptHooks): Promise<OAuthTokens> =>\n openaiDeviceLogin(CODEX_DEVICE, deps, hooks),\n }),\n Object.freeze({\n label: 'Manually enter API Key',\n type: 'api' as const,\n }),\n ]),\n})\n\n/**\n * Opções do Facade. `deps` e `env` viajam juntos num objeto em vez de dois parâmetros posicionais:\n * ambos são opcionais e raramente usados, e seis posicionais é assinatura que o chamador erra em\n * silêncio (o lint do monorepo cobra 5 como teto — o teto existe por este motivo).\n */\nexport interface LoginWithDeviceOptions {\n /** Injeção de I/O para teste. Omitido, usa `fetch`/`setTimeout`/`Date.now` reais. */\n readonly deps?: Partial<DeviceDeps>\n /** Ambiente lido pelo store para resolver o diretório da credencial. */\n readonly env?: Record<string, string | undefined>\n}\n\n/** Defaults das deps de I/O. `deps` é opcional na superfície ergonômica; a injeção fica para o teste. */\nfunction comDefaults(deps?: Partial<DeviceDeps>): DeviceDeps {\n return {\n fetch: deps?.fetch ?? fetch,\n sleep: deps?.sleep ?? ((ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms))),\n now: deps?.now ?? Date.now,\n }\n}\n\n/**\n * Autoriza **e** persiste, numa chamada. Devolve onde a credencial ficou e a conta atribuída —\n * **nunca** material de token.\n *\n * A forma vem de `run_device_code_login` (`codex`), que retorna `()`: se nada sai para o chamador,\n * não há passo que ele possa esquecer. As duas metades continuam públicas em `AuthProvider`\n * (`deviceLogin` / `persist`) para quem precisa da granularidade — mesma escolha que o `codex` faz ao\n * manter `request_device_code` e `complete_device_code_login` públicas ao lado do Facade.\n *\n * Delega verbatim: `method.authorize` roda o flow e `AuthProvider.persist` grava. Copiar a sequência\n * em vez de chamá-la criaria um segundo oráculo sobre o mesmo fato, e dois oráculos divergem no\n * primeiro fix aplicado a um lado só.\n */\nexport async function loginWithDevice(\n provider: DeviceAuthProvider,\n method: AuthMethod,\n store: CredentialStoreConfig,\n hooks: PromptHooks,\n opts: LoginWithDeviceOptions = {},\n): Promise<{ path: string; accountId?: string }> {\n // VALIDAÇÃO NA FRONTEIRA, antes de qualquer I/O. As três recusas abaixo acontecem sem tocar a rede\n // e sem tocar o disco: falhar depois de gravar deixaria credencial parcial, e a próxima execução\n // leria um estado que nunca foi válido.\n if (provider.methods.length === 0) {\n throw new TypeError(\n `o provider \"${provider.name}\" declara nenhum método de autenticação — não há o que escolher`,\n )\n }\n if (!provider.methods.includes(method)) {\n throw new TypeError(`o método \"${method.label}\" não pertence ao provider \"${provider.name}\"`)\n }\n if (method.type !== 'oauth') {\n throw new TypeError(\n `o método \"${method.label}\" é de chave (api key), não é um método de device — use o caminho de chave`,\n )\n }\n\n const tokens = await method.authorize(comDefaults(opts.deps), hooks)\n const path = new AuthProvider(provider.oauth, store).persist(provider.name, tokens, opts.env)\n // O retorno NÃO carrega token: o consumidor precisa saber onde ficou e de quem é, não o segredo.\n return tokens.accountId === undefined ? { path } : { path, accountId: tokens.accountId }\n}\n"],"mappings":";;;;;AAAA,SACEA,cACAC,uBACAC,mBACAC,oBACAC,uBACK;AAQP,SAASC,oBAAoB;AAiCtB,IAAMC,iBAAN,cAA6BC,MAAAA;EA/CpC,OA+CoCA;;;;EAClC,YACEC,SAESC,aACT;AACA,UAAMD,OAAAA,GAAAA,KAFGC,cAAAA;AAGT,SAAKC,OAAO;EACd;AACF;AAMA,IAAMC,uBAAuB;EAC3B;EACA;EACA;EACA;EACA;EACA;;AAIK,SAASC,0BAA0BC,KAAY;AACpD,QAAMC,QAAQD,eAAeN,QAAQ,GAAGM,IAAIH,IAAI,KAAKG,IAAIL,OAAO,KAAKO,OAAOF,GAAAA;AAC5E,MAAI,qDAAqDG,KAAKF,KAAAA,GAAQ;AACpE,WAAO,IAAIR,eACT,gHACA,KAAA;EAEJ;AACA,QAAMG,cACJE,qBAAqBM,KAAK,CAACC,MAAMJ,MAAMK,SAASD,CAAAA,CAAAA,KAChD,gCAAgCF,KAAKF,KAAAA;AACvC,SAAO,IAAIR,eACTG,cAAc,mDAAgD,mCAC9DA,WAAAA;AAEJ;AAfgBG;AAkBT,SAASQ,gBAAgBC,WAAmBC,SAAS,KAAKC,YAAYC,KAAKC,QAAM;AACtF,QAAMC,OAAOJ,SAAS,KAAKD;AAC3B,SAAOG,KAAKG,MAAMD,QAAQ,OAAOH,UAAAA,IAAc,IAAE;AACnD;AAHgBH;AAKT,IAAMQ,eAAN,MAAMA,cAAAA;EA/Fb,OA+FaA;;;;;EACX,YACmBC,QACAC,OACjB;SAFiBD,SAAAA;SACAC,QAAAA;EAChB;;;;;;EAOH,MAAMC,YACJC,UACAC,MACAC,KAC6B;AAC7B,QAA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qBT,eAAsBS,gBACpBjC,UACAkC,QACAC,OACAb,OACAc,OAA+B,CAAC,GAAC;AAKjC,MAAIpC,SAASiB,QAAQoB,WAAW,GAAG;AACjC,UAAM,IAAIC,UACR,eAAetC,SAASe,IAAI,qFAAiE;EAEjG;AACA,MAAI,CAACf,SAASiB,QAAQsB,SAASL,MAAAA,GAAS;AACtC,UAAM,IAAII,UAAU,gBAAaJ,OAAOhB,KAAK,kCAA+BlB,SAASe,IAAI,GAAG;EAC9F;AACA,MAAImB,OAAOf,SAAS,SAAS;AAC3B,UAAM,IAAImB,UACR,gBAAaJ,OAAOhB,KAAK,6FAA4E;EAEzG;AAEA,QAAMsB,SAAS,MAAMN,OAAOd,UAAUI,YAAYY,KAAKf,IAAI,GAAGC,KAAAA;AAC9D,QAAMmB,OAAO,IAAIC,aAAa1C,SAASgB,OAAOmB,KAAAA,EAAOQ,QAAQ3C,SAASe,MAAMyB,QAAQJ,KAAKjC,GAAG;AAE5F,SAAOqC,OAAOI,cAAcC,SAAY;IAAEJ;EAAK,IAAI;IAAEA;IAAMG,WAAWJ,OAAOI;EAAU;AACzF;AA5BsBX;","names":["authFilePath","ensureFreshCredential","openaiDeviceLogin","persistOAuthTokens","readStoredOAuth","withFileLock","RefreshFailure","Error","message","transitorio","name","MOTIVOS_TRANSITORIOS","classificarFalhaDeRefresh","err","texto","String","test","some","m","includes","esperaComJitter","tentativa","baseMs","aleatorio","Math","random","base","round","AuthProvider","config","store","ensureFresh","resolved","deps","env","kind","ensureFreshCredential","caminho","authFilePath","emVoo","refreshEmVoo","get","undefined","promessa","refrescarSobLock","set","delete","Map","withFileLock","doDisco","readStoredOAuth","atual","apiKey","access","expiresAt","expires","MAX_TENTATIVAS","falha","Promise","resolve","setTimeout","deviceLogin","deviceConfig","hooks","openaiDeviceLogin","persist","provider","tokens","persistOAuthTokens","authFilePath","CredentialError","credentialHome","readAuthFile","readStoredOAuth","writeCredential","deviceLogin","openaiDeviceLogin","pollDeviceToken","requestDeviceCode","openaiDeviceLogin","CODEX_CLIENT_ID","CODEX_ISSUER","CODEX_CLIENT_ID_ENV_VAR","CODEX_OAUTH","provider","clientId","process","env","authorizeEndpoint","tokenEndpoint","scopes","redirectUri","CODEX_DEVICE","deviceUsercodeEndpoint","devicePollEndpoint","verificationUri","CODEX_PROVIDER","Object","freeze","name","oauth","methods","label","type","authorize","deps","hooks","openaiDeviceLogin","comDefaults","fetch","sleep","ms","Promise","resolve","setTimeout","now","Date","loginWithDevice","method","store","opts","length","TypeError","includes","tokens","path","AuthProvider","persist","accountId","undefined"]}
|
|
1
|
+
{"version":3,"sources":["../src/auth/auth-provider.ts","../src/auth-entry.ts","../src/auth/device-provider.ts"],"mappings":";;;;;AAAA,SACEA,cACAC,uBACAC,mBACAC,oBACAC,uBACK;AAQP,SAASC,oBAAoB;AAiCtB,IAAMC,iBAAN,cAA6BC,MAAAA;EA/CpC,OA+CoCA;;;;EAClC,YACEC,SAESC,aACT;AACA,UAAMD,OAAAA,GAAAA,KAFGC,cAAAA;AAGT,SAAKC,OAAO;EACd;AACF;AAMA,IAAMC,uBAAuB;EAC3B;EACA;EACA;EACA;EACA;EACA;;AAIK,SAASC,0BAA0BC,KAAY;AACpD,QAAMC,QAAQD,eAAeN,QAAQ,GAAGM,IAAIH,IAAI,KAAKG,IAAIL,OAAO,KAAKO,OAAOF,GAAAA;AAC5E,MAAI,qDAAqDG,KAAKF,KAAAA,GAAQ;AACpE,WAAO,IAAIR,eACT,gHACA,KAAA;EAEJ;AACA,QAAMG,cACJE,qBAAqBM,KAAK,CAACC,MAAMJ,MAAMK,SAASD,CAAAA,CAAAA,KAChD,gCAAgCF,KAAKF,KAAAA;AACvC,SAAO,IAAIR,eACTG,cAAc,mDAAgD,mCAC9DA,WAAAA;AAEJ;AAfgBG;AAkBT,SAASQ,gBAAgBC,WAAmBC,SAAS,KAAKC,YAAYC,KAAKC,QAAM;AACtF,QAAMC,OAAOJ,SAAS,KAAKD;AAC3B,SAAOG,KAAKG,MAA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AAA;AAeA,SAASK,YAAYH,MAA0B;AAC7C,SAAO;IACLI,OAAOJ,MAAMI,SAASA;IACtBC,OAAOL,MAAMK,UAAU,CAACC,OAAe,IAAIC,QAAc,CAACC,YAAYC,WAAWD,SAASF,EAAAA,CAAAA;IAC1FI,KAAKV,MAAMU,OAAOC,KAAKD;EACzB;AACF;AANSP;AAqBT,eAAsBS,gBACpBjC,UACAkC,QACAC,OACAb,OACAc,OAA+B,CAAC,GAAC;AAKjC,MAAIpC,SAASiB,QAAQoB,WAAW,GAAG;AACjC,UAAM,IAAIC,UACR,eAAetC,SAASe,IAAI,qFAAiE;EAEjG;AACA,MAAI,CAACf,SAASiB,QAAQsB,SAASL,MAAAA,GAAS;AACtC,UAAM,IAAII,UAAU,gBAAaJ,OAAOhB,KAAK,kCAA+BlB,SAASe,IAAI,GAAG;EAC9F;AACA,MAAImB,OAAOf,SAAS,SAAS;AAC3B,UAAM,IAAImB,UACR,gBAAaJ,OAAOhB,KAAK,6FAA4E;EAEzG;AAEA,QAAMsB,SAAS,MAAMN,OAAOd,UAAUI,YAAYY,KAAKf,IAAI,GAAGC,KAAAA;AAC9D,QAAMmB,OAAO,IAAIC,aAAa1C,SAASgB,OAAOmB,KAAAA,EAAOQ,QAAQ3C,SAASe,MAAMyB,QAAQJ,KAAKjC,GAAG;AAE5F,SAAOqC,OAAOI,cAAcC,SAAY;IAAEJ;EAAK,IAAI;IAAEA;IAAMG,WAAWJ,OAAOI;EAAU;AACzF;AA5BsBX;","names":["authFilePath","ensureFreshCredential","openaiDeviceLogin","persistOAuthTokens","readStoredOAuth","withFileLock","RefreshFailure","Error","message","transitorio","name","MOTIVOS_TRANSITORIOS","classificarFalhaDeRefresh","err","texto","String","test","some","m","includes","esperaComJitter","tentativa","baseMs","aleatorio","Math","random","base","round","AuthProvider","config","store","ensureFresh","resolved","deps","env","kind","ensureFreshCredential","caminho","authFilePath","emVoo","refreshEmVoo","get","undefined","promessa","refrescarSobLock","set","delete","Map","withFileLock","doDisco","readStoredOAuth","atual","apiKey","access","expiresAt","expires","MAX_TENTATIVAS","falha","Promise","resolve","setTimeout","deviceLogin","deviceConfig","hooks","openaiDeviceLogin","persist","provider","tokens","persistOAuthTokens","authFilePath","CredentialError","credentialHome","readAuthFile","readStoredOAuth","writeCredential","deviceLogin","openaiDeviceLogin","pollDeviceToken","requestDeviceCode","openaiDeviceLogin","CODEX_CLIENT_ID","CODEX_ISSUER","CODEX_CLIENT_ID_ENV_VAR","CODEX_OAUTH","provider","clientId","process","env","authorizeEndpoint","tokenEndpoint","scopes","redirectUri","CODEX_DEVICE","deviceUsercodeEndpoint","devicePollEndpoint","verificationUri","CODEX_PROVIDER","Object","freeze","name","oauth","methods","label","type","authorize","deps","hooks","openaiDeviceLogin","comDefaults","fetch","sleep","ms","Promise","resolve","setTimeout","now","Date","loginWithDevice","method","store","opts","length","TypeError","includes","tokens","path","AuthProvider","persist","accountId","undefined"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExecutionContext } from '@theokit/http';
|
|
2
|
-
import { McpServerConfig, SystemPromptResolver, InlineSkill, SettingSource, MemorySettings, SkillsSettings, ContextSettings, PreToolCallContext, PreToolCallDecision, PostToolCallContext, ToolResultTransformContext, TransformContext, SessionLifecycleContext, PreUserSendContext, PreUserSendResult, PostAssistantReplyContext, CustomTool, ModelSelection, PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition as AgentDefinition$1, BudgetTracker } from '@theokit/sdk';
|
|
2
|
+
import { McpServerConfig, SystemPromptResolver, InlineSkill, SettingSource, MemorySettings, SkillsSettings, ContextSettings, PreToolCallContext, PreToolCallDecision, PostToolCallContext, ToolResultTransformContext, TransformContext, SessionLifecycleContext, PreUserSendContext, PreUserSendResult, PostAssistantReplyContext, CustomTool, ModelSelection, PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition as AgentDefinition$1, BudgetTracker, RunEventSink } from '@theokit/sdk';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { UIMessageChunk } from 'ai';
|
|
5
5
|
import { RetryOptions } from '@theokit/sdk/retry';
|
|
@@ -582,6 +582,40 @@ interface ApprovalRequiredEvent {
|
|
|
582
582
|
/** M20 — JSON-schema descriptor of the custom payload the approver may attach (optional). */
|
|
583
583
|
payloadSchema?: Record<string, unknown>;
|
|
584
584
|
}
|
|
585
|
+
/**
|
|
586
|
+
* The run is blocked awaiting user input or approval — theokit#141.
|
|
587
|
+
*
|
|
588
|
+
* The SDK's low-fidelity pause signal (`SDKRequestMessage`), distinct from {@link
|
|
589
|
+
* ApprovalRequiredEvent}. The latter is the framework's own, produced by `createHitlPlugin`, and
|
|
590
|
+
* carries everything an approval UI needs to be actionable. This one carries only the request id,
|
|
591
|
+
* because that is all the SDK provides — and it matters most exactly where the plugin is absent
|
|
592
|
+
* (the ACP/serving path of theokit#139), which is where a dropped pause reads to the user as a
|
|
593
|
+
* hang with no explanation.
|
|
594
|
+
*
|
|
595
|
+
* A consumer that cannot resolve the request should still SHOW that the run is waiting. Silence is
|
|
596
|
+
* the one response that is always wrong.
|
|
597
|
+
*/
|
|
598
|
+
interface InputRequestedEvent {
|
|
599
|
+
type: 'input_requested';
|
|
600
|
+
requestId: string;
|
|
601
|
+
}
|
|
602
|
+
/** Task-level milestone or summary — theokit#141. Both fields are optional at the source. */
|
|
603
|
+
interface TaskProgressEvent {
|
|
604
|
+
type: 'task_progress';
|
|
605
|
+
status?: string;
|
|
606
|
+
text?: string;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Live output from a shell command the SDK is running — theokit#141.
|
|
610
|
+
*
|
|
611
|
+
* `event` is passed through opaquely because the SDK types it as `Record<string, unknown>`. The
|
|
612
|
+
* layer deliberately does not interpret or render it: guessing a shape here would be a second,
|
|
613
|
+
* weaker oracle over a payload whose real contract lives upstream.
|
|
614
|
+
*/
|
|
615
|
+
interface ShellOutputEvent {
|
|
616
|
+
type: 'shell_output';
|
|
617
|
+
event: Record<string, unknown>;
|
|
618
|
+
}
|
|
585
619
|
/** Agent encountered an error. */
|
|
586
620
|
interface ErrorEvent {
|
|
587
621
|
type: 'error';
|
|
@@ -667,7 +701,7 @@ interface FileEditEvent {
|
|
|
667
701
|
endLine?: number;
|
|
668
702
|
}
|
|
669
703
|
/** Discriminated union of all agent stream events. */
|
|
670
|
-
type AgentStreamEvent = RunStartedEvent | TextDeltaEvent | ToolCallEvent | PartialToolCallEvent | ToolResultEvent | ThinkingEvent | IterationEvent | ApprovalRequiredEvent | ArtifactStartEvent | ArtifactChunkEvent | StateUpdateEvent | CheckpointSavedEvent | FileEditEvent | ErrorEvent | DoneEvent;
|
|
704
|
+
type AgentStreamEvent = RunStartedEvent | TextDeltaEvent | ToolCallEvent | PartialToolCallEvent | ToolResultEvent | ThinkingEvent | IterationEvent | ApprovalRequiredEvent | InputRequestedEvent | TaskProgressEvent | ShellOutputEvent | ArtifactStartEvent | ArtifactChunkEvent | StateUpdateEvent | CheckpointSavedEvent | FileEditEvent | ErrorEvent | DoneEvent;
|
|
671
705
|
/** Type guard helpers. */
|
|
672
706
|
declare function isTextDelta(e: AgentStreamEvent): e is TextDeltaEvent;
|
|
673
707
|
declare function isToolCall(e: AgentStreamEvent): e is ToolCallEvent;
|
|
@@ -1064,6 +1098,18 @@ interface RuntimeOverrides {
|
|
|
1064
1098
|
* come from imperative SDK factories supply them without the `@Tool` compile path.
|
|
1065
1099
|
*/
|
|
1066
1100
|
sdkTools?: readonly CustomTool[];
|
|
1101
|
+
/**
|
|
1102
|
+
* theokit#132 — sink for the SDK's typed `RunEvent`s (`tool_progress`, `rate_limit`,
|
|
1103
|
+
* `permission_denied`, `task_*`, `compact_boundary`, `tripwire`, `completion_check`), threaded
|
|
1104
|
+
* straight to `SendOptions.onRunEvent`.
|
|
1105
|
+
*
|
|
1106
|
+
* Threaded, NOT multiplexed into the UIMessage stream. These are run diagnostics for an observer —
|
|
1107
|
+
* theokit-studio's event inspector is the demand that opened the issue — and folding them into the
|
|
1108
|
+
* message protocol would force every consumer of the chat stream to know about frames it has no
|
|
1109
|
+
* use for. Threading leaves the chat path byte-identical for anyone who does not opt in, which is
|
|
1110
|
+
* why the key is omitted entirely rather than set to `undefined` when absent.
|
|
1111
|
+
*/
|
|
1112
|
+
onRunEvent?: RunEventSink;
|
|
1067
1113
|
}
|
|
1068
1114
|
declare function createSdkAgentStream(compiled: CompiledAgentOptions, compiledTools: CompiledTool[], apiKey: string | (() => string | Promise<string>), overrides?: RuntimeOverrides): ((message: string, sessionId: string, factoryOpts?: {
|
|
1069
1115
|
disableTools?: boolean;
|
|
@@ -1476,6 +1522,19 @@ interface StreamAgentOptions {
|
|
|
1476
1522
|
* follow-up. The non-HITL path is pull-based and already tears down on the consumer's return.
|
|
1477
1523
|
*/
|
|
1478
1524
|
signal?: AbortSignal;
|
|
1525
|
+
/**
|
|
1526
|
+
* theokit#132 — observe the SDK's typed `RunEvent`s for this run (`tool_progress`, `rate_limit`,
|
|
1527
|
+
* `permission_denied`, `task_*`, `compact_boundary`, `tripwire`, `completion_check`).
|
|
1528
|
+
*
|
|
1529
|
+
* The seam theokit-studio's M1 event inspector needs: without it the run endpoint can only stream
|
|
1530
|
+
* `{kind:"message"}`, and the inspector degrades to showing nothing about the run itself.
|
|
1531
|
+
*
|
|
1532
|
+
* Deliberately a SINK rather than extra chunks on the returned generator. The generator's contract
|
|
1533
|
+
* is the UIMessage protocol a chat consumer renders; run diagnostics are a different audience, and
|
|
1534
|
+
* multiplexing them would make every chat consumer step over frames it has no use for. Absent ⇒
|
|
1535
|
+
* the stream is byte-identical to before.
|
|
1536
|
+
*/
|
|
1537
|
+
onRunEvent?: RuntimeOverrides['onRunEvent'];
|
|
1479
1538
|
}
|
|
1480
1539
|
/**
|
|
1481
1540
|
* Run a compiled agent and yield the M0/M1 `UIMessageStream` chunks. `apiKey` is resolved by the
|
|
@@ -2082,9 +2141,19 @@ type McpApprovalSpec = HumanInTheLoopOptions | string;
|
|
|
2082
2141
|
*/
|
|
2083
2142
|
declare function mcpToolApprovals(specs: Record<string, McpApprovalSpec>): Record<string, HumanInTheLoopOptions>;
|
|
2084
2143
|
|
|
2085
|
-
/**
|
|
2144
|
+
/**
|
|
2145
|
+
* The channel by which a skipped entry is NAMED. Without it, narrowing the blast radius would turn
|
|
2146
|
+
* into fail-open.
|
|
2147
|
+
*
|
|
2148
|
+
* **`onWarn` is optional; the WARNING is not.** Omitted, warnings go to `stderr` — never nowhere.
|
|
2149
|
+
* The M112 review measured why that matters: the only production caller (the agent-builder's
|
|
2150
|
+
* `agents/chat.ts:530`) did NOT pass `onWarn`, and the whole defence against `error-handling.md § 2`
|
|
2151
|
+
* — repeated across four artifacts — rested on the phrase *"the error stays visible on the channel"*.
|
|
2152
|
+
* With no subscriber it did not: the entry was dropped in total silence, and the user saw "the tool
|
|
2153
|
+
* disappeared" and nothing else.
|
|
2154
|
+
*/
|
|
2086
2155
|
interface LoadMcpJsonOptions {
|
|
2087
|
-
onWarn?: (
|
|
2156
|
+
onWarn?: (warning: string) => void;
|
|
2088
2157
|
}
|
|
2089
2158
|
/**
|
|
2090
2159
|
* Raised when `<cwd>/.mcp.json` exists but cannot be read, is not valid JSON, or does not match the
|
package/dist/bridge.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { i as AGENT_BRAND, j as AfterToolCallContext, k as AgentBuilder, l as AgentDefinition, m as AgentDefinitionError, n as AgentExecutionContext, o as AgentManifest, f as AgentManifestEntry, p as AgentManifestSource, q as AgentManifestTool, t as AgentRoute, u as AgentRouteContext, v as AgentRunInfo, w as AgentStreamEvent, x as AgentTurnMetadata, y as AgentsPluginOptions, z as ApiErrorContext, B as ApiErrorDecision, E as ApiErrorPolicy, h as ApprovalPosture, F as ApprovalRequiredEvent, I as ArtifactChunkEvent, J as ArtifactStartEvent, K as BackgroundDelegation, N as BeforeToolCallContext, O as BudgetExceededError, Q as CheckpointSavedEvent, C as CompiledAgentOptions, U as CompiledContextWindow, a as CompiledTool, V as ContextualTool, Y as DefineAgentConfig, Z as DefinicaoOuThunk, _ as DelegateFn, $ as DelegateOptions, a0 as DelegationBudgetExceededError, a1 as DelegationError, D as DelegationResult, a2 as DoneEvent, a3 as ErrorEvent, a4 as FileEditEvent, aa as InferAgentInput, ab as InferAgentToolNames, ac as IterationEvent, ad as LLMCallContext, ai as McpApprovalSpec, aj as McpFileError, ak as McpRegistryConfig, al as McpRequestContext, am as McpSelection, ao as PartialToolCallEvent, aq as ProcessInputContext, au as RunStartedEvent, av as ScoreVerdict, aw as ScoredDelegation, ax as Scorer, ay as SdkAgentHandle, az as SdkMessage, aA as SdkSendOptions, aB as SdkTurnHandle, aC as Segment, aF as StateUpdateEvent, S as StreamEvent, aG as TextDeltaEvent, aH as ThinkingEvent, aJ as ToolCallEvent, aK as ToolCallVeto, aL as ToolHooks, aM as ToolHooksPlugin, aN as ToolResultEvent, aO as ToolWalkResult, aQ as ToolboxWalkResult, aR as agentsPlugin, aS as buildModelSelection, aT as compileAgentDefinition, aU as compileAgentModule, aV as compileContextWindow, aW as compileProjectContext, aX as compileSkills, aY as compileTools, aZ as createAgentExecutionContext, a_ as createApiErrorHandler, a$ as createSdkAgentStream, b0 as createThinkTagExtractor, b1 as createToolHooksPlugin, b2 as delegate, b3 as delegateBackground, b4 as delegateWithScoring, b5 as extractThinkTagStream, b6 as generateAgentManifest, b7 as generateAgentRoutes, b8 as isAgentContext, b9 as isAgentDefinition, ba as isApprovalRequired, bb as isDone, bc as isError, bd as isPartialToolCall, be as isTextDelta, bf as isToolCall, bg as isToolResult, bi as loadMcpJson, bk as mcpRegistry, bl as mcpToolApprovals, bn as presentUIMessageStream, bo as projectContextMetadataOnlyKnobs, bp as reasoningEffortOf, bt as resolveMcpServers, bu as runWithApiErrorHandling, bv as streamAgentResponse, s as streamAgentUIMessages, bw as toAgentFactory, bx as translateSdkEvent } from './bridge-entry-
|
|
1
|
+
export { i as AGENT_BRAND, j as AfterToolCallContext, k as AgentBuilder, l as AgentDefinition, m as AgentDefinitionError, n as AgentExecutionContext, o as AgentManifest, f as AgentManifestEntry, p as AgentManifestSource, q as AgentManifestTool, t as AgentRoute, u as AgentRouteContext, v as AgentRunInfo, w as AgentStreamEvent, x as AgentTurnMetadata, y as AgentsPluginOptions, z as ApiErrorContext, B as ApiErrorDecision, E as ApiErrorPolicy, h as ApprovalPosture, F as ApprovalRequiredEvent, I as ArtifactChunkEvent, J as ArtifactStartEvent, K as BackgroundDelegation, N as BeforeToolCallContext, O as BudgetExceededError, Q as CheckpointSavedEvent, C as CompiledAgentOptions, U as CompiledContextWindow, a as CompiledTool, V as ContextualTool, Y as DefineAgentConfig, Z as DefinicaoOuThunk, _ as DelegateFn, $ as DelegateOptions, a0 as DelegationBudgetExceededError, a1 as DelegationError, D as DelegationResult, a2 as DoneEvent, a3 as ErrorEvent, a4 as FileEditEvent, aa as InferAgentInput, ab as InferAgentToolNames, ac as IterationEvent, ad as LLMCallContext, ai as McpApprovalSpec, aj as McpFileError, ak as McpRegistryConfig, al as McpRequestContext, am as McpSelection, ao as PartialToolCallEvent, aq as ProcessInputContext, au as RunStartedEvent, av as ScoreVerdict, aw as ScoredDelegation, ax as Scorer, ay as SdkAgentHandle, az as SdkMessage, aA as SdkSendOptions, aB as SdkTurnHandle, aC as Segment, aF as StateUpdateEvent, S as StreamEvent, aG as TextDeltaEvent, aH as ThinkingEvent, aJ as ToolCallEvent, aK as ToolCallVeto, aL as ToolHooks, aM as ToolHooksPlugin, aN as ToolResultEvent, aO as ToolWalkResult, aQ as ToolboxWalkResult, aR as agentsPlugin, aS as buildModelSelection, aT as compileAgentDefinition, aU as compileAgentModule, aV as compileContextWindow, aW as compileProjectContext, aX as compileSkills, aY as compileTools, aZ as createAgentExecutionContext, a_ as createApiErrorHandler, a$ as createSdkAgentStream, b0 as createThinkTagExtractor, b1 as createToolHooksPlugin, b2 as delegate, b3 as delegateBackground, b4 as delegateWithScoring, b5 as extractThinkTagStream, b6 as generateAgentManifest, b7 as generateAgentRoutes, b8 as isAgentContext, b9 as isAgentDefinition, ba as isApprovalRequired, bb as isDone, bc as isError, bd as isPartialToolCall, be as isTextDelta, bf as isToolCall, bg as isToolResult, bi as loadMcpJson, bk as mcpRegistry, bl as mcpToolApprovals, bn as presentUIMessageStream, bo as projectContextMetadataOnlyKnobs, bp as reasoningEffortOf, bt as resolveMcpServers, bu as runWithApiErrorHandling, bv as streamAgentResponse, s as streamAgentUIMessages, bw as toAgentFactory, bx as translateSdkEvent } from './bridge-entry-F9XyPi0K.js';
|
|
2
2
|
import '@theokit/http';
|
|
3
3
|
import '@theokit/sdk';
|
|
4
4
|
import 'zod';
|
package/dist/bridge.js
CHANGED
package/dist/bridge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":[],"mappings":"","names":[]}
|