@hyav/pi-provider 0.1.1 → 0.1.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.
- package/CHANGELOG.md +17 -1
- package/README.md +27 -6
- package/README.zh-CN.md +27 -6
- package/SECURITY.md +1 -1
- package/core/adapter-extensions.ts +14 -14
- package/core/adapter-loader.ts +99 -0
- package/core/adapter-protocol.ts +11 -11
- package/core/definition.ts +8 -8
- package/core/extension.ts +9 -9
- package/core/host.ts +30 -29
- package/core/official-pricing.ts +2 -6
- package/core/provider-registration.ts +5 -5
- package/core/public-adapters.ts +46 -0
- package/core/runtime-config.ts +110 -26
- package/core/runtime-entry.ts +26 -0
- package/core/runtime.ts +33 -27
- package/core/status-report.ts +2 -2
- package/core/types.ts +11 -1
- package/index.ts +56 -13
- package/package.json +8 -8
- package/preflight/charm-hyper.ts +2 -4
- package/preflight/deepseek.ts +2 -4
- package/preflight/google.ts +2 -4
- package/preflight/openai-codex.ts +2 -4
- package/preflight/opencode-go.ts +2 -3
- package/preflight/opencode.ts +2 -3
- package/providers/charm-hyper.ts +8 -5
- package/status/charm-hyper.ts +2 -4
- package/status/deepseek.ts +2 -4
- package/status/openai-codex.ts +2 -4
- package/status/opencode-go.ts +2 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyav/pi-provider",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Provider extension toolkit for Pi to integrate and manage custom LLM providers with dynamic models, request tuners, and account status.",
|
|
5
5
|
"author": "hyav",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"pi-package",
|
|
26
26
|
"pi",
|
|
27
27
|
"provider",
|
|
28
|
-
"provider
|
|
28
|
+
"pi-provider",
|
|
29
29
|
"charm-hyper",
|
|
30
30
|
"llm"
|
|
31
31
|
],
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"audit:all": "npm audit --audit-level=high",
|
|
38
38
|
"artifact:check": "node scripts/check-package.mjs",
|
|
39
39
|
"release:check": "node scripts/check-release.mjs",
|
|
40
|
+
"release:notes": "node scripts/write-release-notes.mjs",
|
|
40
41
|
"prepublishOnly": "npm run audit:runtime && npm run audit:all && npm run release:check && npm run check && npm test && npm run artifact:check"
|
|
41
42
|
},
|
|
42
43
|
"engines": {
|
|
@@ -56,11 +57,7 @@
|
|
|
56
57
|
},
|
|
57
58
|
"pi": {
|
|
58
59
|
"extensions": [
|
|
59
|
-
"./index.ts"
|
|
60
|
-
"./providers/*.ts",
|
|
61
|
-
"./status/*.ts",
|
|
62
|
-
"./preflight/*.ts",
|
|
63
|
-
"./tuners/*.ts"
|
|
60
|
+
"./index.ts"
|
|
64
61
|
]
|
|
65
62
|
},
|
|
66
63
|
"files": [
|
|
@@ -77,5 +74,8 @@
|
|
|
77
74
|
"SECURITY.md",
|
|
78
75
|
"SUPPORT.md",
|
|
79
76
|
"LICENSE"
|
|
80
|
-
]
|
|
77
|
+
],
|
|
78
|
+
"dependencies": {
|
|
79
|
+
"jiti": "2.7.0"
|
|
80
|
+
}
|
|
81
81
|
}
|
package/preflight/charm-hyper.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ProviderDataError } from "
|
|
3
|
-
import type { PreflightAdapter } from "../core/preflight-manager.ts";
|
|
4
|
-
import { parseRetryAfter } from "../core/retry-after.ts";
|
|
1
|
+
import type { PreflightAdapter } from "@hyav/pi-provider";
|
|
2
|
+
import { definePreflightExtension, ProviderDataError, parseRetryAfter } from "@hyav/pi-provider";
|
|
5
3
|
import { hyperJsonHeaders } from "../providers/charm-hyper/constants.ts";
|
|
6
4
|
import { HYPER_MODELS_URL, HYPER_PROVIDER_URL, parseHyperModels } from "../providers/charm-hyper.ts";
|
|
7
5
|
|
package/preflight/deepseek.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ProviderDataError } from "
|
|
3
|
-
import type { PreflightAdapter } from "../core/preflight-manager.ts";
|
|
4
|
-
import { parseRetryAfter } from "../core/retry-after.ts";
|
|
1
|
+
import type { PreflightAdapter } from "@hyav/pi-provider";
|
|
2
|
+
import { definePreflightExtension, ProviderDataError, parseRetryAfter } from "@hyav/pi-provider";
|
|
5
3
|
|
|
6
4
|
export const DEEPSEEK_MODELS_URL = "https://api.deepseek.com/models";
|
|
7
5
|
|
package/preflight/google.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ProviderDataError } from "
|
|
3
|
-
import type { PreflightAdapter } from "../core/preflight-manager.ts";
|
|
4
|
-
import { parseRetryAfter } from "../core/retry-after.ts";
|
|
1
|
+
import type { PreflightAdapter } from "@hyav/pi-provider";
|
|
2
|
+
import { definePreflightExtension, ProviderDataError, parseRetryAfter } from "@hyav/pi-provider";
|
|
5
3
|
|
|
6
4
|
export const GOOGLE_MODELS_URL = "https://generativelanguage.googleapis.com/v1beta/models";
|
|
7
5
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ProviderDataError } from "
|
|
3
|
-
import type { PreflightAdapter } from "../core/preflight-manager.ts";
|
|
4
|
-
import { parseRetryAfter } from "../core/retry-after.ts";
|
|
1
|
+
import type { PreflightAdapter } from "@hyav/pi-provider";
|
|
2
|
+
import { definePreflightExtension, ProviderDataError, parseRetryAfter } from "@hyav/pi-provider";
|
|
5
3
|
import { extractCodexAccountId } from "../status/openai-codex.ts";
|
|
6
4
|
|
|
7
5
|
export const CODEX_MODELS_URL = "https://chatgpt.com/backend-api/codex/models";
|
package/preflight/opencode-go.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createOpenCodeCatalogPreflightAdapter } from "
|
|
3
|
-
import type { PreflightAdapter } from "../core/preflight-manager.ts";
|
|
1
|
+
import type { PreflightAdapter } from "@hyav/pi-provider";
|
|
2
|
+
import { createOpenCodeCatalogPreflightAdapter, definePreflightExtension } from "@hyav/pi-provider";
|
|
4
3
|
|
|
5
4
|
export const OPENCODE_GO_MODELS_URL = "https://opencode.ai/zen/go/v1/models";
|
|
6
5
|
|
package/preflight/opencode.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createOpenCodeCatalogPreflightAdapter } from "
|
|
3
|
-
import type { PreflightAdapter } from "../core/preflight-manager.ts";
|
|
1
|
+
import type { PreflightAdapter } from "@hyav/pi-provider";
|
|
2
|
+
import { createOpenCodeCatalogPreflightAdapter, definePreflightExtension } from "@hyav/pi-provider";
|
|
4
3
|
|
|
5
4
|
export const OPENCODE_MODELS_URL = "https://opencode.ai/zen/v1/models";
|
|
6
5
|
|
package/providers/charm-hyper.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import { defineProviderExtension } from "../core/adapter-extensions.ts";
|
|
2
|
-
import { withDeadline } from "../core/deadline.ts";
|
|
3
|
-
import { isProviderDataError, ProviderDataError } from "../core/errors.ts";
|
|
4
|
-
import { normalizeProviderModels } from "../core/provider-registration.ts";
|
|
5
1
|
import type {
|
|
6
2
|
ModelCatalogStatus,
|
|
7
3
|
ProviderAdapter,
|
|
@@ -9,7 +5,14 @@ import type {
|
|
|
9
5
|
ProviderModelDraft,
|
|
10
6
|
ProviderRefreshContext,
|
|
11
7
|
ThinkingLevel,
|
|
12
|
-
} from "
|
|
8
|
+
} from "@hyav/pi-provider";
|
|
9
|
+
import {
|
|
10
|
+
defineProviderExtension,
|
|
11
|
+
isProviderDataError,
|
|
12
|
+
normalizeProviderModels,
|
|
13
|
+
ProviderDataError,
|
|
14
|
+
withDeadline,
|
|
15
|
+
} from "@hyav/pi-provider";
|
|
13
16
|
import { HYPER_BASE_URL, HYPER_USER_AGENT, hyperJsonHeaders } from "./charm-hyper/constants.ts";
|
|
14
17
|
import { createCharmHyperOAuth } from "./charm-hyper/oauth.ts";
|
|
15
18
|
|
package/status/charm-hyper.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ProviderDataError } from "
|
|
3
|
-
import { parseRetryAfter } from "../core/retry-after.ts";
|
|
4
|
-
import type { StatusAdapter, StatusSnapshot } from "../core/types.ts";
|
|
1
|
+
import type { StatusAdapter, StatusSnapshot } from "@hyav/pi-provider";
|
|
2
|
+
import { defineStatusExtension, ProviderDataError, parseRetryAfter } from "@hyav/pi-provider";
|
|
5
3
|
import { hyperJsonHeaders } from "../providers/charm-hyper/constants.ts";
|
|
6
4
|
|
|
7
5
|
const CREDITS_URL = "https://hyper.charm.land/v1/credits";
|
package/status/deepseek.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ProviderDataError } from "
|
|
3
|
-
import { parseRetryAfter } from "../core/retry-after.ts";
|
|
4
|
-
import type { StatusAdapter, StatusSnapshot } from "../core/types.ts";
|
|
1
|
+
import type { StatusAdapter, StatusSnapshot } from "@hyav/pi-provider";
|
|
2
|
+
import { defineStatusExtension, ProviderDataError, parseRetryAfter } from "@hyav/pi-provider";
|
|
5
3
|
|
|
6
4
|
export const DEEPSEEK_BALANCE_URL = "https://api.deepseek.com/user/balance";
|
|
7
5
|
|
package/status/openai-codex.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ProviderDataError } from "
|
|
3
|
-
import { parseRetryAfter } from "../core/retry-after.ts";
|
|
4
|
-
import type { StatusAdapter, StatusEntry, StatusSnapshot } from "../core/types.ts";
|
|
1
|
+
import type { StatusAdapter, StatusEntry, StatusSnapshot } from "@hyav/pi-provider";
|
|
2
|
+
import { defineStatusExtension, ProviderDataError, parseRetryAfter } from "@hyav/pi-provider";
|
|
5
3
|
|
|
6
4
|
export const CODEX_USAGE_URL = "https://chatgpt.com/backend-api/wham/usage";
|
|
7
5
|
const ACCOUNT_ID_CLAIM = "https://api.openai.com/auth";
|
package/status/opencode-go.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ProviderDataError } from "
|
|
3
|
-
import { parseRetryAfter } from "../core/retry-after.ts";
|
|
4
|
-
import type { StatusAdapter, StatusEntry, StatusSnapshot } from "../core/types.ts";
|
|
1
|
+
import type { StatusAdapter, StatusEntry, StatusSnapshot } from "@hyav/pi-provider";
|
|
2
|
+
import { defineStatusExtension, ProviderDataError, parseRetryAfter } from "@hyav/pi-provider";
|
|
5
3
|
|
|
6
4
|
export const OPENCODE_GO_USAGE_URL = "https://opencode.ai/zen/go/v1/usage";
|
|
7
5
|
|