@anthonyhaussman/opencode-agy-auth 1.2.7-alpha.1 → 1.2.7-alpha.3

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.
@@ -0,0 +1,7 @@
1
+ /**
2
+ * HTTP header and URL manipulation utilities.
3
+ * Shared between OpenCode v1 and v2 runtimes.
4
+ */
5
+ export declare function getSafeHeader(headers: unknown, key: string): string | undefined;
6
+ export declare function setSafeHeaders(initHeaders: unknown, newHeaders: Record<string, string>): unknown;
7
+ export declare function toUrlString(value: RequestInfo): string;
@@ -1,5 +1,7 @@
1
1
  import type { GetAuth, PluginClient } from "./types";
2
2
  export declare const AGY_QUOTA_SUMMARY_TOOL_NAME = "agy_quota_summary";
3
+ export declare const AGY_V2_QUOTA_SUMMARY_COMMAND = "agy-quota-summary";
4
+ export declare const AGY_V2_QUOTA_SUMMARY_COMMAND_TEMPLATE = "Retrieve Agy Code Assist quota summary (weekly and 5-hour limits by model group) for the current authenticated account.\n\nImmediately call `agy_quota_summary` with no arguments and return its output verbatim.\nDo not call other tools.\n";
3
5
  interface AgyQuotaSummaryToolDependencies {
4
6
  client: PluginClient;
5
7
  getAuthResolver: () => GetAuth | undefined;
@@ -1,5 +1,7 @@
1
1
  import type { GetAuth, PluginClient } from "./types";
2
2
  export declare const AGY_QUOTA_TOOL_NAME = "agy_quota";
3
+ export declare const AGY_V2_QUOTA_COMMAND = "agy-quota";
4
+ export declare const AGY_V2_QUOTA_COMMAND_TEMPLATE = "Retrieve Agy Code Assist quota usage for the current authenticated account.\n\nImmediately call `agy_quota` with no arguments and return its output verbatim.\nDo not call other tools.\n";
3
5
  interface AgyQuotaToolDependencies {
4
6
  client: PluginClient;
5
7
  getAuthResolver: () => GetAuth | undefined;
@@ -0,0 +1,28 @@
1
+ export interface SimpleStaticModel {
2
+ name: string;
3
+ description: string;
4
+ maxTokens: number;
5
+ maxOutputTokens: number;
6
+ toolCall: boolean;
7
+ reasoning: boolean;
8
+ attachment: boolean;
9
+ cost?: {
10
+ input: number;
11
+ output: number;
12
+ cache?: {
13
+ read: number;
14
+ write: number;
15
+ };
16
+ };
17
+ }
18
+ export declare const STATIC_MODELS_SIMPLE: Record<string, SimpleStaticModel>;
19
+ export declare const TIER_MAPPING: Record<string, {
20
+ low: string;
21
+ high: string;
22
+ medium?: string;
23
+ minimal?: string;
24
+ } & Record<string, string | undefined>>;
25
+ /**
26
+ * Resolves a model ID and optional request headers or suffix into the appropriate tier variant.
27
+ */
28
+ export declare function resolveModelTier(baseModelId: string, headersOrInit?: RequestInit | unknown): string;
@@ -0,0 +1 @@
1
+ export declare function createV2FetchInterceptor(getAuthSnapshot?: () => Promise<any> | any): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
@@ -0,0 +1,7 @@
1
+ export interface V2SessionHooksState {
2
+ lastInterceptedModel?: string;
3
+ }
4
+ export declare function createV2HttpRequestHook(state?: V2SessionHooksState): (event: any) => Promise<void>;
5
+ export declare function createV2HttpResponseHook(state?: V2SessionHooksState): (event: any) => Promise<void>;
6
+ export declare function createV2RetryHook(): (event: any) => Promise<void>;
7
+ export declare function registerV2SessionHooks(ctx: any): void;
@@ -0,0 +1,3 @@
1
+ export declare function setStoredAuthOverrideForTesting(override: any): void;
2
+ export declare function loadStoredAuthFromJson(): any;
3
+ export declare function saveStoredAuthToJson(authRecord: any): void;
@@ -1,22 +1,14 @@
1
+ import { AGY_V2_QUOTA_COMMAND, AGY_V2_QUOTA_COMMAND_TEMPLATE } from './quota';
2
+ import { AGY_V2_QUOTA_SUMMARY_COMMAND, AGY_V2_QUOTA_SUMMARY_COMMAND_TEMPLATE } from './quota-summary';
1
3
  import { type OpenCodeV2PluginContext, type OpenCodeV2PluginDefinition } from './types';
2
- export declare const AGY_V2_QUOTA_COMMAND = "agy-quota";
3
- export declare const AGY_V2_QUOTA_SUMMARY_COMMAND = "agy-quota-summary";
4
- export declare const AGY_V2_QUOTA_COMMAND_TEMPLATE = "Retrieve Agy Code Assist quota usage for the current authenticated account.\n\nImmediately call `agy_quota` with no arguments and return its output verbatim.\nDo not call other tools.\n";
5
- export declare const AGY_V2_QUOTA_SUMMARY_COMMAND_TEMPLATE = "Retrieve Agy Code Assist quota summary (weekly and 5-hour limits by model group) for the current authenticated account.\n\nImmediately call `agy_quota_summary` with no arguments and return its output verbatim.\nDo not call other tools.\n";
6
- export declare function getSafeHeader(headers: unknown, key: string): string | undefined;
7
- export declare function setSafeHeaders(initHeaders: unknown, newHeaders: Record<string, string>): unknown;
8
- export declare function toUrlString(value: RequestInfo): string;
9
- export declare function resolveModelTier(baseModelId: string, init?: RequestInit): string;
10
- export declare function setStoredAuthOverrideForTesting(override: any): void;
11
- export declare function loadStoredAuthFromJson(): any;
12
- export declare function saveStoredAuthToJson(authRecord: any): void;
13
- export declare function createV2FetchInterceptor(getAuthSnapshot?: () => Promise<any> | any): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
4
+ export { getSafeHeader, setSafeHeaders, toUrlString } from './headers';
5
+ export { resolveModelTier } from './tier';
6
+ export { loadStoredAuthFromJson, saveStoredAuthToJson, setStoredAuthOverrideForTesting, } from './v2-storage';
7
+ export { createV2FetchInterceptor } from './v2-fetch';
8
+ export { AGY_V2_QUOTA_COMMAND, AGY_V2_QUOTA_SUMMARY_COMMAND, AGY_V2_QUOTA_COMMAND_TEMPLATE, AGY_V2_QUOTA_SUMMARY_COMMAND_TEMPLATE, };
14
9
  /**
15
10
  * Setup adapter for OpenCode v2 plugin architecture.
16
11
  */
17
12
  export declare function setupOpenCodeV2(ctx: OpenCodeV2PluginContext): Promise<void>;
18
- /**
19
- * OpenCode v2 Plugin Definition
20
- */
21
13
  export declare const v2PluginDefinition: OpenCodeV2PluginDefinition;
22
14
  export declare const createV2PluginDefinition: () => OpenCodeV2PluginDefinition;
@@ -1,27 +1,6 @@
1
1
  import type { PluginContext, PluginResult } from './plugin/types';
2
- export interface SimpleStaticModel {
3
- name: string;
4
- description: string;
5
- maxTokens: number;
6
- maxOutputTokens: number;
7
- toolCall: boolean;
8
- reasoning: boolean;
9
- attachment: boolean;
10
- cost?: {
11
- input: number;
12
- output: number;
13
- cache?: {
14
- read: number;
15
- write: number;
16
- };
17
- };
18
- }
19
- export declare const STATIC_MODELS_SIMPLE: Record<string, SimpleStaticModel>;
20
- export declare const TIER_MAPPING: Record<string, {
21
- low: string;
22
- high: string;
23
- medium?: string;
24
- } & Record<string, string | undefined>>;
2
+ import { STATIC_MODELS_SIMPLE, TIER_MAPPING, resolveModelTier, type SimpleStaticModel } from './plugin/tier';
3
+ export { STATIC_MODELS_SIMPLE, TIER_MAPPING, resolveModelTier, type SimpleStaticModel };
25
4
  /**
26
5
  * Registers the Agy OAuth provider for Opencode.
27
6
  */
@@ -1 +1 @@
1
- export declare const AGY_CLI_VERSION = "1.2.6";
1
+ export declare const AGY_CLI_VERSION = "1.2.7";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anthonyhaussman/opencode-agy-auth",
3
- "version": "1.2.7-alpha.1",
3
+ "version": "1.2.7-alpha.3",
4
4
  "author": "antigravity",
5
5
  "repository": {
6
6
  "type": "git",