@serviceme/devtools-shared 0.4.10 → 0.4.12
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/index.d.mts +127 -11
- package/dist/index.d.ts +127 -11
- package/dist/index.js +144 -1
- package/dist/index.mjs +140 -1
- package/package.json +6 -3
package/dist/index.d.mts
CHANGED
|
@@ -929,6 +929,67 @@ interface CertificateBundleEnvironmentSupport {
|
|
|
929
929
|
defaultPassword: string;
|
|
930
930
|
}
|
|
931
931
|
|
|
932
|
+
/**
|
|
933
|
+
* Medalsoft-internal infrastructure addresses.
|
|
934
|
+
*
|
|
935
|
+
* These are **private-network only** endpoints — reachable from the
|
|
936
|
+
* company LAN/VPN, NOT from the public internet. External users must
|
|
937
|
+
* use the public equivalents (`nexus.servicemecloud.com`, …). Keeping
|
|
938
|
+
* them as named constants here (instead of inlined literals) gives a
|
|
939
|
+
* single place to update when the internal fleet moves, and makes the
|
|
940
|
+
* "this is an internal address" intent explicit at every use site.
|
|
941
|
+
*
|
|
942
|
+
* NOTE: `packages/serviceme-core` keeps its own copies of the ones it
|
|
943
|
+
* needs — ADL-003 forbids core → shared. Keep those in lock-step.
|
|
944
|
+
*/
|
|
945
|
+
/** Medalsoft 内网 LLM 网关(OpenAI-compatible `/v1`),仅办公网可达。 */
|
|
946
|
+
declare const MEDALSOFT_PRIVATE_GATEWAY_URL = "http://10.10.10.249:3000/v1";
|
|
947
|
+
/** Medalsoft 私有 NuGet 源,仅办公网可达。 */
|
|
948
|
+
declare const MEDALSOFT_NUGET_PRIVATE_SOURCE = "http://192.168.20.209:10010/nuget";
|
|
949
|
+
|
|
950
|
+
/**
|
|
951
|
+
* Device-auth wire contract shared by the extension (signer) and the
|
|
952
|
+
* server (verifier).
|
|
953
|
+
*
|
|
954
|
+
* Single source of truth for the `x-ms-device-*` header names and the
|
|
955
|
+
* HMAC-SHA-256 request-signature algorithm. Previously the same
|
|
956
|
+
* constants + function were copy-pasted in three places
|
|
957
|
+
* (extension `services/device/deviceAuth.ts`, core `device/deviceAuth.ts`,
|
|
958
|
+
* server `lib/auth/device-signature-guard.ts`) and kept in sync by
|
|
959
|
+
* comments alone. Server and extension now import from here.
|
|
960
|
+
*
|
|
961
|
+
* NOTE: `packages/serviceme-core/src/device/deviceAuth.ts` keeps its own
|
|
962
|
+
* copy — ADL-003 forbids core → shared (and shared → core) so the core
|
|
963
|
+
* copy is a documented boundary exception. Keep it in lock-step with
|
|
964
|
+
* this file. See `docs/architecture/phase-5-device-header-spec.md` §5
|
|
965
|
+
* for the wire format.
|
|
966
|
+
*/
|
|
967
|
+
/** Canonical header names — MUST match the server's verifier. */
|
|
968
|
+
declare const DeviceAuthHeaders: {
|
|
969
|
+
readonly deviceId: "x-ms-device-id";
|
|
970
|
+
readonly deviceSecret: "x-ms-device-secret";
|
|
971
|
+
readonly signature: "x-ms-device-signature";
|
|
972
|
+
readonly timestamp: "x-ms-device-timestamp";
|
|
973
|
+
readonly secretVersion: "x-ms-device-secret-version";
|
|
974
|
+
};
|
|
975
|
+
interface DeviceRequestSignatureParams {
|
|
976
|
+
method: string;
|
|
977
|
+
path: string;
|
|
978
|
+
timestamp: number;
|
|
979
|
+
body: string;
|
|
980
|
+
secret: string;
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* Basis is `METHOD\nPATH\nTIMESTAMP\nBODY\nSECRET` (LF-joined, NOT JSON).
|
|
984
|
+
* Output is lowercase hex SHA-256.
|
|
985
|
+
*
|
|
986
|
+
* Uses `js-sha256` (pure JS, synchronous, browser + Node) instead of
|
|
987
|
+
* `node:crypto` so this module stays importable from the webview (the
|
|
988
|
+
* shared barrel is consumed by browser bundles — `node:crypto` breaks
|
|
989
|
+
* the vite/rollup build).
|
|
990
|
+
*/
|
|
991
|
+
declare function createDeviceRequestSignature(params: DeviceRequestSignatureParams): string;
|
|
992
|
+
|
|
932
993
|
/**
|
|
933
994
|
* Git URL Utilities
|
|
934
995
|
*
|
|
@@ -1299,6 +1360,52 @@ interface BridgeRepoSyncPull {
|
|
|
1299
1360
|
error?: string;
|
|
1300
1361
|
}
|
|
1301
1362
|
|
|
1363
|
+
/**
|
|
1364
|
+
* Webview ↔ extension message-contract types.
|
|
1365
|
+
*
|
|
1366
|
+
* These three payload shapes travel across the postMessage boundary
|
|
1367
|
+
* (broadcast messages like `updateExternalTools` / `updateAzureProfiles`
|
|
1368
|
+
* / `updateApiConfig`). They used to live in
|
|
1369
|
+
* `apps/webview-ui/src/types` only — the extension-side handlers typed
|
|
1370
|
+
* them implicitly via `data` destructuring, so the contract was
|
|
1371
|
+
* duplicated by convention and drifted silently. Moving them here makes
|
|
1372
|
+
* `@serviceme/devtools-shared` the single source of truth, and lets the
|
|
1373
|
+
* `WebviewInboundMessage` discriminated union (messages.ts) type the
|
|
1374
|
+
* corresponding broadcast variants without a `as` cast at the consumer.
|
|
1375
|
+
*
|
|
1376
|
+
* NOTE: `apps/webview-ui/src/types/index.ts` re-exports these so
|
|
1377
|
+
* existing webview imports keep working unchanged.
|
|
1378
|
+
*/
|
|
1379
|
+
interface ExternalTool {
|
|
1380
|
+
id: string;
|
|
1381
|
+
name: string;
|
|
1382
|
+
url: string;
|
|
1383
|
+
description?: string;
|
|
1384
|
+
icon?: string;
|
|
1385
|
+
isDefault?: boolean;
|
|
1386
|
+
}
|
|
1387
|
+
interface AzureProfile {
|
|
1388
|
+
id: string;
|
|
1389
|
+
name: string;
|
|
1390
|
+
method: "FTP" | "MSDeploy";
|
|
1391
|
+
host: string;
|
|
1392
|
+
username?: string;
|
|
1393
|
+
password?: string;
|
|
1394
|
+
remotePath?: string;
|
|
1395
|
+
port?: number;
|
|
1396
|
+
}
|
|
1397
|
+
interface ApiConfig {
|
|
1398
|
+
schemaPath: string;
|
|
1399
|
+
requestLibPath?: string;
|
|
1400
|
+
projectName?: string;
|
|
1401
|
+
namespace?: string;
|
|
1402
|
+
serversPath?: string;
|
|
1403
|
+
apiPrefix?: string;
|
|
1404
|
+
mock?: boolean;
|
|
1405
|
+
templatesFolder?: string;
|
|
1406
|
+
enumStyle?: "string-literal" | "enum";
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1302
1409
|
declare enum WebviewMessageType {
|
|
1303
1410
|
WebviewReady = "webviewReady",
|
|
1304
1411
|
Ready = "ready",
|
|
@@ -1645,18 +1752,15 @@ interface ByomProviderToggles {
|
|
|
1645
1752
|
cacheEnabled: boolean;
|
|
1646
1753
|
}
|
|
1647
1754
|
/**
|
|
1648
|
-
* Strict-typed shape for the inbound messages
|
|
1649
|
-
* `useAppMessages`.
|
|
1650
|
-
*
|
|
1651
|
-
*
|
|
1652
|
-
* `
|
|
1653
|
-
*
|
|
1654
|
-
* `apps/webview-ui/src/types` (ExternalTool, AzureProfile, ApiConfig) stay
|
|
1655
|
-
* on the enum path for now — moving those types into `@serviceme/devtools-shared` is
|
|
1656
|
-
* its own refactor and not in scope.
|
|
1755
|
+
* Strict-typed shape for the inbound messages handled by
|
|
1756
|
+
* `useAppMessages`. Covers the 8 variants whose payload types now live
|
|
1757
|
+
* in `@serviceme/devtools-shared` (`webview-contract.ts` holds the
|
|
1758
|
+
* ExternalTool / AzureProfile / ApiConfig shapes). The string-keyed
|
|
1759
|
+
* `WebviewMessageType` enum stays in place for the remaining enum-path
|
|
1760
|
+
* call sites across `apps/webview-ui` and `apps/extension`.
|
|
1657
1761
|
*
|
|
1658
1762
|
* Each variant lists ONLY the fields the hook actually reads; optional
|
|
1659
|
-
* fields are explicit (`
|
|
1763
|
+
* fields are explicit (`tools?` / `profiles?` / `workspaceOpen`).
|
|
1660
1764
|
*/
|
|
1661
1765
|
type WebviewInboundMessage = {
|
|
1662
1766
|
type: typeof WebviewMessageType.UpdateRepositoryList;
|
|
@@ -1672,6 +1776,18 @@ type WebviewInboundMessage = {
|
|
|
1672
1776
|
type: typeof WebviewMessageType.UpdateLinkedSkills;
|
|
1673
1777
|
links: LinkedSkillPayloadEntry[];
|
|
1674
1778
|
kind: "skill" | "agent";
|
|
1779
|
+
} | {
|
|
1780
|
+
type: typeof WebviewMessageType.UpdateExternalTools;
|
|
1781
|
+
tools?: ExternalTool[];
|
|
1782
|
+
} | {
|
|
1783
|
+
type: typeof WebviewMessageType.UpdateNgrokStatus;
|
|
1784
|
+
isRunning: boolean;
|
|
1785
|
+
} | {
|
|
1786
|
+
type: typeof WebviewMessageType.UpdateAzureProfiles;
|
|
1787
|
+
profiles?: AzureProfile[];
|
|
1788
|
+
} | {
|
|
1789
|
+
type: typeof WebviewMessageType.UpdateApiConfig;
|
|
1790
|
+
config: ApiConfig;
|
|
1675
1791
|
};
|
|
1676
1792
|
/**
|
|
1677
1793
|
* One entry inside the `UpdateLinkedSkills.links` array. Mirrors the
|
|
@@ -1744,4 +1860,4 @@ declare function asAbortSignal(input: unknown): AbortSignal | undefined;
|
|
|
1744
1860
|
*/
|
|
1745
1861
|
declare function safeJson<T>(text: string, fallback: T): T;
|
|
1746
1862
|
|
|
1747
|
-
export { type AIModelConfig, type AIModelInfo, type AgentPermissionSummary, type AgentToolPermission, type AgentToolRiskLevel, BUILTIN_PROVIDER_PRESETS, type BalanceEntry, type BridgeLinkMode, type BridgeLinkedSkill, type BridgeRepoEntry, type BridgeRepoSyncPull, type BridgeSkillKind, type BridgeSkillRepoEntry, type BridgeSkillRepoFile, type ByomProviderToggles, ByomSettingsResponse, type ByomSettingsSnapshot, type ByomTogglePayload, CERTIFICATE_BUNDLE_FORMATS, CachedServerUrlResponse, type CachedServerUrlSnapshot, type CertificateBundleEnvironmentSupport, type CertificateBundleFormat, type CertificateBundleFormatDescriptor, type CodingPlanUsage, type CommandPayload, type CuratedModelMetadata, type DeepseekBalanceEntry, type DeepseekUsage, type DownloadCertificateBundleRequest, type DownloadCertificateBundleResponse, GIT_REMOTE_HOST_ALIASES, type GenericBalanceUsage, GetByomSettings, GetCachedServerUrl, GetServerProxyState, GetUtilityModels, type GitHubOrgMembershipCheckResult, type GitHubOrgMembershipStatus, type GitHubUser, type GithubCopilotCliPayload, type HttpRequestPayload, type ILogger, LISTABLE_PRESET_MODELS, type LinkedSkillPayloadEntry, LogLevel, MODEL_METADATA, type MinimaxUsage, type ModelDetail, type ModelPriceCategory, type ModelPricing, type ModelThinkingSchema, NAMESPACE_ALIASES, NAMESPACE_ALIAS_FAMILY, PRESET_MODEL_FAMILIES, PROVIDER_BASE_URL_PRESETS, PROVIDER_CACHE_CONTROL_METADATA, type PresetModelFamilyGroup, type PresetModelListing, type ProviderBaseUrlPreset, type ProviderCacheControlMetadata, type ProviderConfig, type ProviderModel, type ProviderMutationPayload, type ProviderTestResult, type ProviderType, type ProviderUsageData, type ProviderUsageKind, type ProviderUsageResult, type ProviderVisionMode, type ProviderWireProtocol, type ProvidersResponsePayload, type PublicProvider, type ScheduledTask, type ScheduledTaskType, type ScheduledTaskV1, type ScheduledTasksConfig, type ScheduledTasksLogFile, type ServerProxyAllowOverridePayload, type ServerProxySnapshot, ServerProxyStateResponse, type ServerProxySupportMode, type ServerProxyTogglePayload, SetCacheControlEnabled, SetServerProxyAllowOverride, SetServerProxyEnabled, type ShellPayload, type TaskExecutionLog, type TaskExecutionState, type TaskExecutionStatus, type TaskPayload, type TaskRunStatus, type TaskWorkspaceRef, UpdateUtilityModels, type UpdateUtilityModelsPayload, type UsageWindow, type UtilityModelScope, type UtilityModelsEffective, UtilityModelsResponse, type UtilityModelsSnapshot, type UtilityModelsSource, type WebviewInboundMessage, WebviewMessageType, __internal, asAbortSignal, buildGitHubLocalEmail, buildPresetModel, checkGitHubOrgMembership, createConsoleLogger, currencyForBaseUrl, effectiveAdapterType, fetchGitHubUser, getBuiltinProviderPreset, getGitHubOrgMembership, getPresetModelDisplayName, getProviderBaseUrlPresets, isGitHubLocalEmail, isProviderCacheControlAware, isValidCanonicalSlug, listPresetModelGroups, lookupModelMetadata, normalizeCanonicalSlug, normalizeErrorForLog, normalizeGitUrl, parsePayload, protocolForBaseUrl, resolvePrimaryEmail, safeJson, unionProviderModelWithPreset };
|
|
1863
|
+
export { type AIModelConfig, type AIModelInfo, type AgentPermissionSummary, type AgentToolPermission, type AgentToolRiskLevel, type ApiConfig, type AzureProfile, BUILTIN_PROVIDER_PRESETS, type BalanceEntry, type BridgeLinkMode, type BridgeLinkedSkill, type BridgeRepoEntry, type BridgeRepoSyncPull, type BridgeSkillKind, type BridgeSkillRepoEntry, type BridgeSkillRepoFile, type ByomProviderToggles, ByomSettingsResponse, type ByomSettingsSnapshot, type ByomTogglePayload, CERTIFICATE_BUNDLE_FORMATS, CachedServerUrlResponse, type CachedServerUrlSnapshot, type CertificateBundleEnvironmentSupport, type CertificateBundleFormat, type CertificateBundleFormatDescriptor, type CodingPlanUsage, type CommandPayload, type CuratedModelMetadata, type DeepseekBalanceEntry, type DeepseekUsage, DeviceAuthHeaders, type DeviceRequestSignatureParams, type DownloadCertificateBundleRequest, type DownloadCertificateBundleResponse, type ExternalTool, GIT_REMOTE_HOST_ALIASES, type GenericBalanceUsage, GetByomSettings, GetCachedServerUrl, GetServerProxyState, GetUtilityModels, type GitHubOrgMembershipCheckResult, type GitHubOrgMembershipStatus, type GitHubUser, type GithubCopilotCliPayload, type HttpRequestPayload, type ILogger, LISTABLE_PRESET_MODELS, type LinkedSkillPayloadEntry, LogLevel, MEDALSOFT_NUGET_PRIVATE_SOURCE, MEDALSOFT_PRIVATE_GATEWAY_URL, MODEL_METADATA, type MinimaxUsage, type ModelDetail, type ModelPriceCategory, type ModelPricing, type ModelThinkingSchema, NAMESPACE_ALIASES, NAMESPACE_ALIAS_FAMILY, PRESET_MODEL_FAMILIES, PROVIDER_BASE_URL_PRESETS, PROVIDER_CACHE_CONTROL_METADATA, type PresetModelFamilyGroup, type PresetModelListing, type ProviderBaseUrlPreset, type ProviderCacheControlMetadata, type ProviderConfig, type ProviderModel, type ProviderMutationPayload, type ProviderTestResult, type ProviderType, type ProviderUsageData, type ProviderUsageKind, type ProviderUsageResult, type ProviderVisionMode, type ProviderWireProtocol, type ProvidersResponsePayload, type PublicProvider, type ScheduledTask, type ScheduledTaskType, type ScheduledTaskV1, type ScheduledTasksConfig, type ScheduledTasksLogFile, type ServerProxyAllowOverridePayload, type ServerProxySnapshot, ServerProxyStateResponse, type ServerProxySupportMode, type ServerProxyTogglePayload, SetCacheControlEnabled, SetServerProxyAllowOverride, SetServerProxyEnabled, type ShellPayload, type TaskExecutionLog, type TaskExecutionState, type TaskExecutionStatus, type TaskPayload, type TaskRunStatus, type TaskWorkspaceRef, UpdateUtilityModels, type UpdateUtilityModelsPayload, type UsageWindow, type UtilityModelScope, type UtilityModelsEffective, UtilityModelsResponse, type UtilityModelsSnapshot, type UtilityModelsSource, type WebviewInboundMessage, WebviewMessageType, __internal, asAbortSignal, buildGitHubLocalEmail, buildPresetModel, checkGitHubOrgMembership, createConsoleLogger, createDeviceRequestSignature, currencyForBaseUrl, effectiveAdapterType, fetchGitHubUser, getBuiltinProviderPreset, getGitHubOrgMembership, getPresetModelDisplayName, getProviderBaseUrlPresets, isGitHubLocalEmail, isProviderCacheControlAware, isValidCanonicalSlug, listPresetModelGroups, lookupModelMetadata, normalizeCanonicalSlug, normalizeErrorForLog, normalizeGitUrl, parsePayload, protocolForBaseUrl, resolvePrimaryEmail, safeJson, unionProviderModelWithPreset };
|
package/dist/index.d.ts
CHANGED
|
@@ -929,6 +929,67 @@ interface CertificateBundleEnvironmentSupport {
|
|
|
929
929
|
defaultPassword: string;
|
|
930
930
|
}
|
|
931
931
|
|
|
932
|
+
/**
|
|
933
|
+
* Medalsoft-internal infrastructure addresses.
|
|
934
|
+
*
|
|
935
|
+
* These are **private-network only** endpoints — reachable from the
|
|
936
|
+
* company LAN/VPN, NOT from the public internet. External users must
|
|
937
|
+
* use the public equivalents (`nexus.servicemecloud.com`, …). Keeping
|
|
938
|
+
* them as named constants here (instead of inlined literals) gives a
|
|
939
|
+
* single place to update when the internal fleet moves, and makes the
|
|
940
|
+
* "this is an internal address" intent explicit at every use site.
|
|
941
|
+
*
|
|
942
|
+
* NOTE: `packages/serviceme-core` keeps its own copies of the ones it
|
|
943
|
+
* needs — ADL-003 forbids core → shared. Keep those in lock-step.
|
|
944
|
+
*/
|
|
945
|
+
/** Medalsoft 内网 LLM 网关(OpenAI-compatible `/v1`),仅办公网可达。 */
|
|
946
|
+
declare const MEDALSOFT_PRIVATE_GATEWAY_URL = "http://10.10.10.249:3000/v1";
|
|
947
|
+
/** Medalsoft 私有 NuGet 源,仅办公网可达。 */
|
|
948
|
+
declare const MEDALSOFT_NUGET_PRIVATE_SOURCE = "http://192.168.20.209:10010/nuget";
|
|
949
|
+
|
|
950
|
+
/**
|
|
951
|
+
* Device-auth wire contract shared by the extension (signer) and the
|
|
952
|
+
* server (verifier).
|
|
953
|
+
*
|
|
954
|
+
* Single source of truth for the `x-ms-device-*` header names and the
|
|
955
|
+
* HMAC-SHA-256 request-signature algorithm. Previously the same
|
|
956
|
+
* constants + function were copy-pasted in three places
|
|
957
|
+
* (extension `services/device/deviceAuth.ts`, core `device/deviceAuth.ts`,
|
|
958
|
+
* server `lib/auth/device-signature-guard.ts`) and kept in sync by
|
|
959
|
+
* comments alone. Server and extension now import from here.
|
|
960
|
+
*
|
|
961
|
+
* NOTE: `packages/serviceme-core/src/device/deviceAuth.ts` keeps its own
|
|
962
|
+
* copy — ADL-003 forbids core → shared (and shared → core) so the core
|
|
963
|
+
* copy is a documented boundary exception. Keep it in lock-step with
|
|
964
|
+
* this file. See `docs/architecture/phase-5-device-header-spec.md` §5
|
|
965
|
+
* for the wire format.
|
|
966
|
+
*/
|
|
967
|
+
/** Canonical header names — MUST match the server's verifier. */
|
|
968
|
+
declare const DeviceAuthHeaders: {
|
|
969
|
+
readonly deviceId: "x-ms-device-id";
|
|
970
|
+
readonly deviceSecret: "x-ms-device-secret";
|
|
971
|
+
readonly signature: "x-ms-device-signature";
|
|
972
|
+
readonly timestamp: "x-ms-device-timestamp";
|
|
973
|
+
readonly secretVersion: "x-ms-device-secret-version";
|
|
974
|
+
};
|
|
975
|
+
interface DeviceRequestSignatureParams {
|
|
976
|
+
method: string;
|
|
977
|
+
path: string;
|
|
978
|
+
timestamp: number;
|
|
979
|
+
body: string;
|
|
980
|
+
secret: string;
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* Basis is `METHOD\nPATH\nTIMESTAMP\nBODY\nSECRET` (LF-joined, NOT JSON).
|
|
984
|
+
* Output is lowercase hex SHA-256.
|
|
985
|
+
*
|
|
986
|
+
* Uses `js-sha256` (pure JS, synchronous, browser + Node) instead of
|
|
987
|
+
* `node:crypto` so this module stays importable from the webview (the
|
|
988
|
+
* shared barrel is consumed by browser bundles — `node:crypto` breaks
|
|
989
|
+
* the vite/rollup build).
|
|
990
|
+
*/
|
|
991
|
+
declare function createDeviceRequestSignature(params: DeviceRequestSignatureParams): string;
|
|
992
|
+
|
|
932
993
|
/**
|
|
933
994
|
* Git URL Utilities
|
|
934
995
|
*
|
|
@@ -1299,6 +1360,52 @@ interface BridgeRepoSyncPull {
|
|
|
1299
1360
|
error?: string;
|
|
1300
1361
|
}
|
|
1301
1362
|
|
|
1363
|
+
/**
|
|
1364
|
+
* Webview ↔ extension message-contract types.
|
|
1365
|
+
*
|
|
1366
|
+
* These three payload shapes travel across the postMessage boundary
|
|
1367
|
+
* (broadcast messages like `updateExternalTools` / `updateAzureProfiles`
|
|
1368
|
+
* / `updateApiConfig`). They used to live in
|
|
1369
|
+
* `apps/webview-ui/src/types` only — the extension-side handlers typed
|
|
1370
|
+
* them implicitly via `data` destructuring, so the contract was
|
|
1371
|
+
* duplicated by convention and drifted silently. Moving them here makes
|
|
1372
|
+
* `@serviceme/devtools-shared` the single source of truth, and lets the
|
|
1373
|
+
* `WebviewInboundMessage` discriminated union (messages.ts) type the
|
|
1374
|
+
* corresponding broadcast variants without a `as` cast at the consumer.
|
|
1375
|
+
*
|
|
1376
|
+
* NOTE: `apps/webview-ui/src/types/index.ts` re-exports these so
|
|
1377
|
+
* existing webview imports keep working unchanged.
|
|
1378
|
+
*/
|
|
1379
|
+
interface ExternalTool {
|
|
1380
|
+
id: string;
|
|
1381
|
+
name: string;
|
|
1382
|
+
url: string;
|
|
1383
|
+
description?: string;
|
|
1384
|
+
icon?: string;
|
|
1385
|
+
isDefault?: boolean;
|
|
1386
|
+
}
|
|
1387
|
+
interface AzureProfile {
|
|
1388
|
+
id: string;
|
|
1389
|
+
name: string;
|
|
1390
|
+
method: "FTP" | "MSDeploy";
|
|
1391
|
+
host: string;
|
|
1392
|
+
username?: string;
|
|
1393
|
+
password?: string;
|
|
1394
|
+
remotePath?: string;
|
|
1395
|
+
port?: number;
|
|
1396
|
+
}
|
|
1397
|
+
interface ApiConfig {
|
|
1398
|
+
schemaPath: string;
|
|
1399
|
+
requestLibPath?: string;
|
|
1400
|
+
projectName?: string;
|
|
1401
|
+
namespace?: string;
|
|
1402
|
+
serversPath?: string;
|
|
1403
|
+
apiPrefix?: string;
|
|
1404
|
+
mock?: boolean;
|
|
1405
|
+
templatesFolder?: string;
|
|
1406
|
+
enumStyle?: "string-literal" | "enum";
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1302
1409
|
declare enum WebviewMessageType {
|
|
1303
1410
|
WebviewReady = "webviewReady",
|
|
1304
1411
|
Ready = "ready",
|
|
@@ -1645,18 +1752,15 @@ interface ByomProviderToggles {
|
|
|
1645
1752
|
cacheEnabled: boolean;
|
|
1646
1753
|
}
|
|
1647
1754
|
/**
|
|
1648
|
-
* Strict-typed shape for the inbound messages
|
|
1649
|
-
* `useAppMessages`.
|
|
1650
|
-
*
|
|
1651
|
-
*
|
|
1652
|
-
* `
|
|
1653
|
-
*
|
|
1654
|
-
* `apps/webview-ui/src/types` (ExternalTool, AzureProfile, ApiConfig) stay
|
|
1655
|
-
* on the enum path for now — moving those types into `@serviceme/devtools-shared` is
|
|
1656
|
-
* its own refactor and not in scope.
|
|
1755
|
+
* Strict-typed shape for the inbound messages handled by
|
|
1756
|
+
* `useAppMessages`. Covers the 8 variants whose payload types now live
|
|
1757
|
+
* in `@serviceme/devtools-shared` (`webview-contract.ts` holds the
|
|
1758
|
+
* ExternalTool / AzureProfile / ApiConfig shapes). The string-keyed
|
|
1759
|
+
* `WebviewMessageType` enum stays in place for the remaining enum-path
|
|
1760
|
+
* call sites across `apps/webview-ui` and `apps/extension`.
|
|
1657
1761
|
*
|
|
1658
1762
|
* Each variant lists ONLY the fields the hook actually reads; optional
|
|
1659
|
-
* fields are explicit (`
|
|
1763
|
+
* fields are explicit (`tools?` / `profiles?` / `workspaceOpen`).
|
|
1660
1764
|
*/
|
|
1661
1765
|
type WebviewInboundMessage = {
|
|
1662
1766
|
type: typeof WebviewMessageType.UpdateRepositoryList;
|
|
@@ -1672,6 +1776,18 @@ type WebviewInboundMessage = {
|
|
|
1672
1776
|
type: typeof WebviewMessageType.UpdateLinkedSkills;
|
|
1673
1777
|
links: LinkedSkillPayloadEntry[];
|
|
1674
1778
|
kind: "skill" | "agent";
|
|
1779
|
+
} | {
|
|
1780
|
+
type: typeof WebviewMessageType.UpdateExternalTools;
|
|
1781
|
+
tools?: ExternalTool[];
|
|
1782
|
+
} | {
|
|
1783
|
+
type: typeof WebviewMessageType.UpdateNgrokStatus;
|
|
1784
|
+
isRunning: boolean;
|
|
1785
|
+
} | {
|
|
1786
|
+
type: typeof WebviewMessageType.UpdateAzureProfiles;
|
|
1787
|
+
profiles?: AzureProfile[];
|
|
1788
|
+
} | {
|
|
1789
|
+
type: typeof WebviewMessageType.UpdateApiConfig;
|
|
1790
|
+
config: ApiConfig;
|
|
1675
1791
|
};
|
|
1676
1792
|
/**
|
|
1677
1793
|
* One entry inside the `UpdateLinkedSkills.links` array. Mirrors the
|
|
@@ -1744,4 +1860,4 @@ declare function asAbortSignal(input: unknown): AbortSignal | undefined;
|
|
|
1744
1860
|
*/
|
|
1745
1861
|
declare function safeJson<T>(text: string, fallback: T): T;
|
|
1746
1862
|
|
|
1747
|
-
export { type AIModelConfig, type AIModelInfo, type AgentPermissionSummary, type AgentToolPermission, type AgentToolRiskLevel, BUILTIN_PROVIDER_PRESETS, type BalanceEntry, type BridgeLinkMode, type BridgeLinkedSkill, type BridgeRepoEntry, type BridgeRepoSyncPull, type BridgeSkillKind, type BridgeSkillRepoEntry, type BridgeSkillRepoFile, type ByomProviderToggles, ByomSettingsResponse, type ByomSettingsSnapshot, type ByomTogglePayload, CERTIFICATE_BUNDLE_FORMATS, CachedServerUrlResponse, type CachedServerUrlSnapshot, type CertificateBundleEnvironmentSupport, type CertificateBundleFormat, type CertificateBundleFormatDescriptor, type CodingPlanUsage, type CommandPayload, type CuratedModelMetadata, type DeepseekBalanceEntry, type DeepseekUsage, type DownloadCertificateBundleRequest, type DownloadCertificateBundleResponse, GIT_REMOTE_HOST_ALIASES, type GenericBalanceUsage, GetByomSettings, GetCachedServerUrl, GetServerProxyState, GetUtilityModels, type GitHubOrgMembershipCheckResult, type GitHubOrgMembershipStatus, type GitHubUser, type GithubCopilotCliPayload, type HttpRequestPayload, type ILogger, LISTABLE_PRESET_MODELS, type LinkedSkillPayloadEntry, LogLevel, MODEL_METADATA, type MinimaxUsage, type ModelDetail, type ModelPriceCategory, type ModelPricing, type ModelThinkingSchema, NAMESPACE_ALIASES, NAMESPACE_ALIAS_FAMILY, PRESET_MODEL_FAMILIES, PROVIDER_BASE_URL_PRESETS, PROVIDER_CACHE_CONTROL_METADATA, type PresetModelFamilyGroup, type PresetModelListing, type ProviderBaseUrlPreset, type ProviderCacheControlMetadata, type ProviderConfig, type ProviderModel, type ProviderMutationPayload, type ProviderTestResult, type ProviderType, type ProviderUsageData, type ProviderUsageKind, type ProviderUsageResult, type ProviderVisionMode, type ProviderWireProtocol, type ProvidersResponsePayload, type PublicProvider, type ScheduledTask, type ScheduledTaskType, type ScheduledTaskV1, type ScheduledTasksConfig, type ScheduledTasksLogFile, type ServerProxyAllowOverridePayload, type ServerProxySnapshot, ServerProxyStateResponse, type ServerProxySupportMode, type ServerProxyTogglePayload, SetCacheControlEnabled, SetServerProxyAllowOverride, SetServerProxyEnabled, type ShellPayload, type TaskExecutionLog, type TaskExecutionState, type TaskExecutionStatus, type TaskPayload, type TaskRunStatus, type TaskWorkspaceRef, UpdateUtilityModels, type UpdateUtilityModelsPayload, type UsageWindow, type UtilityModelScope, type UtilityModelsEffective, UtilityModelsResponse, type UtilityModelsSnapshot, type UtilityModelsSource, type WebviewInboundMessage, WebviewMessageType, __internal, asAbortSignal, buildGitHubLocalEmail, buildPresetModel, checkGitHubOrgMembership, createConsoleLogger, currencyForBaseUrl, effectiveAdapterType, fetchGitHubUser, getBuiltinProviderPreset, getGitHubOrgMembership, getPresetModelDisplayName, getProviderBaseUrlPresets, isGitHubLocalEmail, isProviderCacheControlAware, isValidCanonicalSlug, listPresetModelGroups, lookupModelMetadata, normalizeCanonicalSlug, normalizeErrorForLog, normalizeGitUrl, parsePayload, protocolForBaseUrl, resolvePrimaryEmail, safeJson, unionProviderModelWithPreset };
|
|
1863
|
+
export { type AIModelConfig, type AIModelInfo, type AgentPermissionSummary, type AgentToolPermission, type AgentToolRiskLevel, type ApiConfig, type AzureProfile, BUILTIN_PROVIDER_PRESETS, type BalanceEntry, type BridgeLinkMode, type BridgeLinkedSkill, type BridgeRepoEntry, type BridgeRepoSyncPull, type BridgeSkillKind, type BridgeSkillRepoEntry, type BridgeSkillRepoFile, type ByomProviderToggles, ByomSettingsResponse, type ByomSettingsSnapshot, type ByomTogglePayload, CERTIFICATE_BUNDLE_FORMATS, CachedServerUrlResponse, type CachedServerUrlSnapshot, type CertificateBundleEnvironmentSupport, type CertificateBundleFormat, type CertificateBundleFormatDescriptor, type CodingPlanUsage, type CommandPayload, type CuratedModelMetadata, type DeepseekBalanceEntry, type DeepseekUsage, DeviceAuthHeaders, type DeviceRequestSignatureParams, type DownloadCertificateBundleRequest, type DownloadCertificateBundleResponse, type ExternalTool, GIT_REMOTE_HOST_ALIASES, type GenericBalanceUsage, GetByomSettings, GetCachedServerUrl, GetServerProxyState, GetUtilityModels, type GitHubOrgMembershipCheckResult, type GitHubOrgMembershipStatus, type GitHubUser, type GithubCopilotCliPayload, type HttpRequestPayload, type ILogger, LISTABLE_PRESET_MODELS, type LinkedSkillPayloadEntry, LogLevel, MEDALSOFT_NUGET_PRIVATE_SOURCE, MEDALSOFT_PRIVATE_GATEWAY_URL, MODEL_METADATA, type MinimaxUsage, type ModelDetail, type ModelPriceCategory, type ModelPricing, type ModelThinkingSchema, NAMESPACE_ALIASES, NAMESPACE_ALIAS_FAMILY, PRESET_MODEL_FAMILIES, PROVIDER_BASE_URL_PRESETS, PROVIDER_CACHE_CONTROL_METADATA, type PresetModelFamilyGroup, type PresetModelListing, type ProviderBaseUrlPreset, type ProviderCacheControlMetadata, type ProviderConfig, type ProviderModel, type ProviderMutationPayload, type ProviderTestResult, type ProviderType, type ProviderUsageData, type ProviderUsageKind, type ProviderUsageResult, type ProviderVisionMode, type ProviderWireProtocol, type ProvidersResponsePayload, type PublicProvider, type ScheduledTask, type ScheduledTaskType, type ScheduledTaskV1, type ScheduledTasksConfig, type ScheduledTasksLogFile, type ServerProxyAllowOverridePayload, type ServerProxySnapshot, ServerProxyStateResponse, type ServerProxySupportMode, type ServerProxyTogglePayload, SetCacheControlEnabled, SetServerProxyAllowOverride, SetServerProxyEnabled, type ShellPayload, type TaskExecutionLog, type TaskExecutionState, type TaskExecutionStatus, type TaskPayload, type TaskRunStatus, type TaskWorkspaceRef, UpdateUtilityModels, type UpdateUtilityModelsPayload, type UsageWindow, type UtilityModelScope, type UtilityModelsEffective, UtilityModelsResponse, type UtilityModelsSnapshot, type UtilityModelsSource, type WebviewInboundMessage, WebviewMessageType, __internal, asAbortSignal, buildGitHubLocalEmail, buildPresetModel, checkGitHubOrgMembership, createConsoleLogger, createDeviceRequestSignature, currencyForBaseUrl, effectiveAdapterType, fetchGitHubUser, getBuiltinProviderPreset, getGitHubOrgMembership, getPresetModelDisplayName, getProviderBaseUrlPresets, isGitHubLocalEmail, isProviderCacheControlAware, isValidCanonicalSlug, listPresetModelGroups, lookupModelMetadata, normalizeCanonicalSlug, normalizeErrorForLog, normalizeGitUrl, parsePayload, protocolForBaseUrl, resolvePrimaryEmail, safeJson, unionProviderModelWithPreset };
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __export(index_exports, {
|
|
|
24
24
|
ByomSettingsResponse: () => ByomSettingsResponse,
|
|
25
25
|
CERTIFICATE_BUNDLE_FORMATS: () => CERTIFICATE_BUNDLE_FORMATS,
|
|
26
26
|
CachedServerUrlResponse: () => CachedServerUrlResponse,
|
|
27
|
+
DeviceAuthHeaders: () => DeviceAuthHeaders,
|
|
27
28
|
GIT_REMOTE_HOST_ALIASES: () => GIT_REMOTE_HOST_ALIASES,
|
|
28
29
|
GetByomSettings: () => GetByomSettings,
|
|
29
30
|
GetCachedServerUrl: () => GetCachedServerUrl,
|
|
@@ -31,6 +32,8 @@ __export(index_exports, {
|
|
|
31
32
|
GetUtilityModels: () => GetUtilityModels,
|
|
32
33
|
LISTABLE_PRESET_MODELS: () => LISTABLE_PRESET_MODELS,
|
|
33
34
|
LogLevel: () => LogLevel,
|
|
35
|
+
MEDALSOFT_NUGET_PRIVATE_SOURCE: () => MEDALSOFT_NUGET_PRIVATE_SOURCE,
|
|
36
|
+
MEDALSOFT_PRIVATE_GATEWAY_URL: () => MEDALSOFT_PRIVATE_GATEWAY_URL,
|
|
34
37
|
MODEL_METADATA: () => MODEL_METADATA,
|
|
35
38
|
NAMESPACE_ALIASES: () => NAMESPACE_ALIASES,
|
|
36
39
|
NAMESPACE_ALIAS_FAMILY: () => NAMESPACE_ALIAS_FAMILY,
|
|
@@ -50,6 +53,7 @@ __export(index_exports, {
|
|
|
50
53
|
buildPresetModel: () => buildPresetModel,
|
|
51
54
|
checkGitHubOrgMembership: () => checkGitHubOrgMembership,
|
|
52
55
|
createConsoleLogger: () => createConsoleLogger,
|
|
56
|
+
createDeviceRequestSignature: () => createDeviceRequestSignature,
|
|
53
57
|
currencyForBaseUrl: () => currencyForBaseUrl,
|
|
54
58
|
effectiveAdapterType: () => effectiveAdapterType,
|
|
55
59
|
fetchGitHubUser: () => fetchGitHubUser,
|
|
@@ -89,6 +93,10 @@ function effectiveAdapterType(configuredType, baseUrl) {
|
|
|
89
93
|
return configuredType;
|
|
90
94
|
}
|
|
91
95
|
|
|
96
|
+
// src/constants.ts
|
|
97
|
+
var MEDALSOFT_PRIVATE_GATEWAY_URL = "http://10.10.10.249:3000/v1";
|
|
98
|
+
var MEDALSOFT_NUGET_PRIVATE_SOURCE = "http://192.168.20.209:10010/nuget";
|
|
99
|
+
|
|
92
100
|
// src/ai/providers.base-url.ts
|
|
93
101
|
var PROVIDER_BASE_URL_PRESETS = {
|
|
94
102
|
"openai-compatible": [],
|
|
@@ -170,7 +178,11 @@ var PROVIDER_BASE_URL_PRESETS = {
|
|
|
170
178
|
{ label: "\u5168\u7403", baseUrl: "https://apihub.agnes-ai.com/v1" }
|
|
171
179
|
],
|
|
172
180
|
// Medalsoft internal LLM gateway — single OpenAI-compatible endpoint.
|
|
173
|
-
|
|
181
|
+
// 内网地址见 `constants.ts`(仅办公网可达);外网走 nexus。
|
|
182
|
+
medalsoft: [
|
|
183
|
+
{ label: "\u5185\u7F51", baseUrl: MEDALSOFT_PRIVATE_GATEWAY_URL },
|
|
184
|
+
{ label: "\u5916\u7F51", baseUrl: "https://nexus.servicemecloud.com/v1" }
|
|
185
|
+
],
|
|
174
186
|
"vscode-builtin": []
|
|
175
187
|
};
|
|
176
188
|
function getProviderBaseUrlPresets(type) {
|
|
@@ -1607,6 +1619,133 @@ var CERTIFICATE_BUNDLE_FORMATS = [
|
|
|
1607
1619
|
}
|
|
1608
1620
|
];
|
|
1609
1621
|
|
|
1622
|
+
// ../../node_modules/.pnpm/js-sha256@1.0.0/node_modules/js-sha256/src/node.mjs
|
|
1623
|
+
var import_crypto = require("crypto");
|
|
1624
|
+
|
|
1625
|
+
// ../../node_modules/.pnpm/js-sha256@1.0.0/node_modules/js-sha256/src/shared.mjs
|
|
1626
|
+
var INPUT_ERROR = "input is invalid type";
|
|
1627
|
+
var FINALIZE_ERROR = "finalize already called";
|
|
1628
|
+
var ARRAY_BUFFER = typeof ArrayBuffer !== "undefined";
|
|
1629
|
+
var formatMessage = function(message) {
|
|
1630
|
+
var type = typeof message;
|
|
1631
|
+
if (type === "string") {
|
|
1632
|
+
return [message, true];
|
|
1633
|
+
}
|
|
1634
|
+
if (Array.isArray(message)) {
|
|
1635
|
+
return [message, false];
|
|
1636
|
+
}
|
|
1637
|
+
if (ARRAY_BUFFER && message) {
|
|
1638
|
+
if (message.constructor === ArrayBuffer) {
|
|
1639
|
+
return [new Uint8Array(message), false];
|
|
1640
|
+
} else if (ArrayBuffer.isView(message)) {
|
|
1641
|
+
return [message, false];
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
throw new Error(INPUT_ERROR);
|
|
1645
|
+
};
|
|
1646
|
+
|
|
1647
|
+
// ../../node_modules/.pnpm/js-sha256@1.0.0/node_modules/js-sha256/src/node.mjs
|
|
1648
|
+
function toNodeInput(message) {
|
|
1649
|
+
const [msg, isString] = formatMessage(message);
|
|
1650
|
+
return isString ? Buffer.from(msg, "utf8") : Buffer.from(msg);
|
|
1651
|
+
}
|
|
1652
|
+
var NodeHasher = class {
|
|
1653
|
+
constructor(hash) {
|
|
1654
|
+
this.hash = hash;
|
|
1655
|
+
this.result = void 0;
|
|
1656
|
+
}
|
|
1657
|
+
update(message) {
|
|
1658
|
+
if (this.result) {
|
|
1659
|
+
throw new Error(FINALIZE_ERROR);
|
|
1660
|
+
}
|
|
1661
|
+
this.hash.update(toNodeInput(message));
|
|
1662
|
+
return this;
|
|
1663
|
+
}
|
|
1664
|
+
finalize() {
|
|
1665
|
+
if (!this.result) {
|
|
1666
|
+
this.result = this.hash.digest();
|
|
1667
|
+
this.hash = void 0;
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
hex() {
|
|
1671
|
+
this.finalize();
|
|
1672
|
+
return this.result.toString("hex");
|
|
1673
|
+
}
|
|
1674
|
+
toString() {
|
|
1675
|
+
return this.hex();
|
|
1676
|
+
}
|
|
1677
|
+
array() {
|
|
1678
|
+
this.finalize();
|
|
1679
|
+
return Array.from(this.result);
|
|
1680
|
+
}
|
|
1681
|
+
digest() {
|
|
1682
|
+
return this.array();
|
|
1683
|
+
}
|
|
1684
|
+
arrayBuffer() {
|
|
1685
|
+
return Uint8Array.from(this.array()).buffer;
|
|
1686
|
+
}
|
|
1687
|
+
};
|
|
1688
|
+
function addOutputMethods(method, createHasher) {
|
|
1689
|
+
method.hex = method;
|
|
1690
|
+
method.array = function(...args) {
|
|
1691
|
+
return createHasher(...args.slice(0, -1)).update(args[args.length - 1]).array();
|
|
1692
|
+
};
|
|
1693
|
+
method.digest = method.array;
|
|
1694
|
+
method.arrayBuffer = function(...args) {
|
|
1695
|
+
return createHasher(...args.slice(0, -1)).update(args[args.length - 1]).arrayBuffer();
|
|
1696
|
+
};
|
|
1697
|
+
return method;
|
|
1698
|
+
}
|
|
1699
|
+
function createNodeMethod(algorithm) {
|
|
1700
|
+
const createHasher = () => new NodeHasher((0, import_crypto.createHash)(algorithm));
|
|
1701
|
+
const method = function(message) {
|
|
1702
|
+
return createHasher().update(message).hex();
|
|
1703
|
+
};
|
|
1704
|
+
addOutputMethods(method, createHasher);
|
|
1705
|
+
method.create = createHasher;
|
|
1706
|
+
method.update = function(message) {
|
|
1707
|
+
return method.create().update(message);
|
|
1708
|
+
};
|
|
1709
|
+
return method;
|
|
1710
|
+
}
|
|
1711
|
+
function createNodeHmacMethod(algorithm) {
|
|
1712
|
+
const createHasher = (key) => new NodeHasher((0, import_crypto.createHmac)(algorithm, toNodeInput(key)));
|
|
1713
|
+
const method = function(key, message) {
|
|
1714
|
+
return createHasher(key).update(message).hex();
|
|
1715
|
+
};
|
|
1716
|
+
addOutputMethods(method, createHasher);
|
|
1717
|
+
method.create = createHasher;
|
|
1718
|
+
method.update = function(key, message) {
|
|
1719
|
+
return method.create(key).update(message);
|
|
1720
|
+
};
|
|
1721
|
+
return method;
|
|
1722
|
+
}
|
|
1723
|
+
var sha256 = createNodeMethod("sha256");
|
|
1724
|
+
var sha224 = createNodeMethod("sha224");
|
|
1725
|
+
sha256.sha256 = sha256;
|
|
1726
|
+
sha256.sha224 = sha224;
|
|
1727
|
+
sha256.hmac = createNodeHmacMethod("sha256");
|
|
1728
|
+
sha224.hmac = createNodeHmacMethod("sha224");
|
|
1729
|
+
|
|
1730
|
+
// src/device-auth.ts
|
|
1731
|
+
var DeviceAuthHeaders = {
|
|
1732
|
+
deviceId: "x-ms-device-id",
|
|
1733
|
+
deviceSecret: "x-ms-device-secret",
|
|
1734
|
+
signature: "x-ms-device-signature",
|
|
1735
|
+
timestamp: "x-ms-device-timestamp",
|
|
1736
|
+
secretVersion: "x-ms-device-secret-version"
|
|
1737
|
+
};
|
|
1738
|
+
function createDeviceRequestSignature(params) {
|
|
1739
|
+
const basis = [
|
|
1740
|
+
params.method.toUpperCase(),
|
|
1741
|
+
params.path,
|
|
1742
|
+
String(params.timestamp),
|
|
1743
|
+
params.body,
|
|
1744
|
+
params.secret
|
|
1745
|
+
].join("\n");
|
|
1746
|
+
return sha256(basis);
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1610
1749
|
// src/git-utils.ts
|
|
1611
1750
|
var GIT_REMOTE_HOST_ALIASES = {
|
|
1612
1751
|
"github-msc": "github.com"
|
|
@@ -2076,6 +2215,7 @@ function safeJson(text, fallback) {
|
|
|
2076
2215
|
ByomSettingsResponse,
|
|
2077
2216
|
CERTIFICATE_BUNDLE_FORMATS,
|
|
2078
2217
|
CachedServerUrlResponse,
|
|
2218
|
+
DeviceAuthHeaders,
|
|
2079
2219
|
GIT_REMOTE_HOST_ALIASES,
|
|
2080
2220
|
GetByomSettings,
|
|
2081
2221
|
GetCachedServerUrl,
|
|
@@ -2083,6 +2223,8 @@ function safeJson(text, fallback) {
|
|
|
2083
2223
|
GetUtilityModels,
|
|
2084
2224
|
LISTABLE_PRESET_MODELS,
|
|
2085
2225
|
LogLevel,
|
|
2226
|
+
MEDALSOFT_NUGET_PRIVATE_SOURCE,
|
|
2227
|
+
MEDALSOFT_PRIVATE_GATEWAY_URL,
|
|
2086
2228
|
MODEL_METADATA,
|
|
2087
2229
|
NAMESPACE_ALIASES,
|
|
2088
2230
|
NAMESPACE_ALIAS_FAMILY,
|
|
@@ -2102,6 +2244,7 @@ function safeJson(text, fallback) {
|
|
|
2102
2244
|
buildPresetModel,
|
|
2103
2245
|
checkGitHubOrgMembership,
|
|
2104
2246
|
createConsoleLogger,
|
|
2247
|
+
createDeviceRequestSignature,
|
|
2105
2248
|
currencyForBaseUrl,
|
|
2106
2249
|
effectiveAdapterType,
|
|
2107
2250
|
fetchGitHubUser,
|
package/dist/index.mjs
CHANGED
|
@@ -14,6 +14,10 @@ function effectiveAdapterType(configuredType, baseUrl) {
|
|
|
14
14
|
return configuredType;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
// src/constants.ts
|
|
18
|
+
var MEDALSOFT_PRIVATE_GATEWAY_URL = "http://10.10.10.249:3000/v1";
|
|
19
|
+
var MEDALSOFT_NUGET_PRIVATE_SOURCE = "http://192.168.20.209:10010/nuget";
|
|
20
|
+
|
|
17
21
|
// src/ai/providers.base-url.ts
|
|
18
22
|
var PROVIDER_BASE_URL_PRESETS = {
|
|
19
23
|
"openai-compatible": [],
|
|
@@ -95,7 +99,11 @@ var PROVIDER_BASE_URL_PRESETS = {
|
|
|
95
99
|
{ label: "\u5168\u7403", baseUrl: "https://apihub.agnes-ai.com/v1" }
|
|
96
100
|
],
|
|
97
101
|
// Medalsoft internal LLM gateway — single OpenAI-compatible endpoint.
|
|
98
|
-
|
|
102
|
+
// 内网地址见 `constants.ts`(仅办公网可达);外网走 nexus。
|
|
103
|
+
medalsoft: [
|
|
104
|
+
{ label: "\u5185\u7F51", baseUrl: MEDALSOFT_PRIVATE_GATEWAY_URL },
|
|
105
|
+
{ label: "\u5916\u7F51", baseUrl: "https://nexus.servicemecloud.com/v1" }
|
|
106
|
+
],
|
|
99
107
|
"vscode-builtin": []
|
|
100
108
|
};
|
|
101
109
|
function getProviderBaseUrlPresets(type) {
|
|
@@ -1532,6 +1540,133 @@ var CERTIFICATE_BUNDLE_FORMATS = [
|
|
|
1532
1540
|
}
|
|
1533
1541
|
];
|
|
1534
1542
|
|
|
1543
|
+
// ../../node_modules/.pnpm/js-sha256@1.0.0/node_modules/js-sha256/src/node.mjs
|
|
1544
|
+
import { createHash, createHmac } from "crypto";
|
|
1545
|
+
|
|
1546
|
+
// ../../node_modules/.pnpm/js-sha256@1.0.0/node_modules/js-sha256/src/shared.mjs
|
|
1547
|
+
var INPUT_ERROR = "input is invalid type";
|
|
1548
|
+
var FINALIZE_ERROR = "finalize already called";
|
|
1549
|
+
var ARRAY_BUFFER = typeof ArrayBuffer !== "undefined";
|
|
1550
|
+
var formatMessage = function(message) {
|
|
1551
|
+
var type = typeof message;
|
|
1552
|
+
if (type === "string") {
|
|
1553
|
+
return [message, true];
|
|
1554
|
+
}
|
|
1555
|
+
if (Array.isArray(message)) {
|
|
1556
|
+
return [message, false];
|
|
1557
|
+
}
|
|
1558
|
+
if (ARRAY_BUFFER && message) {
|
|
1559
|
+
if (message.constructor === ArrayBuffer) {
|
|
1560
|
+
return [new Uint8Array(message), false];
|
|
1561
|
+
} else if (ArrayBuffer.isView(message)) {
|
|
1562
|
+
return [message, false];
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
throw new Error(INPUT_ERROR);
|
|
1566
|
+
};
|
|
1567
|
+
|
|
1568
|
+
// ../../node_modules/.pnpm/js-sha256@1.0.0/node_modules/js-sha256/src/node.mjs
|
|
1569
|
+
function toNodeInput(message) {
|
|
1570
|
+
const [msg, isString] = formatMessage(message);
|
|
1571
|
+
return isString ? Buffer.from(msg, "utf8") : Buffer.from(msg);
|
|
1572
|
+
}
|
|
1573
|
+
var NodeHasher = class {
|
|
1574
|
+
constructor(hash) {
|
|
1575
|
+
this.hash = hash;
|
|
1576
|
+
this.result = void 0;
|
|
1577
|
+
}
|
|
1578
|
+
update(message) {
|
|
1579
|
+
if (this.result) {
|
|
1580
|
+
throw new Error(FINALIZE_ERROR);
|
|
1581
|
+
}
|
|
1582
|
+
this.hash.update(toNodeInput(message));
|
|
1583
|
+
return this;
|
|
1584
|
+
}
|
|
1585
|
+
finalize() {
|
|
1586
|
+
if (!this.result) {
|
|
1587
|
+
this.result = this.hash.digest();
|
|
1588
|
+
this.hash = void 0;
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
hex() {
|
|
1592
|
+
this.finalize();
|
|
1593
|
+
return this.result.toString("hex");
|
|
1594
|
+
}
|
|
1595
|
+
toString() {
|
|
1596
|
+
return this.hex();
|
|
1597
|
+
}
|
|
1598
|
+
array() {
|
|
1599
|
+
this.finalize();
|
|
1600
|
+
return Array.from(this.result);
|
|
1601
|
+
}
|
|
1602
|
+
digest() {
|
|
1603
|
+
return this.array();
|
|
1604
|
+
}
|
|
1605
|
+
arrayBuffer() {
|
|
1606
|
+
return Uint8Array.from(this.array()).buffer;
|
|
1607
|
+
}
|
|
1608
|
+
};
|
|
1609
|
+
function addOutputMethods(method, createHasher) {
|
|
1610
|
+
method.hex = method;
|
|
1611
|
+
method.array = function(...args) {
|
|
1612
|
+
return createHasher(...args.slice(0, -1)).update(args[args.length - 1]).array();
|
|
1613
|
+
};
|
|
1614
|
+
method.digest = method.array;
|
|
1615
|
+
method.arrayBuffer = function(...args) {
|
|
1616
|
+
return createHasher(...args.slice(0, -1)).update(args[args.length - 1]).arrayBuffer();
|
|
1617
|
+
};
|
|
1618
|
+
return method;
|
|
1619
|
+
}
|
|
1620
|
+
function createNodeMethod(algorithm) {
|
|
1621
|
+
const createHasher = () => new NodeHasher(createHash(algorithm));
|
|
1622
|
+
const method = function(message) {
|
|
1623
|
+
return createHasher().update(message).hex();
|
|
1624
|
+
};
|
|
1625
|
+
addOutputMethods(method, createHasher);
|
|
1626
|
+
method.create = createHasher;
|
|
1627
|
+
method.update = function(message) {
|
|
1628
|
+
return method.create().update(message);
|
|
1629
|
+
};
|
|
1630
|
+
return method;
|
|
1631
|
+
}
|
|
1632
|
+
function createNodeHmacMethod(algorithm) {
|
|
1633
|
+
const createHasher = (key) => new NodeHasher(createHmac(algorithm, toNodeInput(key)));
|
|
1634
|
+
const method = function(key, message) {
|
|
1635
|
+
return createHasher(key).update(message).hex();
|
|
1636
|
+
};
|
|
1637
|
+
addOutputMethods(method, createHasher);
|
|
1638
|
+
method.create = createHasher;
|
|
1639
|
+
method.update = function(key, message) {
|
|
1640
|
+
return method.create(key).update(message);
|
|
1641
|
+
};
|
|
1642
|
+
return method;
|
|
1643
|
+
}
|
|
1644
|
+
var sha256 = createNodeMethod("sha256");
|
|
1645
|
+
var sha224 = createNodeMethod("sha224");
|
|
1646
|
+
sha256.sha256 = sha256;
|
|
1647
|
+
sha256.sha224 = sha224;
|
|
1648
|
+
sha256.hmac = createNodeHmacMethod("sha256");
|
|
1649
|
+
sha224.hmac = createNodeHmacMethod("sha224");
|
|
1650
|
+
|
|
1651
|
+
// src/device-auth.ts
|
|
1652
|
+
var DeviceAuthHeaders = {
|
|
1653
|
+
deviceId: "x-ms-device-id",
|
|
1654
|
+
deviceSecret: "x-ms-device-secret",
|
|
1655
|
+
signature: "x-ms-device-signature",
|
|
1656
|
+
timestamp: "x-ms-device-timestamp",
|
|
1657
|
+
secretVersion: "x-ms-device-secret-version"
|
|
1658
|
+
};
|
|
1659
|
+
function createDeviceRequestSignature(params) {
|
|
1660
|
+
const basis = [
|
|
1661
|
+
params.method.toUpperCase(),
|
|
1662
|
+
params.path,
|
|
1663
|
+
String(params.timestamp),
|
|
1664
|
+
params.body,
|
|
1665
|
+
params.secret
|
|
1666
|
+
].join("\n");
|
|
1667
|
+
return sha256(basis);
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1535
1670
|
// src/git-utils.ts
|
|
1536
1671
|
var GIT_REMOTE_HOST_ALIASES = {
|
|
1537
1672
|
"github-msc": "github.com"
|
|
@@ -2000,6 +2135,7 @@ export {
|
|
|
2000
2135
|
ByomSettingsResponse,
|
|
2001
2136
|
CERTIFICATE_BUNDLE_FORMATS,
|
|
2002
2137
|
CachedServerUrlResponse,
|
|
2138
|
+
DeviceAuthHeaders,
|
|
2003
2139
|
GIT_REMOTE_HOST_ALIASES,
|
|
2004
2140
|
GetByomSettings,
|
|
2005
2141
|
GetCachedServerUrl,
|
|
@@ -2007,6 +2143,8 @@ export {
|
|
|
2007
2143
|
GetUtilityModels,
|
|
2008
2144
|
LISTABLE_PRESET_MODELS,
|
|
2009
2145
|
LogLevel,
|
|
2146
|
+
MEDALSOFT_NUGET_PRIVATE_SOURCE,
|
|
2147
|
+
MEDALSOFT_PRIVATE_GATEWAY_URL,
|
|
2010
2148
|
MODEL_METADATA,
|
|
2011
2149
|
NAMESPACE_ALIASES,
|
|
2012
2150
|
NAMESPACE_ALIAS_FAMILY,
|
|
@@ -2026,6 +2164,7 @@ export {
|
|
|
2026
2164
|
buildPresetModel,
|
|
2027
2165
|
checkGitHubOrgMembership,
|
|
2028
2166
|
createConsoleLogger,
|
|
2167
|
+
createDeviceRequestSignature,
|
|
2029
2168
|
currencyForBaseUrl,
|
|
2030
2169
|
effectiveAdapterType,
|
|
2031
2170
|
fetchGitHubUser,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serviceme/devtools-shared",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.12",
|
|
4
4
|
"description": "Shared webview↔extension message contracts and cross-package data models used by SERVICEME.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"repository": {
|
|
@@ -37,14 +37,17 @@
|
|
|
37
37
|
"tsup": "^8.5.1",
|
|
38
38
|
"typescript": "^5.9.3"
|
|
39
39
|
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"js-sha256": "^1.0.0"
|
|
42
|
+
},
|
|
40
43
|
"scripts": {
|
|
41
44
|
"watch": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
42
45
|
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
43
46
|
"lint": "biome check src test",
|
|
44
47
|
"format": "biome check --write src test",
|
|
45
48
|
"typecheck": "tsc --noEmit",
|
|
46
|
-
"test": "pnpm run build && node --test test/*.test.mjs",
|
|
47
|
-
"release:check": "pnpm run test && npm pack --dry-run",
|
|
49
|
+
"test": "pnpm run build && node scripts/check-bundle-deps.mjs && node --test test/*.test.mjs",
|
|
50
|
+
"release:check": "pnpm run test && node scripts/check-bundle-deps.mjs && npm pack --dry-run",
|
|
48
51
|
"pack": "npm pack",
|
|
49
52
|
"publish:npm": "pnpm publish --access public --no-git-checks"
|
|
50
53
|
}
|