@theokit/sdk 4.10.0 → 4.11.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/CHANGELOG.md +36 -0
- package/dist/auth/index.cjs +552 -0
- package/dist/auth/index.cjs.map +1 -0
- package/dist/auth/index.d.cts +19 -0
- package/dist/auth/index.d.ts +19 -0
- package/dist/auth/index.js +533 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/{cron-BF_AI5NP.d.ts → cron-C7catiH8.d.ts} +7 -2
- package/dist/{cron-DXEhagMa.d.cts → cron-DK1WVZnI.d.cts} +7 -2
- package/dist/cron.cjs +16 -6
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +1 -1
- package/dist/cron.d.ts +1 -1
- package/dist/cron.js +16 -6
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +16 -6
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +16 -6
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +16 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/dist/internal/auth/auth-types.d.ts +93 -0
- package/dist/internal/auth/credential-store.d.ts +19 -0
- package/dist/internal/auth/oauth-device.d.ts +55 -0
- package/dist/internal/auth/oauth-engine.d.ts +21 -0
- package/dist/internal/auth/resolve-credential.d.ts +16 -0
- package/dist/internal/providers/types.d.ts +1 -1
- package/dist/types/provider-profile.d.ts +6 -1
- package/package.json +12 -2
|
@@ -1206,7 +1206,12 @@ interface ProviderTransformContext {
|
|
|
1206
1206
|
* @public
|
|
1207
1207
|
*/
|
|
1208
1208
|
interface ProviderTransform {
|
|
1209
|
-
/**
|
|
1209
|
+
/**
|
|
1210
|
+
* Dynamic per-request headers, merged OVER the profile's static `extraHeaders`, and spread AFTER the
|
|
1211
|
+
* transport's base `authorization`/`content-type`. A provider that owns its auth MAY intentionally set
|
|
1212
|
+
* `authorization` here to override the resolved bearer — but a stray `authorization`/`content-type` key
|
|
1213
|
+
* will silently replace the base header, so return only the headers you mean to add.
|
|
1214
|
+
*/
|
|
1210
1215
|
headers?(ctx: ProviderTransformContext): Record<string, string>;
|
|
1211
1216
|
/** A fetch to use for this provider's requests (refresh-aware / fully provider-controlled). */
|
|
1212
1217
|
fetch?(ctx: ProviderTransformContext): typeof fetch;
|
|
@@ -2559,4 +2564,4 @@ declare class Cron {
|
|
|
2559
2564
|
static status(_options?: CronStartOptions): Promise<CronSchedulerStatus>;
|
|
2560
2565
|
}
|
|
2561
2566
|
|
|
2562
|
-
export { type GoalOptions as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type ContextBudget as D, type ContextManagerKind as E, type ContextSnapshot as F, type GetAgentOptions as G, type ContextSource as H, type InlineSkill as I, type ContextSourceStatus as J, type CreateSkillSpec as K, type LocalOptions as L, type MemorySettings as M, Cron as N, type CronCreateOptions as O, type ProviderRoutingSettings as P, type CronGetOptions as Q, type CronJob as R, type SystemPromptResolver as S, type CronJobStatus as T, type CronListOptions as U, type CronOperationOptions as V, type CronRunOptions as W, type CronRuntime as X, type CronSchedulerStatus as Y, type CronStartOptions as Z, type GoalEvent as _, type AgentDefinition as a, type GoalResult as a0, type HookName as a1, type InvalidateCacheOptions as a2, type MemoryAdapter as a3, type MemoryAdapterCapabilities as a4, type MemoryContext as a5, type MemoryFact as a6, type MemoryProviderHandle as a7, type MemoryProviderInitOptions as a8, type MemoryRevision as a9, type
|
|
2567
|
+
export { type GoalOptions as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type ContextBudget as D, type ContextManagerKind as E, type ContextSnapshot as F, type GetAgentOptions as G, type ContextSource as H, type InlineSkill as I, type ContextSourceStatus as J, type CreateSkillSpec as K, type LocalOptions as L, type MemorySettings as M, Cron as N, type CronCreateOptions as O, type ProviderRoutingSettings as P, type CronGetOptions as Q, type CronJob as R, type SystemPromptResolver as S, type CronJobStatus as T, type CronListOptions as U, type CronOperationOptions as V, type CronRunOptions as W, type CronRuntime as X, type CronSchedulerStatus as Y, type CronStartOptions as Z, type GoalEvent as _, type AgentDefinition as a, type GoalResult as a0, type HookName as a1, type InvalidateCacheOptions as a2, type MemoryAdapter as a3, type MemoryAdapterCapabilities as a4, type MemoryContext as a5, type MemoryFact as a6, type MemoryProviderHandle as a7, type MemoryProviderInitOptions as a8, type MemoryRevision as a9, type SkillsResolver as aA, type SkillsResolverContext as aB, type SystemPromptContext as aC, type SystemPromptMemoryFact as aD, type SystemPromptSkillRef as aE, type TelemetrySettings as aF, type MemoryToolSchema as aa, type MemoryTurnMessage as ab, type PersonalityPreset as ac, type PluginContext as ad, type PostAssistantReplyContext as ae, type PreToolCallContext as af, type PreUserSendContext as ag, type PreUserSendResult as ah, type ProviderCapability as ai, type ProviderRoute as aj, type ProviderTransform as ak, type ProviderTransformContext as al, type RecordSessionSummaryArgs as am, type ResolvedProviderRoute as an, type RunUntilIterator as ao, type SDKAgentPlugins as ap, type SDKAgentSkillDetail as aq, type SDKAgentSkills as ar, type SDKArtifact as as, type SDKContextManager as at, type SDKPluginMetadata as au, type SDKProvidersManager as av, type SessionRecord as aw, type SessionStore as ax, type SettingSource as ay, Skill as az, type ContextSettings as b, type PluginsSettings as c, type SkillsSettings as d, type SDKAgent as e, type ListAgentsOptions as f, type ListResult as g, type SDKAgentInfo as h, type ListRunsOptions as i, type GetRunOptions as j, type AgentOperationOptions as k, type Plugin as l, type ProviderProfile as m, type MemoryProvider as n, type MemoryId as o, type PreToolCallDecision as p, type StepResult as q, type SDKProvider as r, type ActiveMemoryPassArgs as s, type ActiveMemoryPassResult as t, type AgentMemory as u, type BudgetCheck as v, type BudgetTotal as w, type BudgetUsageEvent as x, type CloudEnv as y, type CloudRepo as z };
|
|
@@ -1206,7 +1206,12 @@ interface ProviderTransformContext {
|
|
|
1206
1206
|
* @public
|
|
1207
1207
|
*/
|
|
1208
1208
|
interface ProviderTransform {
|
|
1209
|
-
/**
|
|
1209
|
+
/**
|
|
1210
|
+
* Dynamic per-request headers, merged OVER the profile's static `extraHeaders`, and spread AFTER the
|
|
1211
|
+
* transport's base `authorization`/`content-type`. A provider that owns its auth MAY intentionally set
|
|
1212
|
+
* `authorization` here to override the resolved bearer — but a stray `authorization`/`content-type` key
|
|
1213
|
+
* will silently replace the base header, so return only the headers you mean to add.
|
|
1214
|
+
*/
|
|
1210
1215
|
headers?(ctx: ProviderTransformContext): Record<string, string>;
|
|
1211
1216
|
/** A fetch to use for this provider's requests (refresh-aware / fully provider-controlled). */
|
|
1212
1217
|
fetch?(ctx: ProviderTransformContext): typeof fetch;
|
|
@@ -2559,4 +2564,4 @@ declare class Cron {
|
|
|
2559
2564
|
static status(_options?: CronStartOptions): Promise<CronSchedulerStatus>;
|
|
2560
2565
|
}
|
|
2561
2566
|
|
|
2562
|
-
export { type GoalOptions as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type ContextBudget as D, type ContextManagerKind as E, type ContextSnapshot as F, type GetAgentOptions as G, type ContextSource as H, type InlineSkill as I, type ContextSourceStatus as J, type CreateSkillSpec as K, type LocalOptions as L, type MemorySettings as M, Cron as N, type CronCreateOptions as O, type ProviderRoutingSettings as P, type CronGetOptions as Q, type CronJob as R, type SystemPromptResolver as S, type CronJobStatus as T, type CronListOptions as U, type CronOperationOptions as V, type CronRunOptions as W, type CronRuntime as X, type CronSchedulerStatus as Y, type CronStartOptions as Z, type GoalEvent as _, type AgentDefinition as a, type GoalResult as a0, type HookName as a1, type InvalidateCacheOptions as a2, type MemoryAdapter as a3, type MemoryAdapterCapabilities as a4, type MemoryContext as a5, type MemoryFact as a6, type MemoryProviderHandle as a7, type MemoryProviderInitOptions as a8, type MemoryRevision as a9, type
|
|
2567
|
+
export { type GoalOptions as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type ContextBudget as D, type ContextManagerKind as E, type ContextSnapshot as F, type GetAgentOptions as G, type ContextSource as H, type InlineSkill as I, type ContextSourceStatus as J, type CreateSkillSpec as K, type LocalOptions as L, type MemorySettings as M, Cron as N, type CronCreateOptions as O, type ProviderRoutingSettings as P, type CronGetOptions as Q, type CronJob as R, type SystemPromptResolver as S, type CronJobStatus as T, type CronListOptions as U, type CronOperationOptions as V, type CronRunOptions as W, type CronRuntime as X, type CronSchedulerStatus as Y, type CronStartOptions as Z, type GoalEvent as _, type AgentDefinition as a, type GoalResult as a0, type HookName as a1, type InvalidateCacheOptions as a2, type MemoryAdapter as a3, type MemoryAdapterCapabilities as a4, type MemoryContext as a5, type MemoryFact as a6, type MemoryProviderHandle as a7, type MemoryProviderInitOptions as a8, type MemoryRevision as a9, type SkillsResolver as aA, type SkillsResolverContext as aB, type SystemPromptContext as aC, type SystemPromptMemoryFact as aD, type SystemPromptSkillRef as aE, type TelemetrySettings as aF, type MemoryToolSchema as aa, type MemoryTurnMessage as ab, type PersonalityPreset as ac, type PluginContext as ad, type PostAssistantReplyContext as ae, type PreToolCallContext as af, type PreUserSendContext as ag, type PreUserSendResult as ah, type ProviderCapability as ai, type ProviderRoute as aj, type ProviderTransform as ak, type ProviderTransformContext as al, type RecordSessionSummaryArgs as am, type ResolvedProviderRoute as an, type RunUntilIterator as ao, type SDKAgentPlugins as ap, type SDKAgentSkillDetail as aq, type SDKAgentSkills as ar, type SDKArtifact as as, type SDKContextManager as at, type SDKPluginMetadata as au, type SDKProvidersManager as av, type SessionRecord as aw, type SessionStore as ax, type SettingSource as ay, Skill as az, type ContextSettings as b, type PluginsSettings as c, type SkillsSettings as d, type SDKAgent as e, type ListAgentsOptions as f, type ListResult as g, type SDKAgentInfo as h, type ListRunsOptions as i, type GetRunOptions as j, type AgentOperationOptions as k, type Plugin as l, type ProviderProfile as m, type MemoryProvider as n, type MemoryId as o, type PreToolCallDecision as p, type StepResult as q, type SDKProvider as r, type ActiveMemoryPassArgs as s, type ActiveMemoryPassResult as t, type AgentMemory as u, type BudgetCheck as v, type BudgetTotal as w, type BudgetUsageEvent as x, type CloudEnv as y, type CloudRepo as z };
|
package/dist/cron.cjs
CHANGED
|
@@ -12613,6 +12613,7 @@ var OpenAIClient = class {
|
|
|
12613
12613
|
if (this.options.organization !== void 0) {
|
|
12614
12614
|
headers["openai-organization"] = this.options.organization;
|
|
12615
12615
|
}
|
|
12616
|
+
if (this.options.extraHeaders !== void 0) Object.assign(headers, this.options.extraHeaders);
|
|
12616
12617
|
const providerId = this.options.providerName ?? this.name;
|
|
12617
12618
|
let response;
|
|
12618
12619
|
try {
|
|
@@ -13655,6 +13656,9 @@ function sentinelForNoAuth(profile) {
|
|
|
13655
13656
|
function sentinelForLazyAuth(profile) {
|
|
13656
13657
|
if (profile.authType === "aws_bearer") return "__bedrock_lazy_token__";
|
|
13657
13658
|
if (profile.authType === "gcp_oauth") return "__vertex_lazy_token__";
|
|
13659
|
+
if (profile.authType === "oauth_device_code" || profile.authType === "oauth_external") {
|
|
13660
|
+
return "__oauth_lazy_token__";
|
|
13661
|
+
}
|
|
13658
13662
|
return void 0;
|
|
13659
13663
|
}
|
|
13660
13664
|
function filterPoolKeys(keys) {
|
|
@@ -13685,9 +13689,11 @@ function resolveApiKey2(envVars) {
|
|
|
13685
13689
|
return void 0;
|
|
13686
13690
|
}
|
|
13687
13691
|
function selectTransport(profile, apiKey) {
|
|
13688
|
-
const
|
|
13689
|
-
|
|
13690
|
-
|
|
13692
|
+
const applyTransform = () => {
|
|
13693
|
+
if (profile.transform === void 0) return {};
|
|
13694
|
+
const ctx = { apiKey };
|
|
13695
|
+
return { fetch: profile.transform.fetch?.(ctx), headers: profile.transform.headers?.(ctx) };
|
|
13696
|
+
};
|
|
13691
13697
|
if (profile.apiMode === "chat_completions") {
|
|
13692
13698
|
if (profile.name === "ollama") {
|
|
13693
13699
|
const ollamaBase = process.env.OLLAMA_HOST ?? profile.baseUrl;
|
|
@@ -13704,7 +13710,10 @@ function selectTransport(profile, apiKey) {
|
|
|
13704
13710
|
}
|
|
13705
13711
|
const envOverride = resolveBaseUrlEnvOverride(profile.name);
|
|
13706
13712
|
if (envOverride !== void 0) opts.baseUrl = envOverride;
|
|
13707
|
-
|
|
13713
|
+
const t = applyTransform();
|
|
13714
|
+
if (t.fetch !== void 0) opts.fetch = t.fetch;
|
|
13715
|
+
const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
13716
|
+
if (merged !== void 0) opts.extraHeaders = merged;
|
|
13708
13717
|
return new OpenAIClient(opts);
|
|
13709
13718
|
}
|
|
13710
13719
|
if (profile.apiMode === "anthropic_messages") {
|
|
@@ -13721,12 +13730,13 @@ function selectTransport(profile, apiKey) {
|
|
|
13721
13730
|
return new BedrockAnthropicClient(realKey !== void 0 ? { apiKey: realKey } : {});
|
|
13722
13731
|
}
|
|
13723
13732
|
if (profile.apiMode === "responses_api") {
|
|
13724
|
-
const
|
|
13733
|
+
const t = applyTransform();
|
|
13734
|
+
const mergedHeaders = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
13725
13735
|
return new ResponsesApiClient({
|
|
13726
13736
|
apiKey,
|
|
13727
13737
|
...profile.baseUrl !== void 0 ? { baseUrl: profile.baseUrl } : {},
|
|
13728
13738
|
...mergedHeaders !== void 0 ? { extraHeaders: mergedHeaders } : {},
|
|
13729
|
-
...
|
|
13739
|
+
...t.fetch !== void 0 ? { fetch: t.fetch } : {},
|
|
13730
13740
|
providerName: profile.name
|
|
13731
13741
|
});
|
|
13732
13742
|
}
|