@agentxm/registry-client 0.28.4-bootstrap.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/LICENSE +110 -0
- package/README.md +9 -0
- package/dist/src/__generated__/registry-client.d.ts +6501 -0
- package/dist/src/__generated__/registry-client.js +2270 -0
- package/dist/src/admin-client.d.ts +181 -0
- package/dist/src/admin-client.js +165 -0
- package/dist/src/archive-cache.d.ts +46 -0
- package/dist/src/archive-cache.js +179 -0
- package/dist/src/atomic-write.d.ts +49 -0
- package/dist/src/atomic-write.js +60 -0
- package/dist/src/axm-package-meta.d.ts +31 -0
- package/dist/src/axm-package-meta.js +31 -0
- package/dist/src/cache-root.d.ts +11 -0
- package/dist/src/cache-root.js +43 -0
- package/dist/src/client.d.ts +270 -0
- package/dist/src/client.js +43 -0
- package/dist/src/deprecation-warning.d.ts +3 -0
- package/dist/src/deprecation-warning.js +16 -0
- package/dist/src/error-mapping.d.ts +82 -0
- package/dist/src/error-mapping.js +186 -0
- package/dist/src/errors.d.ts +107 -0
- package/dist/src/errors.js +98 -0
- package/dist/src/failure-mapping.d.ts +14 -0
- package/dist/src/failure-mapping.js +100 -0
- package/dist/src/fs-helpers.d.ts +12 -0
- package/dist/src/fs-helpers.js +13 -0
- package/dist/src/index.d.ts +33 -0
- package/dist/src/index.js +37 -0
- package/dist/src/integrity.d.ts +13 -0
- package/dist/src/integrity.js +17 -0
- package/dist/src/local-client.d.ts +24 -0
- package/dist/src/local-client.js +815 -0
- package/dist/src/network.d.ts +6 -0
- package/dist/src/network.js +6 -0
- package/dist/src/path-safety.d.ts +18 -0
- package/dist/src/path-safety.js +26 -0
- package/dist/src/purl-match.d.ts +28 -0
- package/dist/src/purl-match.js +35 -0
- package/dist/src/registry-url.d.ts +14 -0
- package/dist/src/registry-url.js +12 -0
- package/dist/src/remote-client.d.ts +27 -0
- package/dist/src/remote-client.js +725 -0
- package/dist/src/request-policy.d.ts +29 -0
- package/dist/src/request-policy.js +190 -0
- package/dist/src/response-body.d.ts +11 -0
- package/dist/src/response-body.js +32 -0
- package/dist/src/retry-after.d.ts +9 -0
- package/dist/src/retry-after.js +28 -0
- package/dist/src/translate.d.ts +20 -0
- package/dist/src/translate.js +170 -0
- package/dist/src/utils.d.ts +60 -0
- package/dist/src/utils.js +187 -0
- package/package.json +55 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared atomic single-file replacement: write a uniquely named temp file in
|
|
3
|
+
* the target's directory, then rename it over the target.
|
|
4
|
+
*
|
|
5
|
+
* Deliberately duplicated from the workspace-state kernel: an integration
|
|
6
|
+
* may not depend on a kernel, and this helper is within the sanctioned
|
|
7
|
+
* duplication budget for small pure functions. The registry consumers never
|
|
8
|
+
* sweep stale temps, so that half of the original stays behind.
|
|
9
|
+
*
|
|
10
|
+
* @experimental This API is unstable and may change without notice.
|
|
11
|
+
*/
|
|
12
|
+
import * as Effect from "effect/Effect";
|
|
13
|
+
import * as Option from "effect/Option";
|
|
14
|
+
/** In-process sequence so concurrent fibers never share a temp path. */
|
|
15
|
+
let tempSequence = 0;
|
|
16
|
+
const atomicWriteTempPrefix = (targetPath) => `${targetPath}.tmp.`;
|
|
17
|
+
const makeTempPath = (targetPath) => {
|
|
18
|
+
tempSequence += 1;
|
|
19
|
+
const pid = typeof process === "object" ? process.pid.toString(36) : "x";
|
|
20
|
+
const random = Math.random().toString(36).slice(2, 8);
|
|
21
|
+
return `${atomicWriteTempPrefix(targetPath)}${pid}.${tempSequence.toString(36)}.${random}`;
|
|
22
|
+
};
|
|
23
|
+
const bytesEqual = (a, b) => a.length === b.length && a.every((value, index) => value === b[index]);
|
|
24
|
+
const targetHasContent = (fs, targetPath, content) => typeof content === "string"
|
|
25
|
+
? Effect.map(fs.readFileString(targetPath), (current) => current === content)
|
|
26
|
+
: Effect.map(fs.readFile(targetPath), (current) => bytesEqual(current, content));
|
|
27
|
+
/**
|
|
28
|
+
* Atomically replace `targetPath` with `content` via a same-directory temp
|
|
29
|
+
* file and rename. Failures at each step are mapped by the caller, so error
|
|
30
|
+
* categories, details, and suggestions stay call-site specific.
|
|
31
|
+
*/
|
|
32
|
+
export const writeFileAtomic = (fs, options) => Effect.gen(function* () {
|
|
33
|
+
const { content, mapError, targetPath } = options;
|
|
34
|
+
const tempPath = makeTempPath(targetPath);
|
|
35
|
+
const fail = (step) => (cause) => mapError({ step, targetPath, tempPath, cause });
|
|
36
|
+
if (options.skipIfUnchanged === "fail-on-read-error") {
|
|
37
|
+
const exists = yield* fs.exists(targetPath).pipe(Effect.mapError(fail("check-target")));
|
|
38
|
+
if (exists) {
|
|
39
|
+
const unchanged = yield* targetHasContent(fs, targetPath, content).pipe(Effect.mapError(fail("read-target")));
|
|
40
|
+
if (unchanged)
|
|
41
|
+
return "skipped";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else if (options.skipIfUnchanged === "ignore-read-errors") {
|
|
45
|
+
const unchanged = yield* targetHasContent(fs, targetPath, content).pipe(Effect.option);
|
|
46
|
+
if (Option.isSome(unchanged) && unchanged.value)
|
|
47
|
+
return "skipped";
|
|
48
|
+
}
|
|
49
|
+
yield* Effect.gen(function* () {
|
|
50
|
+
yield* (typeof content === "string"
|
|
51
|
+
? fs.writeFileString(tempPath, content)
|
|
52
|
+
: fs.writeFile(tempPath, content)).pipe(Effect.mapError(fail("write-temp")));
|
|
53
|
+
if (options.removeTargetBeforeRename === true) {
|
|
54
|
+
yield* fs.remove(targetPath).pipe(Effect.ignore);
|
|
55
|
+
}
|
|
56
|
+
yield* fs.rename(tempPath, targetPath).pipe(Effect.mapError(fail("rename")));
|
|
57
|
+
}).pipe(Effect.ensuring(fs.remove(tempPath, { force: true }).pipe(Effect.ignore)));
|
|
58
|
+
return "written";
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=atomic-write.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema for axm package metadata shipped by library authors.
|
|
3
|
+
*
|
|
4
|
+
* @experimental This API is unstable and may change without notice.
|
|
5
|
+
*/
|
|
6
|
+
import * as Schema from "effect/Schema";
|
|
7
|
+
export declare const PackageExtensionDeclarationSchema: Schema.Struct<{
|
|
8
|
+
readonly ref: Schema.String;
|
|
9
|
+
readonly versionRange: Schema.optional<Schema.NullOr<Schema.brand<Schema.NonEmptyString, "VersionRange">>>;
|
|
10
|
+
}>;
|
|
11
|
+
export type PackageExtensionDeclaration = Schema.Schema.Type<typeof PackageExtensionDeclarationSchema>;
|
|
12
|
+
/**
|
|
13
|
+
* Schema for the axm package metadata file that library authors ship
|
|
14
|
+
* to surface recommended axm extensions for their package.
|
|
15
|
+
*
|
|
16
|
+
* @experimental This API is unstable and may change without notice.
|
|
17
|
+
*/
|
|
18
|
+
export declare const AxmPackageMetaSchema: Schema.Struct<{
|
|
19
|
+
readonly $schema: Schema.optional<Schema.String>;
|
|
20
|
+
readonly extensions: Schema.$Array<Schema.Struct<{
|
|
21
|
+
readonly ref: Schema.String;
|
|
22
|
+
readonly versionRange: Schema.optional<Schema.NullOr<Schema.brand<Schema.NonEmptyString, "VersionRange">>>;
|
|
23
|
+
}>>;
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* Inferred type for AxmPackageMeta schema.
|
|
27
|
+
*
|
|
28
|
+
* @experimental This API is unstable and may change without notice.
|
|
29
|
+
*/
|
|
30
|
+
export type AxmPackageMeta = Schema.Schema.Type<typeof AxmPackageMetaSchema>;
|
|
31
|
+
//# sourceMappingURL=axm-package-meta.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema for axm package metadata shipped by library authors.
|
|
3
|
+
*
|
|
4
|
+
* @experimental This API is unstable and may change without notice.
|
|
5
|
+
*/
|
|
6
|
+
import * as Schema from "effect/Schema";
|
|
7
|
+
import { ExtensionFqnSchema } from "@agentxm/extension-model/unstable/extensions/common";
|
|
8
|
+
import { VersionRangeSchema } from "@agentxm/extension-model/unstable/version-constraints";
|
|
9
|
+
export const PackageExtensionDeclarationSchema = Schema.Struct({
|
|
10
|
+
ref: ExtensionFqnSchema,
|
|
11
|
+
versionRange: Schema.optional(Schema.NullOr(VersionRangeSchema)),
|
|
12
|
+
}).annotate({
|
|
13
|
+
identifier: "PackageExtensionDeclaration",
|
|
14
|
+
title: "Package Extension Declaration",
|
|
15
|
+
description: "An extension declared by package-native AXM metadata, with an optional semver version range.",
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Schema for the axm package metadata file that library authors ship
|
|
19
|
+
* to surface recommended axm extensions for their package.
|
|
20
|
+
*
|
|
21
|
+
* @experimental This API is unstable and may change without notice.
|
|
22
|
+
*/
|
|
23
|
+
export const AxmPackageMetaSchema = Schema.Struct({
|
|
24
|
+
$schema: Schema.optional(Schema.String),
|
|
25
|
+
extensions: Schema.Array(PackageExtensionDeclarationSchema),
|
|
26
|
+
}).annotate({
|
|
27
|
+
identifier: "AxmPackageMeta",
|
|
28
|
+
title: "axm Package Metadata",
|
|
29
|
+
description: "Recommendation metadata shipped by library authors to surface axm extensions.",
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=axm-package-meta.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Platform cache placement shared by all non-authoritative AXM caches. */
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Path from "effect/Path";
|
|
4
|
+
export interface AxmCacheEnvironment {
|
|
5
|
+
readonly axmUserHome?: string;
|
|
6
|
+
readonly localAppData?: string;
|
|
7
|
+
readonly xdgCacheHome?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const resolveAxmCacheRootPure: (pathJoin: (...segments: ReadonlyArray<string>) => string, platform: string, homeDir: string, environment: AxmCacheEnvironment) => string;
|
|
10
|
+
export declare const resolveAxmCacheRoot: () => Effect.Effect<string, never, Path.Path>;
|
|
11
|
+
//# sourceMappingURL=cache-root.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** Platform cache placement shared by all non-authoritative AXM caches. */
|
|
2
|
+
import * as os from "node:os";
|
|
3
|
+
import * as Config from "effect/Config";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Option from "effect/Option";
|
|
6
|
+
import * as Path from "effect/Path";
|
|
7
|
+
const nonEmpty = (value) => value === undefined || value.length === 0 ? undefined : value;
|
|
8
|
+
export const resolveAxmCacheRootPure = (pathJoin, platform, homeDir, environment) => {
|
|
9
|
+
const overriddenHome = nonEmpty(environment.axmUserHome);
|
|
10
|
+
const home = overriddenHome ?? homeDir;
|
|
11
|
+
if (platform === "darwin")
|
|
12
|
+
return pathJoin(home, "Library", "Caches", "axm");
|
|
13
|
+
if (platform === "win32") {
|
|
14
|
+
const cacheHome = overriddenHome === undefined
|
|
15
|
+
? (nonEmpty(environment.localAppData) ?? pathJoin(home, "AppData", "Local"))
|
|
16
|
+
: pathJoin(home, "AppData", "Local");
|
|
17
|
+
return pathJoin(cacheHome, "axm", "cache");
|
|
18
|
+
}
|
|
19
|
+
const cacheHome = overriddenHome === undefined
|
|
20
|
+
? (nonEmpty(environment.xdgCacheHome) ?? pathJoin(home, ".cache"))
|
|
21
|
+
: pathJoin(home, ".cache");
|
|
22
|
+
return pathJoin(cacheHome, "axm");
|
|
23
|
+
};
|
|
24
|
+
const cacheEnvironmentConfig = Config.all({
|
|
25
|
+
axmUserHome: Config.option(Config.string("AXM_USER_HOME")),
|
|
26
|
+
localAppData: Config.option(Config.string("LOCALAPPDATA")),
|
|
27
|
+
xdgCacheHome: Config.option(Config.string("XDG_CACHE_HOME")),
|
|
28
|
+
});
|
|
29
|
+
export const resolveAxmCacheRoot = () => Effect.gen(function* () {
|
|
30
|
+
const path = yield* Path.Path;
|
|
31
|
+
// All fields are optional strings; failure would violate the provider contract.
|
|
32
|
+
// eslint-disable-next-line no-restricted-syntax -- Config cannot fail for an all-optional record.
|
|
33
|
+
const environment = yield* Effect.orDie(cacheEnvironmentConfig);
|
|
34
|
+
const axmUserHome = Option.getOrUndefined(environment.axmUserHome);
|
|
35
|
+
const localAppData = Option.getOrUndefined(environment.localAppData);
|
|
36
|
+
const xdgCacheHome = Option.getOrUndefined(environment.xdgCacheHome);
|
|
37
|
+
return resolveAxmCacheRootPure(path.join, process.platform, os.homedir(), {
|
|
38
|
+
...(axmUserHome === undefined ? {} : { axmUserHome }),
|
|
39
|
+
...(localAppData === undefined ? {} : { localAppData }),
|
|
40
|
+
...(xdgCacheHome === undefined ? {} : { xdgCacheHome }),
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=cache-root.js.map
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry client types and factory.
|
|
3
|
+
*
|
|
4
|
+
* Domain types for registry search and extension entries,
|
|
5
|
+
* independent of any source provider abstraction.
|
|
6
|
+
*
|
|
7
|
+
* @experimental This API is unstable and may change without notice.
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
import * as FileSystem from "effect/FileSystem";
|
|
11
|
+
import * as HttpClient from "effect/unstable/http/HttpClient";
|
|
12
|
+
import * as Path from "effect/Path";
|
|
13
|
+
import * as Effect from "effect/Effect";
|
|
14
|
+
import * as Option from "effect/Option";
|
|
15
|
+
import type { RegistryClientFailure } from "./errors.js";
|
|
16
|
+
import type { PublishVisibility, VisibilityEvaluation, VisibilityIntent, VisibilityMutationRequest, VisibilityMutationResult } from "@agentxm/registry-protocol/unstable/publish";
|
|
17
|
+
import type { SuggestedAction } from "@agentxm/registry-protocol/unstable/suggested-action";
|
|
18
|
+
import type { Author, ExtensionDependencyConstraintMap, ExtensionName, ExtensionType } from "@agentxm/extension-model/unstable/extensions";
|
|
19
|
+
import type { Handle } from "@agentxm/extension-model/unstable/extensions/handle";
|
|
20
|
+
import type { ExtensionIndex, VersionEntry } from "@agentxm/registry-protocol/unstable/registry/schema";
|
|
21
|
+
import type { DeprecationView } from "@agentxm/extension-model/unstable/extensions/deprecation";
|
|
22
|
+
import type { Bugs, Repository } from "@agentxm/extension-model/unstable/extensions/common";
|
|
23
|
+
import type { DiscoverPackagesResponse } from "@agentxm/registry-protocol/unstable/registry/discover-schema";
|
|
24
|
+
import type { PackageUrlParts } from "@agentxm/extension-model/unstable/packaging/package-url";
|
|
25
|
+
import type { PackageExtensionDeclaration } from "./axm-package-meta.js";
|
|
26
|
+
import type { RegistryRequestPolicy } from "./request-policy.js";
|
|
27
|
+
import type { Version, VersionRange } from "@agentxm/extension-model/unstable/version-constraints";
|
|
28
|
+
import type { PreviewPublicationSetRequest, PreviewPublicationSetResponse, PublicationVisibilityInput, Sha256Hex } from "@agentxm/registry-protocol/unstable/registry/publication-set";
|
|
29
|
+
/**
|
|
30
|
+
* Options for searching extensions within a specific registry owner.
|
|
31
|
+
*
|
|
32
|
+
* - `owner`: owner to search (e.g. `"@acme"`)
|
|
33
|
+
* - `names`: extension names to match (empty = all)
|
|
34
|
+
* - `types`: extension types to include (empty = all)
|
|
35
|
+
* - `limit`: max results to return (default: all)
|
|
36
|
+
* - `offset`: number of results to skip (default: 0)
|
|
37
|
+
*/
|
|
38
|
+
export interface GetExtensionsByOwnerArgs {
|
|
39
|
+
readonly owner: Handle | "*";
|
|
40
|
+
readonly names: ReadonlyArray<string>;
|
|
41
|
+
readonly types: ReadonlyArray<ExtensionType>;
|
|
42
|
+
readonly limit: Option.Option<number>;
|
|
43
|
+
readonly offset: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Options for fetching a specific extension version from a registry.
|
|
47
|
+
*
|
|
48
|
+
* - `owner`: owner in the registry path (e.g. `"@acme"`)
|
|
49
|
+
* - `type`: extension type
|
|
50
|
+
* - `name`: extension name
|
|
51
|
+
* - `version`: specific version to fetch, or `None` for latest
|
|
52
|
+
*/
|
|
53
|
+
export interface GetExtensionPackageArgs {
|
|
54
|
+
readonly owner: Handle;
|
|
55
|
+
readonly type: ExtensionType;
|
|
56
|
+
readonly name: ExtensionName;
|
|
57
|
+
readonly version: Option.Option<Version | VersionRange>;
|
|
58
|
+
/** Marks an archive read used only to verify compatibility before selection. */
|
|
59
|
+
readonly usagePurpose?: "verification";
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Options for fetching extension index metadata from a registry.
|
|
63
|
+
*
|
|
64
|
+
* - `owner`: owner in the registry path (e.g. `"@acme"`)
|
|
65
|
+
* - `type`: extension type
|
|
66
|
+
* - `name`: extension name
|
|
67
|
+
*/
|
|
68
|
+
export interface GetExtensionIndexArgs {
|
|
69
|
+
readonly owner: Handle;
|
|
70
|
+
readonly type: ExtensionType;
|
|
71
|
+
readonly name: ExtensionName;
|
|
72
|
+
}
|
|
73
|
+
export interface GetExactExtensionVersionArgs {
|
|
74
|
+
readonly owner: Handle;
|
|
75
|
+
readonly type: ExtensionType;
|
|
76
|
+
readonly name: ExtensionName;
|
|
77
|
+
readonly version: Version;
|
|
78
|
+
/** Ephemeral exact publish capability used to settle an ambiguous upload. */
|
|
79
|
+
readonly accessToken?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface ExactExtensionVersion {
|
|
82
|
+
readonly owner: Handle;
|
|
83
|
+
readonly type: ExtensionType;
|
|
84
|
+
readonly name: ExtensionName;
|
|
85
|
+
readonly version: Version;
|
|
86
|
+
readonly integrity: string;
|
|
87
|
+
readonly status: "available";
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Options for publishing an extension version to a registry.
|
|
91
|
+
*
|
|
92
|
+
* - `owner`: owner in the registry path (e.g. `"@acme"`)
|
|
93
|
+
* - `type`: extension type
|
|
94
|
+
* - `name`: extension name
|
|
95
|
+
* - `version`: version string to publish
|
|
96
|
+
* - `archive`: zip archive bytes
|
|
97
|
+
* - `metadata`: version entry metadata
|
|
98
|
+
*/
|
|
99
|
+
export interface PublishExtensionArgs {
|
|
100
|
+
readonly owner: Handle;
|
|
101
|
+
readonly type: ExtensionType;
|
|
102
|
+
readonly name: ExtensionName;
|
|
103
|
+
readonly version: Version;
|
|
104
|
+
readonly archive: Uint8Array;
|
|
105
|
+
readonly metadata: VersionEntry;
|
|
106
|
+
/** Exact repository/CLI visibility input bound by the publication descriptor digest. */
|
|
107
|
+
readonly visibilityInput: PublicationVisibilityInput;
|
|
108
|
+
/** Authoritative establishment value and provenance from publication preview. */
|
|
109
|
+
readonly visibility?: PublishVisibility;
|
|
110
|
+
/** Ephemeral exact publish capability. Never persisted by the registry client. */
|
|
111
|
+
readonly accessToken?: string;
|
|
112
|
+
/** Opaque authoritative preview condition, sent as If-Match. */
|
|
113
|
+
readonly condition?: string;
|
|
114
|
+
/** Digest of the complete publication set authorized by the preview. */
|
|
115
|
+
readonly publicationSetDigest?: Sha256Hex;
|
|
116
|
+
/** Digest of this exact publication descriptor. */
|
|
117
|
+
readonly publicationDescriptorDigest?: Sha256Hex;
|
|
118
|
+
}
|
|
119
|
+
export type ExtensionVisibility = "public" | "private";
|
|
120
|
+
export interface PublishPreviewTarget {
|
|
121
|
+
readonly owner: Handle;
|
|
122
|
+
readonly type: ExtensionType;
|
|
123
|
+
readonly name: ExtensionName;
|
|
124
|
+
readonly version: Version;
|
|
125
|
+
}
|
|
126
|
+
export type PreviewExtensionPublishesArgs = PreviewPublicationSetRequest;
|
|
127
|
+
export type PublishPreviewResult = PreviewPublicationSetResponse;
|
|
128
|
+
export interface GetExtensionVisibilityArgs {
|
|
129
|
+
readonly owner: Handle;
|
|
130
|
+
readonly type: ExtensionType;
|
|
131
|
+
readonly name: ExtensionName;
|
|
132
|
+
readonly intent: VisibilityIntent | null;
|
|
133
|
+
}
|
|
134
|
+
export type UpdateExtensionVisibilityArgs = VisibilityMutationRequest;
|
|
135
|
+
/**
|
|
136
|
+
* Options for checking whether an extension exists in a registry.
|
|
137
|
+
*
|
|
138
|
+
* - `owner`: owner in the registry path (e.g. `"@acme"`)
|
|
139
|
+
* - `type`: extension type
|
|
140
|
+
* - `name`: extension name
|
|
141
|
+
*/
|
|
142
|
+
export interface ExtensionExistsArgs {
|
|
143
|
+
readonly owner: Handle;
|
|
144
|
+
readonly type: ExtensionType;
|
|
145
|
+
readonly name: ExtensionName;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Result from a registry extension search.
|
|
149
|
+
*/
|
|
150
|
+
export interface GetExtensionsByOwnerResponse {
|
|
151
|
+
readonly extensions: ReadonlyArray<RegistryExtensionManifest<ExtensionType>>;
|
|
152
|
+
readonly total: number;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Response from fetching a specific extension version archive.
|
|
156
|
+
*/
|
|
157
|
+
export interface GetExtensionPackageResponse {
|
|
158
|
+
readonly archive: Uint8Array;
|
|
159
|
+
readonly warnings?: ReadonlyArray<string>;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Response from publishing an extension version.
|
|
163
|
+
*/
|
|
164
|
+
export interface ExtensionLinks {
|
|
165
|
+
readonly html: string;
|
|
166
|
+
}
|
|
167
|
+
export interface PublishExtensionResponse {
|
|
168
|
+
readonly published: true;
|
|
169
|
+
readonly owner: Handle;
|
|
170
|
+
readonly type: ExtensionType;
|
|
171
|
+
readonly name: ExtensionName;
|
|
172
|
+
readonly version: Version;
|
|
173
|
+
readonly integrity: string;
|
|
174
|
+
readonly status: "pending" | "available" | "failed";
|
|
175
|
+
readonly visibility: PublishVisibility;
|
|
176
|
+
readonly links?: ExtensionLinks;
|
|
177
|
+
readonly warnings: ReadonlyArray<RegistryPublishWarning>;
|
|
178
|
+
}
|
|
179
|
+
export interface RegistryPublishWarning {
|
|
180
|
+
readonly ruleId: string;
|
|
181
|
+
readonly severity: "warning";
|
|
182
|
+
readonly message: string;
|
|
183
|
+
readonly suggestions: ReadonlyArray<SuggestedAction>;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Response from checking whether an owner exists in a registry.
|
|
187
|
+
*/
|
|
188
|
+
export interface OwnerExistsResponse {
|
|
189
|
+
readonly exists: boolean;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Response from checking whether an extension exists in a registry.
|
|
193
|
+
*/
|
|
194
|
+
export interface ExtensionExistsResponse {
|
|
195
|
+
readonly exists: boolean;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Options for discovering extensions compatible with detected packages
|
|
199
|
+
* and workspace recommendations.
|
|
200
|
+
*
|
|
201
|
+
* - `packages`: detected package purls to match against extension compatibility
|
|
202
|
+
* - `declaredExtensions`: extension refs declared by the package's native AXM metadata
|
|
203
|
+
*/
|
|
204
|
+
export interface DiscoverPackageInput {
|
|
205
|
+
readonly purl: PackageUrlParts;
|
|
206
|
+
readonly version: string;
|
|
207
|
+
readonly declaredExtensions: ReadonlyArray<PackageExtensionDeclaration>;
|
|
208
|
+
}
|
|
209
|
+
export interface DiscoverPackagesArgs {
|
|
210
|
+
readonly packages: ReadonlyArray<DiscoverPackageInput>;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* A discovered extension entry from a registry search.
|
|
214
|
+
*
|
|
215
|
+
* Represents a single matched extension with its resolved version and integrity.
|
|
216
|
+
*/
|
|
217
|
+
export interface RegistryExtensionManifest<T extends ExtensionType = ExtensionType> {
|
|
218
|
+
readonly owner: Handle;
|
|
219
|
+
readonly type: T;
|
|
220
|
+
readonly name: ExtensionName;
|
|
221
|
+
/** Immutable publisher epoch for this coordinate. */
|
|
222
|
+
readonly publisherBindingId: string;
|
|
223
|
+
readonly description: Option.Option<string>;
|
|
224
|
+
readonly repository: Option.Option<Repository>;
|
|
225
|
+
readonly bugs: Option.Option<Bugs>;
|
|
226
|
+
readonly license: Option.Option<string>;
|
|
227
|
+
readonly authors: ReadonlyArray<Author>;
|
|
228
|
+
readonly dependencies: ExtensionDependencyConstraintMap;
|
|
229
|
+
readonly version: Version;
|
|
230
|
+
readonly integrity: string;
|
|
231
|
+
/** Package URLs this extension is compatible with. Empty when absent in registry metadata. */
|
|
232
|
+
readonly packages: ReadonlyArray<PackageUrlParts>;
|
|
233
|
+
readonly deprecation?: DeprecationView;
|
|
234
|
+
readonly lifecycleWarnings?: ReadonlyArray<string>;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Client interface for interacting with a registry.
|
|
238
|
+
*
|
|
239
|
+
* All operations are scoped to a registry root provided at construction time.
|
|
240
|
+
* Uses registry-domain types only — no source provider dependencies.
|
|
241
|
+
*
|
|
242
|
+
* @experimental This API is unstable and may change without notice.
|
|
243
|
+
*/
|
|
244
|
+
export interface RegistryClient {
|
|
245
|
+
readonly getExtensionsByScope: (args: GetExtensionsByOwnerArgs) => Effect.Effect<GetExtensionsByOwnerResponse, RegistryClientFailure>;
|
|
246
|
+
readonly ownerExists: (owner: Handle) => Effect.Effect<OwnerExistsResponse, RegistryClientFailure>;
|
|
247
|
+
readonly getExtensionIndex: (args: GetExtensionIndexArgs) => Effect.Effect<Option.Option<ExtensionIndex>, RegistryClientFailure>;
|
|
248
|
+
readonly getExactExtensionVersion: (args: GetExactExtensionVersionArgs) => Effect.Effect<Option.Option<ExactExtensionVersion>, RegistryClientFailure>;
|
|
249
|
+
readonly getExtensionPackage: (args: GetExtensionPackageArgs) => Effect.Effect<GetExtensionPackageResponse, RegistryClientFailure>;
|
|
250
|
+
readonly publishExtension: (args: PublishExtensionArgs) => Effect.Effect<PublishExtensionResponse, RegistryClientFailure>;
|
|
251
|
+
readonly previewExtensionPublishes: (args: PreviewExtensionPublishesArgs) => Effect.Effect<PublishPreviewResult, RegistryClientFailure>;
|
|
252
|
+
readonly getExtensionVisibility: (args: GetExtensionVisibilityArgs) => Effect.Effect<VisibilityEvaluation, RegistryClientFailure>;
|
|
253
|
+
readonly updateExtensionVisibility: (args: UpdateExtensionVisibilityArgs) => Effect.Effect<VisibilityMutationResult, RegistryClientFailure>;
|
|
254
|
+
readonly extensionExists: (args: ExtensionExistsArgs) => Effect.Effect<ExtensionExistsResponse, RegistryClientFailure>;
|
|
255
|
+
readonly discoverPackages: (args: DiscoverPackagesArgs) => Effect.Effect<DiscoverPackagesResponse, RegistryClientFailure>;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Create the appropriate registry client based on location scheme.
|
|
259
|
+
*
|
|
260
|
+
* - Local paths and `file://` URLs -> `LocalRegistryClient`
|
|
261
|
+
* - `http://` and `https://` URLs -> `RemoteRegistryClient`
|
|
262
|
+
*
|
|
263
|
+
* @param location - Registry location (local path, file:// URL, or https:// URL)
|
|
264
|
+
*
|
|
265
|
+
* @experimental This API is unstable and may change without notice.
|
|
266
|
+
*/
|
|
267
|
+
export declare const createRegistryClient: (location: string, options?: {
|
|
268
|
+
readonly requestPolicy?: RegistryRequestPolicy;
|
|
269
|
+
}) => Effect.Effect<RegistryClient, never, HttpClient.HttpClient | FileSystem.FileSystem | Path.Path>;
|
|
270
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry client types and factory.
|
|
3
|
+
*
|
|
4
|
+
* Domain types for registry search and extension entries,
|
|
5
|
+
* independent of any source provider abstraction.
|
|
6
|
+
*
|
|
7
|
+
* @experimental This API is unstable and may change without notice.
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
import * as FileSystem from "effect/FileSystem";
|
|
11
|
+
import * as HttpClient from "effect/unstable/http/HttpClient";
|
|
12
|
+
import * as Path from "effect/Path";
|
|
13
|
+
import * as Effect from "effect/Effect";
|
|
14
|
+
import * as Option from "effect/Option";
|
|
15
|
+
import { stripFileProtocol } from "./fs-helpers.js";
|
|
16
|
+
import { makeUserArchiveCache } from "./archive-cache.js";
|
|
17
|
+
import { createLocalRegistryClient } from "./local-client.js";
|
|
18
|
+
import { createRemoteRegistryClient } from "./remote-client.js";
|
|
19
|
+
// -----------------------------------------------------------------------------
|
|
20
|
+
// Factory
|
|
21
|
+
// -----------------------------------------------------------------------------
|
|
22
|
+
/**
|
|
23
|
+
* Create the appropriate registry client based on location scheme.
|
|
24
|
+
*
|
|
25
|
+
* - Local paths and `file://` URLs -> `LocalRegistryClient`
|
|
26
|
+
* - `http://` and `https://` URLs -> `RemoteRegistryClient`
|
|
27
|
+
*
|
|
28
|
+
* @param location - Registry location (local path, file:// URL, or https:// URL)
|
|
29
|
+
*
|
|
30
|
+
* @experimental This API is unstable and may change without notice.
|
|
31
|
+
*/
|
|
32
|
+
export const createRegistryClient = (location, options) => Effect.gen(function* () {
|
|
33
|
+
if (location.startsWith("https://") || location.startsWith("http://")) {
|
|
34
|
+
const httpClient = yield* HttpClient.HttpClient;
|
|
35
|
+
const archiveCache = yield* makeUserArchiveCache();
|
|
36
|
+
return createRemoteRegistryClient(location, httpClient, archiveCache, options?.requestPolicy);
|
|
37
|
+
}
|
|
38
|
+
const localPath = location.startsWith("file://") ? stripFileProtocol(location) : location;
|
|
39
|
+
const fs = yield* FileSystem.FileSystem;
|
|
40
|
+
const path = yield* Path.Path;
|
|
41
|
+
return createLocalRegistryClient(localPath, fs, path);
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const formatDeprecationWarning = (extensionRef, deprecation) => {
|
|
2
|
+
const guidance = [
|
|
3
|
+
deprecation.message,
|
|
4
|
+
deprecation.replacement?.status === "available"
|
|
5
|
+
? `Use ${deprecation.replacement.fqn}`
|
|
6
|
+
: deprecation.replacement === undefined
|
|
7
|
+
? undefined
|
|
8
|
+
: deprecation.replacement.fqn === undefined
|
|
9
|
+
? "The suggested replacement is unavailable or not visible"
|
|
10
|
+
: `The suggested replacement ${deprecation.replacement.fqn} is unavailable`,
|
|
11
|
+
].filter((value) => value !== undefined);
|
|
12
|
+
return guidance.length === 0
|
|
13
|
+
? `${extensionRef} is deprecated`
|
|
14
|
+
: `${extensionRef} is deprecated: ${guidance.join(". ")}`;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=deprecation-warning.js.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared error mapping helpers for registry and auth client implementations.
|
|
3
|
+
*
|
|
4
|
+
* Provides reusable predicates and mappers for converting generated client
|
|
5
|
+
* errors (RegistryClientError, HttpClientError, SchemaError) to the typed
|
|
6
|
+
* registry failure vocabulary.
|
|
7
|
+
*
|
|
8
|
+
* @experimental This API is unstable and may change without notice.
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
import * as HttpClientError from "effect/unstable/http/HttpClientError";
|
|
12
|
+
import type { SuggestedAction } from "@agentxm/registry-protocol/unstable/suggested-action";
|
|
13
|
+
import type { RegistryClientError } from "./__generated__/registry-client.js";
|
|
14
|
+
import { RegistryRequestFailed, type RegistryProblem } from "./errors.js";
|
|
15
|
+
/**
|
|
16
|
+
* Safely read a string field from an unknown object.
|
|
17
|
+
*/
|
|
18
|
+
export declare const getString: (obj: unknown, field: string) => string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Create a type predicate that matches a specific RegistryClientError tag.
|
|
21
|
+
*
|
|
22
|
+
* Usage:
|
|
23
|
+
* ```ts
|
|
24
|
+
* Effect.catchIf(isRegistryClientError("ExtensionsGet404"), ...)
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare const isRegistryClientError: <Tag extends string>(tag: Tag) => (e: unknown) => e is RegistryClientError<Tag, unknown>;
|
|
28
|
+
/**
|
|
29
|
+
* Type predicate for HttpClientError.
|
|
30
|
+
*/
|
|
31
|
+
export declare const isHttpClientError: (e: unknown) => e is HttpClientError.HttpClientError;
|
|
32
|
+
/**
|
|
33
|
+
* Type predicate matching HttpClientErrors that are reasonable to retry:
|
|
34
|
+
* transport-level failures (ECONNREFUSED, DNS, etc.) and 5xx status codes.
|
|
35
|
+
* Deterministic failures — encode errors, invalid URLs, decode errors,
|
|
36
|
+
* 4xx statuses — are excluded so they fail fast.
|
|
37
|
+
*/
|
|
38
|
+
export declare const isTransientHttpClientError: (e: unknown) => e is HttpClientError.HttpClientError;
|
|
39
|
+
/**
|
|
40
|
+
* Type predicate for SchemaError from effect/Schema.
|
|
41
|
+
*/
|
|
42
|
+
export declare const isSchemaError: (e: unknown) => boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Build user-facing suggestions for network errors.
|
|
45
|
+
* Detects localhost+HTTPS mismatches and provides targeted guidance.
|
|
46
|
+
*/
|
|
47
|
+
export declare const buildNetworkSuggestions: (baseUrl: string) => ReadonlyArray<SuggestedAction>;
|
|
48
|
+
/**
|
|
49
|
+
* Build diagnostic details array for network errors.
|
|
50
|
+
* Detects localhost+HTTPS protocol mismatch.
|
|
51
|
+
*/
|
|
52
|
+
export declare const buildNetworkDiagnosis: (baseUrl: string) => ReadonlyArray<string>;
|
|
53
|
+
/**
|
|
54
|
+
* Safely read the _tag from an unknown value.
|
|
55
|
+
*/
|
|
56
|
+
export declare const getTag: (e: unknown) => string | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Check if an unknown value is a RegistryClientError (has _tag, request, response fields).
|
|
59
|
+
*/
|
|
60
|
+
export declare const isAnyRegistryClientError: (e: unknown) => e is RegistryClientError<string, unknown>;
|
|
61
|
+
/**
|
|
62
|
+
* Check if an unknown value has a _tag ending with the given suffix.
|
|
63
|
+
*/
|
|
64
|
+
export declare const hasTagSuffix: (e: unknown, suffix: string) => boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Map an HttpClientError to a typed registry failure with the network category.
|
|
67
|
+
*/
|
|
68
|
+
export declare const mapNetworkError: (error: HttpClientError.HttpClientError, message: string, baseUrl: string) => RegistryRequestFailed;
|
|
69
|
+
/**
|
|
70
|
+
* Map an input Schema encode error to a typed registry failure.
|
|
71
|
+
*/
|
|
72
|
+
export declare const mapInputSchemaError: (error: unknown, message: string) => RegistryRequestFailed;
|
|
73
|
+
/**
|
|
74
|
+
* Map a response Schema decode error to a typed registry failure.
|
|
75
|
+
*/
|
|
76
|
+
export declare const mapResponseSchemaError: (error: unknown, message: string) => RegistryRequestFailed;
|
|
77
|
+
export declare const mapSchemaError: (error: unknown, message: string) => RegistryRequestFailed;
|
|
78
|
+
/**
|
|
79
|
+
* Map a RegistryClientError to a typed registry failure for unexpected status codes.
|
|
80
|
+
*/
|
|
81
|
+
export declare const mapUnexpectedStatusError: (error: RegistryClientError<string, unknown>, _message: string) => RegistryProblem;
|
|
82
|
+
//# sourceMappingURL=error-mapping.d.ts.map
|