@aliou/pi-ts-aperture 0.5.1 → 0.6.1
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/README.md +119 -21
- package/extensions/aperture/dedicated/api-routing.ts +66 -0
- package/extensions/aperture/dedicated/model-defaults.ts +48 -0
- package/extensions/aperture/dedicated/runtime.ts +87 -0
- package/extensions/aperture/index.ts +79 -0
- package/extensions/aperture/onboarding/index.ts +25 -0
- package/extensions/aperture/onboarding/onboarding.ts +892 -0
- package/extensions/aperture/onboarding/setup-command.ts +53 -0
- package/extensions/aperture/onboarding/setup-wizard.ts +134 -0
- package/extensions/aperture/proxy/runtime.ts +164 -0
- package/extensions/aperture/settings-command.ts +369 -0
- package/extensions/aperture/shared/config/defaults.ts +17 -0
- package/extensions/aperture/shared/config/loader.ts +21 -0
- package/extensions/aperture/shared/config/migration/001-legacy-to-v0-6.ts +45 -0
- package/extensions/aperture/shared/config/migration/002-mode-to-capabilities.ts +20 -0
- package/extensions/aperture/shared/config/migration/003-normalize-capabilities.ts +26 -0
- package/extensions/aperture/shared/config/migration/index.ts +15 -0
- package/extensions/aperture/shared/config/types.ts +57 -0
- package/extensions/aperture/shared/sync-bus.ts +12 -0
- package/{src/lib → extensions/aperture/shared}/types.ts +2 -1
- package/package.json +37 -27
- package/src/api/client.ts +139 -0
- package/src/api/types.ts +26 -0
- package/src/provider-mapping.ts +91 -0
- package/src/url.ts +52 -0
- package/src/commands/settings.ts +0 -135
- package/src/commands/setup.ts +0 -232
- package/src/extension/runtime.test.ts +0 -121
- package/src/extension/runtime.ts +0 -144
- package/src/index.ts +0 -97
- package/src/lib/config.ts +0 -32
- package/src/lib/gateway.ts +0 -61
- package/src/lib/url.ts +0 -42
package/src/lib/url.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure URL helpers.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { ApertureConfig } from "./config";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Normalizes a user-input URL:
|
|
9
|
-
* - Trims whitespace
|
|
10
|
-
* - Adds http:// scheme if missing
|
|
11
|
-
* - Strips trailing /v1 or /v1/
|
|
12
|
-
* - Strips trailing slashes
|
|
13
|
-
*/
|
|
14
|
-
export function normalizeInputUrl(raw: string): string {
|
|
15
|
-
let result = raw.trim();
|
|
16
|
-
if (!result) return result;
|
|
17
|
-
if (!result.startsWith("http://") && !result.startsWith("https://")) {
|
|
18
|
-
result = `http://${result}`;
|
|
19
|
-
}
|
|
20
|
-
return result.replace(/\/v1\/?$/, "").replace(/\/+$/, "");
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Returns configured gateway URL without trailing slash.
|
|
25
|
-
* Returns null when baseUrl is empty or providers list is empty.
|
|
26
|
-
*/
|
|
27
|
-
export function resolveGatewayUrl(config: ApertureConfig): string | null {
|
|
28
|
-
const { baseUrl, providers } = config;
|
|
29
|
-
if (!baseUrl || providers?.length === 0) return null;
|
|
30
|
-
return baseUrl.replace(/\/+$/, "");
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Returns the Aperture provider base URL used for provider registration.
|
|
35
|
-
* Appends /v1 to the gateway URL.
|
|
36
|
-
* Returns null when gateway URL cannot be resolved.
|
|
37
|
-
*/
|
|
38
|
-
export function resolveProviderBaseUrl(config: ApertureConfig): string | null {
|
|
39
|
-
const gateway = resolveGatewayUrl(config);
|
|
40
|
-
if (!gateway) return null;
|
|
41
|
-
return `${gateway}/v1`;
|
|
42
|
-
}
|