@theokit/agents 4.3.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth.d.ts +1 -3
- package/dist/auth.js +2 -3
- package/dist/auth.js.map +1 -1
- package/dist/bridge.js +1 -1
- package/dist/{chunk-D7HE4PNY.js → chunk-LIRSFEEJ.js} +2 -7
- package/dist/chunk-LIRSFEEJ.js.map +1 -0
- package/dist/index.d.ts +2 -19
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-D7HE4PNY.js.map +0 -1
package/dist/auth.d.ts
CHANGED
|
@@ -30,9 +30,7 @@ declare class AuthProvider {
|
|
|
30
30
|
* `config` + `store`; `env` (for reading the store's env overrides) + the `{ fetch, now }` HTTP deps
|
|
31
31
|
* thread through. Returns the fresh `ResolvedCredential` — never logs the rotated token.
|
|
32
32
|
*/
|
|
33
|
-
ensureFresh(resolved: ResolvedCredential,
|
|
34
|
-
env?: Record<string, string | undefined>;
|
|
35
|
-
}): Promise<ResolvedCredential>;
|
|
33
|
+
ensureFresh(resolved: ResolvedCredential, deps: EnsureFreshHttpDeps, env?: Record<string, string | undefined>): Promise<ResolvedCredential>;
|
|
36
34
|
/**
|
|
37
35
|
* Run the headless OpenAI device-login flow. Delegates to `openaiDeviceLogin` (which JWT-extracts the
|
|
38
36
|
* account id). `deviceConfig` is passed per-call because it is a distinct endpoint set from the
|
package/dist/auth.js
CHANGED
|
@@ -19,13 +19,12 @@ var AuthProvider = class {
|
|
|
19
19
|
* `config` + `store`; `env` (for reading the store's env overrides) + the `{ fetch, now }` HTTP deps
|
|
20
20
|
* thread through. Returns the fresh `ResolvedCredential` — never logs the rotated token.
|
|
21
21
|
*/
|
|
22
|
-
ensureFresh(resolved,
|
|
23
|
-
const { env, ...http } = opts;
|
|
22
|
+
ensureFresh(resolved, deps, env) {
|
|
24
23
|
return ensureFreshCredential(resolved, {
|
|
25
24
|
config: this.config,
|
|
26
25
|
store: this.store,
|
|
27
26
|
env
|
|
28
|
-
},
|
|
27
|
+
}, deps);
|
|
29
28
|
}
|
|
30
29
|
/**
|
|
31
30
|
* Run the headless OpenAI device-login flow. Delegates to `openaiDeviceLogin` (which JWT-extracts the
|
package/dist/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/auth/auth-provider.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../src/auth/auth-provider.ts"],"sourcesContent":["import { ensureFreshCredential, openaiDeviceLogin, persistOAuthTokens } from '@theokit/sdk/auth'\nimport type {\n CredentialStoreConfig,\n OAuthProviderConfig,\n OAuthTokens,\n OpenAIDeviceConfig,\n ResolvedCredential,\n} from '@theokit/sdk/auth'\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\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 ensureFresh(\n resolved: ResolvedCredential,\n deps: EnsureFreshHttpDeps,\n env?: Record<string, string | undefined>,\n ): Promise<ResolvedCredential> {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- `CredentialStoreConfig` (SDK `/auth` subpath) resolves under tsc (root typecheck is clean) but eslint's type-aware project reads `this.store` as error-typed; the assignment is type-safe per tsc.\n return ensureFreshCredential(resolved, { config: this.config, store: this.store, env }, deps)\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"],"mappings":";;;;;AAAA,SAASA,uBAAuBC,mBAAmBC,0BAA0B;AA+BtE,IAAMC,eAAN,MAAMA;EA/Bb,OA+BaA;;;;;EACX,YACmBC,QACAC,OACjB;SAFiBD,SAAAA;SACAC,QAAAA;EAChB;;;;;;EAOHC,YACEC,UACAC,MACAC,KAC6B;AAE7B,WAAOC,sBAAsBH,UAAU;MAAEH,QAAQ,KAAKA;MAAQC,OAAO,KAAKA;MAAOI;IAAI,GAAGD,IAAAA;EAC1F;;;;;;EAOAG,YACEC,cACAJ,MACAK,OACsB;AACtB,WAAOC,kBAAkBF,cAAcJ,MAAMK,KAAAA;EAC/C;;;;;EAMAE,QAAQC,UAAkBC,QAAqBR,KAAkD;AAC/F,WAAOS,mBAAmBF,UAAUC,QAAQ,KAAKZ,OAAOI,GAAAA;EAC1D;AACF;","names":["ensureFreshCredential","openaiDeviceLogin","persistOAuthTokens","AuthProvider","config","store","ensureFresh","resolved","deps","env","ensureFreshCredential","deviceLogin","deviceConfig","hooks","openaiDeviceLogin","persist","provider","tokens","persistOAuthTokens"]}
|
package/dist/bridge.js
CHANGED
|
@@ -3,12 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-7QVYU63E.js";
|
|
4
4
|
|
|
5
5
|
// src/errors.ts
|
|
6
|
-
|
|
7
|
-
static {
|
|
8
|
-
__name(this, "ConfigurationError");
|
|
9
|
-
}
|
|
10
|
-
name = "ConfigurationError";
|
|
11
|
-
};
|
|
6
|
+
import { ConfigurationError } from "@theokit/sdk/errors";
|
|
12
7
|
|
|
13
8
|
// src/bridge/define-agent.ts
|
|
14
9
|
var AGENT_BRAND = /* @__PURE__ */ Symbol.for("theokit.agent.definition");
|
|
@@ -3510,4 +3505,4 @@ export {
|
|
|
3510
3505
|
generateAgentManifest,
|
|
3511
3506
|
agentsPlugin
|
|
3512
3507
|
};
|
|
3513
|
-
//# sourceMappingURL=chunk-
|
|
3508
|
+
//# sourceMappingURL=chunk-LIRSFEEJ.js.map
|