@agentxm/extension-sources 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/axm-skill-gate.d.ts +64 -0
- package/dist/src/axm-skill-gate.js +25 -0
- package/dist/src/errors.d.ts +116 -0
- package/dist/src/errors.js +98 -0
- package/dist/src/failure-category.d.ts +10 -0
- package/dist/src/failure-category.js +2 -0
- package/dist/src/file-url.d.ts +9 -0
- package/dist/src/file-url.js +12 -0
- package/dist/src/git/detect.d.ts +7 -0
- package/dist/src/git/detect.js +23 -0
- package/dist/src/git/operations.d.ts +37 -0
- package/dist/src/git/operations.js +101 -0
- package/dist/src/glob.d.ts +39 -0
- package/dist/src/glob.js +79 -0
- package/dist/src/hook-package-discovery.d.ts +19 -0
- package/dist/src/hook-package-discovery.js +14 -0
- package/dist/src/index.d.ts +30 -0
- package/dist/src/index.js +35 -0
- package/dist/src/integrity.d.ts +13 -0
- package/dist/src/integrity.js +17 -0
- package/dist/src/live.d.ts +29 -0
- package/dist/src/live.js +131 -0
- package/dist/src/manifest-package-discovery.d.ts +28 -0
- package/dist/src/manifest-package-discovery.js +96 -0
- package/dist/src/package-discovery.d.ts +19 -0
- package/dist/src/package-discovery.js +137 -0
- package/dist/src/package-sources.d.ts +25 -0
- package/dist/src/package-sources.js +102 -0
- package/dist/src/providers/azurerepos/index.d.ts +11 -0
- package/dist/src/providers/azurerepos/index.js +11 -0
- package/dist/src/providers/azurerepos/repo-exists.d.ts +5 -0
- package/dist/src/providers/azurerepos/repo-exists.js +21 -0
- package/dist/src/providers/azurerepos/scp.d.ts +12 -0
- package/dist/src/providers/azurerepos/scp.js +29 -0
- package/dist/src/providers/azurerepos/shorthand.d.ts +12 -0
- package/dist/src/providers/azurerepos/shorthand.js +45 -0
- package/dist/src/providers/azurerepos/url.d.ts +14 -0
- package/dist/src/providers/azurerepos/url.js +38 -0
- package/dist/src/providers/bitbucket/index.d.ts +11 -0
- package/dist/src/providers/bitbucket/index.js +11 -0
- package/dist/src/providers/bitbucket/resolve-repo.d.ts +11 -0
- package/dist/src/providers/bitbucket/resolve-repo.js +33 -0
- package/dist/src/providers/bitbucket/scp.d.ts +11 -0
- package/dist/src/providers/bitbucket/scp.js +28 -0
- package/dist/src/providers/bitbucket/shorthand.d.ts +10 -0
- package/dist/src/providers/bitbucket/shorthand.js +11 -0
- package/dist/src/providers/bitbucket/url.d.ts +13 -0
- package/dist/src/providers/bitbucket/url.js +42 -0
- package/dist/src/providers/convention-discovery.d.ts +11 -0
- package/dist/src/providers/convention-discovery.js +473 -0
- package/dist/src/providers/git-hosting.d.ts +31 -0
- package/dist/src/providers/git-hosting.js +73 -0
- package/dist/src/providers/git.d.ts +22 -0
- package/dist/src/providers/git.js +46 -0
- package/dist/src/providers/github/index.d.ts +11 -0
- package/dist/src/providers/github/index.js +11 -0
- package/dist/src/providers/github/resolve-repo.d.ts +11 -0
- package/dist/src/providers/github/resolve-repo.js +34 -0
- package/dist/src/providers/github/scp.d.ts +11 -0
- package/dist/src/providers/github/scp.js +28 -0
- package/dist/src/providers/github/shorthand.d.ts +10 -0
- package/dist/src/providers/github/shorthand.js +11 -0
- package/dist/src/providers/github/url.d.ts +13 -0
- package/dist/src/providers/github/url.js +42 -0
- package/dist/src/providers/gitlab/index.d.ts +11 -0
- package/dist/src/providers/gitlab/index.js +11 -0
- package/dist/src/providers/gitlab/resolve-repo.d.ts +11 -0
- package/dist/src/providers/gitlab/resolve-repo.js +33 -0
- package/dist/src/providers/gitlab/scp.d.ts +11 -0
- package/dist/src/providers/gitlab/scp.js +28 -0
- package/dist/src/providers/gitlab/shorthand.d.ts +10 -0
- package/dist/src/providers/gitlab/shorthand.js +11 -0
- package/dist/src/providers/gitlab/url.d.ts +13 -0
- package/dist/src/providers/gitlab/url.js +42 -0
- package/dist/src/providers/local-parser/index.d.ts +8 -0
- package/dist/src/providers/local-parser/index.js +8 -0
- package/dist/src/providers/local-parser/parser.d.ts +13 -0
- package/dist/src/providers/local-parser/parser.js +14 -0
- package/dist/src/providers/local.d.ts +23 -0
- package/dist/src/providers/local.js +39 -0
- package/dist/src/providers/parse-provider-shorthand.d.ts +18 -0
- package/dist/src/providers/parse-provider-shorthand.js +74 -0
- package/dist/src/providers/registry/host-provider.d.ts +47 -0
- package/dist/src/providers/registry/host-provider.js +584 -0
- package/dist/src/resolve-identifier.d.ts +73 -0
- package/dist/src/resolve-identifier.js +273 -0
- package/dist/src/resolve-source-pattern.d.ts +29 -0
- package/dist/src/resolve-source-pattern.js +77 -0
- package/dist/src/resolve-source.d.ts +79 -0
- package/dist/src/resolve-source.js +503 -0
- package/dist/src/rule-package-discovery.d.ts +19 -0
- package/dist/src/rule-package-discovery.js +14 -0
- package/dist/src/service.d.ts +72 -0
- package/dist/src/service.js +109 -0
- package/dist/src/url-fragment.d.ts +5 -0
- package/dist/src/url-fragment.js +19 -0
- package/dist/src/workspace-catalog.d.ts +79 -0
- package/dist/src/workspace-catalog.js +26 -0
- package/package.json +57 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SourceHostProviders Effect service.
|
|
3
|
+
*
|
|
4
|
+
* Provides a unified interface for discovering and fetching extensions
|
|
5
|
+
* across all source types, plus clone URL and source display building.
|
|
6
|
+
*
|
|
7
|
+
* @experimental This API is unstable and may change without notice.
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
import * as ServiceMap from "effect/Context";
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
|
+
import * as Option from "effect/Option";
|
|
13
|
+
import { parseRegistrySourcePatternParts } from "@agentxm/extension-model/unstable/extensions";
|
|
14
|
+
import { printSourceParams } from "@agentxm/extension-model/unstable/sources/printer";
|
|
15
|
+
import { createRegistrySourceHostProviderFromHost } from "./providers/registry/host-provider.js";
|
|
16
|
+
import { buildCloneUrlForSource } from "./providers/git-hosting.js";
|
|
17
|
+
/**
|
|
18
|
+
* Effect service tag for source host providers.
|
|
19
|
+
*
|
|
20
|
+
* @experimental This API is unstable and may change without notice.
|
|
21
|
+
*/
|
|
22
|
+
export class SourceHostProviders extends ServiceMap.Service()("@agentxm/extension-sources/service/SourceHostProviders") {
|
|
23
|
+
}
|
|
24
|
+
// -----------------------------------------------------------------------------
|
|
25
|
+
// Clone URL Building
|
|
26
|
+
// -----------------------------------------------------------------------------
|
|
27
|
+
/**
|
|
28
|
+
* Build a git clone URL from a source.
|
|
29
|
+
* Returns Some for git-based hosting sources, None for others.
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export const buildCloneUrlFromSource = (source) => {
|
|
34
|
+
switch (source.type) {
|
|
35
|
+
case "github":
|
|
36
|
+
case "gitlab":
|
|
37
|
+
case "bitbucket":
|
|
38
|
+
case "azurerepos":
|
|
39
|
+
return Option.some(buildCloneUrlForSource(source));
|
|
40
|
+
case "git":
|
|
41
|
+
case "registry":
|
|
42
|
+
case "local":
|
|
43
|
+
case "workspace":
|
|
44
|
+
return Option.none();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
// -----------------------------------------------------------------------------
|
|
48
|
+
// Origin Building
|
|
49
|
+
// -----------------------------------------------------------------------------
|
|
50
|
+
/**
|
|
51
|
+
* Get the canonical source string for display/comparison.
|
|
52
|
+
*
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
export const getOriginFromSource = (source) => {
|
|
56
|
+
switch (source.type) {
|
|
57
|
+
case "github":
|
|
58
|
+
case "gitlab":
|
|
59
|
+
case "bitbucket":
|
|
60
|
+
return `${source.url.origin}/${source.owner}/${source.repo}`;
|
|
61
|
+
case "azurerepos":
|
|
62
|
+
return `${source.url.origin}/${source.organization}/${source.project}/_git/${source.repo}`;
|
|
63
|
+
case "local":
|
|
64
|
+
return source.path;
|
|
65
|
+
case "git":
|
|
66
|
+
return source.url.href;
|
|
67
|
+
case "registry":
|
|
68
|
+
return source.location.href;
|
|
69
|
+
case "workspace":
|
|
70
|
+
return printSourceParams(source);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
// -----------------------------------------------------------------------------
|
|
74
|
+
// Registry Meta-Provider
|
|
75
|
+
// -----------------------------------------------------------------------------
|
|
76
|
+
/**
|
|
77
|
+
* Creates a registry meta-provider that delegates find/fetch to the
|
|
78
|
+
* resolved registry host encoded in the provided `RegistrySource`.
|
|
79
|
+
*
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
export const createRegistryMetaProvider = () => ({
|
|
83
|
+
type: "registry",
|
|
84
|
+
find: (source, options) => Effect.gen(function* () {
|
|
85
|
+
// Determine owner from explicit option, or infer from @owner/name.
|
|
86
|
+
const owner = Option.isSome(options.owner)
|
|
87
|
+
? options.owner
|
|
88
|
+
: Option.isSome(source.owner)
|
|
89
|
+
? source.owner
|
|
90
|
+
: options.names.length > 0
|
|
91
|
+
? Option.fromUndefinedOr((() => {
|
|
92
|
+
const requestedName = options.names.find((name) => name.startsWith("@"));
|
|
93
|
+
return requestedName === undefined
|
|
94
|
+
? undefined
|
|
95
|
+
: parseRegistrySourcePatternParts(requestedName)?.owner;
|
|
96
|
+
})())
|
|
97
|
+
: Option.none();
|
|
98
|
+
const provider = yield* createRegistrySourceHostProviderFromHost(source);
|
|
99
|
+
const registrySource = { ...source, owner };
|
|
100
|
+
return yield* provider.find(registrySource, options);
|
|
101
|
+
}),
|
|
102
|
+
resolveNamed: (source, options) => Effect.gen(function* () {
|
|
103
|
+
const provider = yield* createRegistrySourceHostProviderFromHost(source);
|
|
104
|
+
const registrySource = { ...source, owner: Option.some(options.owner) };
|
|
105
|
+
return yield* provider.resolveNamed(registrySource, options);
|
|
106
|
+
}),
|
|
107
|
+
fetch: (source, ref) => Effect.flatMap(createRegistrySourceHostProviderFromHost(source), (provider) => provider.fetch(source, ref)),
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as Option from "effect/Option";
|
|
2
|
+
export declare const refFromFragment: (fragment: string) => Option.Option<string>;
|
|
3
|
+
export declare const refFromUrlHash: (url: URL) => Option.Option<string>;
|
|
4
|
+
export declare const stripUrlHash: (url: URL) => URL;
|
|
5
|
+
//# sourceMappingURL=url-fragment.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as Option from "effect/Option";
|
|
2
|
+
export const refFromFragment = (fragment) => {
|
|
3
|
+
const raw = fragment.startsWith("#") ? fragment.slice(1) : fragment;
|
|
4
|
+
if (raw.length === 0)
|
|
5
|
+
return Option.none();
|
|
6
|
+
try {
|
|
7
|
+
return Option.some(decodeURIComponent(raw));
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return Option.some(raw);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export const refFromUrlHash = (url) => refFromFragment(url.hash);
|
|
14
|
+
export const stripUrlHash = (url) => {
|
|
15
|
+
const clean = new URL(url.href);
|
|
16
|
+
clean.hash = "";
|
|
17
|
+
return clean;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=url-fragment.js.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace catalog port for source resolution.
|
|
3
|
+
*
|
|
4
|
+
* Source resolution interprets user input against workspace facts —
|
|
5
|
+
* configured source hosts, the desired extension graph, and the skill
|
|
6
|
+
* candidates visible on disk — without reaching into the workspace kernel.
|
|
7
|
+
* This service declares exactly those facts as data over the contract's
|
|
8
|
+
* source-host vocabulary; the composition root implements it from the
|
|
9
|
+
* workspace layer (see the application runtime's workspace-catalog Live).
|
|
10
|
+
*
|
|
11
|
+
* @experimental This API is unstable and may change without notice.
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
import type * as Effect from "effect/Effect";
|
|
15
|
+
import * as ServiceMap from "effect/Context";
|
|
16
|
+
import type { ExtensionType } from "@agentxm/extension-model/unstable/extensions";
|
|
17
|
+
import type { GitHostingSourceHost, RegistrySourceHost } from "@agentxm/extension-model/unstable/sources/types";
|
|
18
|
+
import type { SuggestedAction } from "@agentxm/registry-protocol/unstable/suggested-action";
|
|
19
|
+
import type { CarriedFailureCategory } from "./failure-category.js";
|
|
20
|
+
/**
|
|
21
|
+
* A source host the workspace has configured: a git-hosting forge or a
|
|
22
|
+
* package registry, in the contract's source-host shape.
|
|
23
|
+
*/
|
|
24
|
+
export type ConfiguredSourceHost = GitHostingSourceHost | RegistrySourceHost;
|
|
25
|
+
declare const WorkspaceCatalogUnavailable_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
26
|
+
readonly _tag: "WorkspaceCatalogUnavailable";
|
|
27
|
+
} & Readonly<A>;
|
|
28
|
+
/**
|
|
29
|
+
* The catalog implementation could not produce a workspace fact. The
|
|
30
|
+
* implementation owns the category and wording at construction; source
|
|
31
|
+
* resolution transports the failure — and keys fallback decisions on the
|
|
32
|
+
* category — without re-rendering it.
|
|
33
|
+
*/
|
|
34
|
+
export declare class WorkspaceCatalogUnavailable extends WorkspaceCatalogUnavailable_base<{
|
|
35
|
+
readonly category: CarriedFailureCategory;
|
|
36
|
+
readonly detail: string;
|
|
37
|
+
readonly suggestions?: ReadonlyArray<SuggestedAction>;
|
|
38
|
+
readonly cause?: unknown;
|
|
39
|
+
}> {
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The slice of one desired extension that source resolution consumes:
|
|
43
|
+
* enough to match a name to its configured source.
|
|
44
|
+
*/
|
|
45
|
+
export interface DesiredExtensionNodeView {
|
|
46
|
+
readonly type: ExtensionType;
|
|
47
|
+
readonly name: string;
|
|
48
|
+
readonly identity: string;
|
|
49
|
+
readonly source?: string | undefined;
|
|
50
|
+
}
|
|
51
|
+
export interface DesiredExtensionGraphView {
|
|
52
|
+
readonly complete: boolean;
|
|
53
|
+
readonly nodes: ReadonlyArray<DesiredExtensionNodeView>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Skill-name candidates for glob expansion and name fallback: locked,
|
|
57
|
+
* configured, and on-disk skills, with on-disk locations already
|
|
58
|
+
* normalized to filesystem paths.
|
|
59
|
+
*/
|
|
60
|
+
export interface SkillCandidates {
|
|
61
|
+
readonly names: ReadonlyArray<string>;
|
|
62
|
+
readonly configuredSkills: Readonly<Record<string, {
|
|
63
|
+
readonly source?: string | undefined;
|
|
64
|
+
}>>;
|
|
65
|
+
readonly onDiskByName: ReadonlyMap<string, string>;
|
|
66
|
+
}
|
|
67
|
+
export interface WorkspaceCatalogService {
|
|
68
|
+
/** Absolute workspace root directory. */
|
|
69
|
+
readonly workspaceRoot: string;
|
|
70
|
+
readonly configuredSources: Effect.Effect<ReadonlyArray<ConfiguredSourceHost>, WorkspaceCatalogUnavailable>;
|
|
71
|
+
readonly registrySourceHosts: Effect.Effect<ReadonlyArray<RegistrySourceHost>, WorkspaceCatalogUnavailable>;
|
|
72
|
+
readonly desiredExtensionGraph: Effect.Effect<DesiredExtensionGraphView, WorkspaceCatalogUnavailable>;
|
|
73
|
+
readonly skillCandidates: Effect.Effect<SkillCandidates, WorkspaceCatalogUnavailable>;
|
|
74
|
+
}
|
|
75
|
+
declare const WorkspaceCatalog_base: ServiceMap.ServiceClass<WorkspaceCatalog, "@agentxm/extension-sources/workspace-catalog/WorkspaceCatalog", WorkspaceCatalogService>;
|
|
76
|
+
export declare class WorkspaceCatalog extends WorkspaceCatalog_base {
|
|
77
|
+
}
|
|
78
|
+
export {};
|
|
79
|
+
//# sourceMappingURL=workspace-catalog.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace catalog port for source resolution.
|
|
3
|
+
*
|
|
4
|
+
* Source resolution interprets user input against workspace facts —
|
|
5
|
+
* configured source hosts, the desired extension graph, and the skill
|
|
6
|
+
* candidates visible on disk — without reaching into the workspace kernel.
|
|
7
|
+
* This service declares exactly those facts as data over the contract's
|
|
8
|
+
* source-host vocabulary; the composition root implements it from the
|
|
9
|
+
* workspace layer (see the application runtime's workspace-catalog Live).
|
|
10
|
+
*
|
|
11
|
+
* @experimental This API is unstable and may change without notice.
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
import * as Data from "effect/Data";
|
|
15
|
+
import * as ServiceMap from "effect/Context";
|
|
16
|
+
/**
|
|
17
|
+
* The catalog implementation could not produce a workspace fact. The
|
|
18
|
+
* implementation owns the category and wording at construction; source
|
|
19
|
+
* resolution transports the failure — and keys fallback decisions on the
|
|
20
|
+
* category — without re-rendering it.
|
|
21
|
+
*/
|
|
22
|
+
export class WorkspaceCatalogUnavailable extends Data.TaggedError("WorkspaceCatalogUnavailable") {
|
|
23
|
+
}
|
|
24
|
+
export class WorkspaceCatalog extends ServiceMap.Service()("@agentxm/extension-sources/workspace-catalog/WorkspaceCatalog") {
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=workspace-catalog.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentxm/extension-sources",
|
|
3
|
+
"version": "0.28.4-bootstrap.0",
|
|
4
|
+
"description": "AXM extension-source integration: source locator routing over the contract grammar, host providers for Registry, GitHub, GitLab, Bitbucket, Azure Repos, generic Git, and local paths, convention and manifest package discovery, identifier resolution, and shallow git acquisition for the axm CLI. Unstable and unsupported — use the axm.sh CLI.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "FSL-1.1-MIT",
|
|
7
|
+
"homepage": "https://axm.sh",
|
|
8
|
+
"bugs": {
|
|
9
|
+
"url": "https://github.com/agentxm/axm/issues"
|
|
10
|
+
},
|
|
11
|
+
"author": "AgentXM <hello@agentxm.ai> (https://agentxm.ai)",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/agentxm/axm.git",
|
|
15
|
+
"directory": "packages/extension-sources"
|
|
16
|
+
},
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/src/index.d.ts",
|
|
21
|
+
"default": "./dist/src/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./live": {
|
|
24
|
+
"types": "./dist/src/live.d.ts",
|
|
25
|
+
"default": "./dist/src/live.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist/src/",
|
|
30
|
+
"!**/*.map"
|
|
31
|
+
],
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=22.19.0"
|
|
37
|
+
},
|
|
38
|
+
"nx": {
|
|
39
|
+
"includedScripts": []
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"effect": "4.0.0-rc.112",
|
|
43
|
+
"semver": "^7.8.5",
|
|
44
|
+
"simple-git": "^3.36.0",
|
|
45
|
+
"@agentxm/extension-model": "^0.28.4-bootstrap.0",
|
|
46
|
+
"@agentxm/registry-client": "^0.28.4-bootstrap.0",
|
|
47
|
+
"@agentxm/registry-protocol": "^0.28.4-bootstrap.0"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@effect/platform-node": "4.0.0-rc.112",
|
|
51
|
+
"@effect/vitest": "4.0.0-rc.112",
|
|
52
|
+
"@types/semver": "^7.5.8",
|
|
53
|
+
"@typescript/native": "npm:typescript@^7.0.2",
|
|
54
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
55
|
+
"vitest": "^4.1.10"
|
|
56
|
+
}
|
|
57
|
+
}
|