@agentxm/workspace-inspection 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/dist/src/errors.d.ts +21 -0
- package/dist/src/errors.js +19 -0
- package/dist/src/extension-list.d.ts +35 -0
- package/dist/src/extension-list.js +263 -0
- package/dist/src/failure-adapter.d.ts +20 -0
- package/dist/src/failure-adapter.js +14 -0
- package/dist/src/index.d.ts +13 -0
- package/dist/src/index.js +13 -0
- package/dist/src/version-currency/check-currency.d.ts +41 -0
- package/dist/src/version-currency/check-currency.js +53 -0
- package/dist/src/version-currency/collectors.d.ts +162 -0
- package/dist/src/version-currency/collectors.js +287 -0
- package/dist/src/version-currency/index.d.ts +11 -0
- package/dist/src/version-currency/index.js +11 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, MIT Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-MIT
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2025-2026 AgentXM, Inc.
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the MIT license that is effective on the second anniversary of the date we make
|
|
91
|
+
the Software available. On or after that date, you may use the Software under
|
|
92
|
+
the MIT license, in which case the following will apply:
|
|
93
|
+
|
|
94
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
95
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
96
|
+
the Software without restriction, including without limitation the rights to
|
|
97
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
98
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
99
|
+
so, subject to the following conditions:
|
|
100
|
+
|
|
101
|
+
The above copyright notice and this permission notice shall be included in all
|
|
102
|
+
copies or substantial portions of the Software.
|
|
103
|
+
|
|
104
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
105
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
106
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
107
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
108
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
109
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
110
|
+
SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed failures for workspace-inspection queries. The producer owns the
|
|
3
|
+
* category choice and user-facing wording; the application boundary converts
|
|
4
|
+
* the carried fields into its error envelope verbatim.
|
|
5
|
+
*
|
|
6
|
+
* @experimental This API is unstable and may change without notice.
|
|
7
|
+
*/
|
|
8
|
+
import * as Schema from "effect/Schema";
|
|
9
|
+
declare const WorkspaceInspectionFailed_base: Schema.Class<WorkspaceInspectionFailed, Schema.TaggedStruct<"WorkspaceInspectionFailed", {
|
|
10
|
+
readonly category: Schema.Literals<readonly ["internal", "validation"]>;
|
|
11
|
+
readonly detail: Schema.String;
|
|
12
|
+
readonly cause: Schema.optional<Schema.Unknown>;
|
|
13
|
+
}>, import("effect/Cause").YieldableError>;
|
|
14
|
+
/**
|
|
15
|
+
* A workspace-inspection query could not proceed. `category` and `detail`
|
|
16
|
+
* carry the boundary rendering 1:1.
|
|
17
|
+
*/
|
|
18
|
+
export declare class WorkspaceInspectionFailed extends WorkspaceInspectionFailed_base {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed failures for workspace-inspection queries. The producer owns the
|
|
3
|
+
* category choice and user-facing wording; the application boundary converts
|
|
4
|
+
* the carried fields into its error envelope verbatim.
|
|
5
|
+
*
|
|
6
|
+
* @experimental This API is unstable and may change without notice.
|
|
7
|
+
*/
|
|
8
|
+
import * as Schema from "effect/Schema";
|
|
9
|
+
/**
|
|
10
|
+
* A workspace-inspection query could not proceed. `category` and `detail`
|
|
11
|
+
* carry the boundary rendering 1:1.
|
|
12
|
+
*/
|
|
13
|
+
export class WorkspaceInspectionFailed extends Schema.TaggedError()("WorkspaceInspectionFailed", {
|
|
14
|
+
category: Schema.Literals(["internal", "validation"]),
|
|
15
|
+
detail: Schema.String,
|
|
16
|
+
cause: Schema.optional(Schema.Unknown),
|
|
17
|
+
}) {
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import { type InstallableExtensionType } from "@agentxm/extension-model/unstable/extensions/installable-types";
|
|
3
|
+
import type { DeprecationView } from "@agentxm/extension-model/unstable/extensions/deprecation";
|
|
4
|
+
import { SourceHostProviders } from "@agentxm/extension-sources";
|
|
5
|
+
import { WorkspaceMutations } from "@agentxm/workspace-state";
|
|
6
|
+
import { WorkspaceInspectionFailed } from "./errors.js";
|
|
7
|
+
import { InspectionFailureAdapter } from "./failure-adapter.js";
|
|
8
|
+
export type ExtensionListFilter = "all" | "outdated" | "deprecated";
|
|
9
|
+
export type ExtensionAssessmentState = "not-checked" | "current" | "available" | "changed" | "active" | "deprecated" | "unknown" | "not-applicable";
|
|
10
|
+
export interface ExtensionAssessment {
|
|
11
|
+
readonly state: ExtensionAssessmentState;
|
|
12
|
+
readonly reason?: string;
|
|
13
|
+
readonly installedVersion?: string;
|
|
14
|
+
readonly constraint?: string;
|
|
15
|
+
readonly latestMatching?: string;
|
|
16
|
+
readonly latestAvailable?: string;
|
|
17
|
+
readonly installedRevision?: string;
|
|
18
|
+
readonly currentRevision?: string;
|
|
19
|
+
readonly deprecation?: DeprecationView;
|
|
20
|
+
}
|
|
21
|
+
export interface ExtensionListItem {
|
|
22
|
+
readonly ref: string;
|
|
23
|
+
readonly type: InstallableExtensionType;
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly management: "configured" | "implicit" | "unmanaged";
|
|
26
|
+
readonly installed: boolean;
|
|
27
|
+
readonly enabled: boolean | null;
|
|
28
|
+
readonly version?: string;
|
|
29
|
+
readonly source?: string;
|
|
30
|
+
readonly sourceName?: string;
|
|
31
|
+
readonly assessment: ExtensionAssessment;
|
|
32
|
+
}
|
|
33
|
+
export declare const collectExtensionListItems: (type?: "skill" | "mcp-server" | "subagent" | "rule" | "hook" | "knowledge" | "pack" | undefined) => Effect.Effect<ExtensionListItem[], import("@agentxm/workspace-state").LockfileIoError | import("@agentxm/workspace-state").LockfileParseError | import("@agentxm/workspace-state").LockfileDecodeError | import("@agentxm/workspace-state").WorkspaceRootEscape | import("@agentxm/workspace-state").SettingsIoError | import("@agentxm/workspace-state").SettingsParseError | import("@agentxm/workspace-state").SettingsDecodeError, WorkspaceMutations>;
|
|
34
|
+
export declare const assessExtensionListItems: (items: readonly ExtensionListItem[], filter: "outdated" | "deprecated") => Effect.Effect<ExtensionListItem[], WorkspaceInspectionFailed | import("@agentxm/workspace-state").LockfileIoError | import("@agentxm/workspace-state").LockfileParseError | import("@agentxm/workspace-state").LockfileDecodeError | import("@agentxm/workspace-state").WorkspaceRootEscape | import("@agentxm/workspace-state").SettingsIoError | import("@agentxm/workspace-state").SettingsParseError | import("@agentxm/workspace-state").SettingsDecodeError | import("@agentxm/registry-client").RegistryProblem | import("@agentxm/registry-client").RegistryRequestFailed | import("@agentxm/registry-client").RegistryOperationFailed, InspectionFailureAdapter | WorkspaceMutations | import("effect/FileSystem").FileSystem | import("effect/unstable/http/HttpClient").HttpClient | import("effect/Path").Path | import("@agentxm/extension-sources").WorkspaceCatalog | SourceHostProviders | import("effect/Scope").Scope>;
|
|
35
|
+
//# sourceMappingURL=extension-list.d.ts.map
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Option from "effect/Option";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
|
+
import * as semver from "semver";
|
|
5
|
+
import { extensionTypeToPlural, parseExtensionFqnParts, parseSourceQualifiedRegistrySourcePatternParts, } from "@agentxm/extension-model/unstable/extensions";
|
|
6
|
+
import { installableExtensionTypes, } from "@agentxm/extension-model/unstable/extensions/installable-types";
|
|
7
|
+
import {} from "@agentxm/extension-model/unstable/extensions/refs/extension-ref";
|
|
8
|
+
import { createRegistryClient } from "@agentxm/registry-client";
|
|
9
|
+
import { resolveSource, SourceHostProviders } from "@agentxm/extension-sources";
|
|
10
|
+
import { printSourceParams } from "@agentxm/extension-model/unstable/sources/printer";
|
|
11
|
+
import { lockEntryToSourceParams } from "@agentxm/workspace-state";
|
|
12
|
+
import { isWorkspaceSourceLocator } from "@agentxm/extension-model/unstable/sources/workspace";
|
|
13
|
+
import { VersionSchema } from "@agentxm/extension-model/unstable/version-constraints";
|
|
14
|
+
import { WorkspaceMutations, } from "@agentxm/workspace-state";
|
|
15
|
+
import { checkCurrency } from "./version-currency/index.js";
|
|
16
|
+
import { WorkspaceInspectionFailed } from "./errors.js";
|
|
17
|
+
import { InspectionFailureAdapter } from "./failure-adapter.js";
|
|
18
|
+
const getAcceptedEntry = (ws, type, name) => {
|
|
19
|
+
switch (type) {
|
|
20
|
+
case "skill":
|
|
21
|
+
return ws.getLockedSkill(name);
|
|
22
|
+
case "mcp-server":
|
|
23
|
+
return ws.getLockedMcpServer(name);
|
|
24
|
+
case "subagent":
|
|
25
|
+
return ws.getLockedSubagent(name);
|
|
26
|
+
case "rule":
|
|
27
|
+
return ws.getLockedRuleEntry(name);
|
|
28
|
+
case "hook":
|
|
29
|
+
return ws.getLockedHookEntry(name);
|
|
30
|
+
case "knowledge":
|
|
31
|
+
return ws.getLockedKnowledgeEntry(name);
|
|
32
|
+
case "pack":
|
|
33
|
+
return ws.getLockedPack(name);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const recordSource = (row) => {
|
|
37
|
+
if (row === undefined)
|
|
38
|
+
return undefined;
|
|
39
|
+
const source = row.source;
|
|
40
|
+
if (source === undefined)
|
|
41
|
+
return undefined;
|
|
42
|
+
return typeof source === "string" ? source : Option.getOrUndefined(source);
|
|
43
|
+
};
|
|
44
|
+
const refName = (ref) => {
|
|
45
|
+
switch (ref.type) {
|
|
46
|
+
case "skill":
|
|
47
|
+
return ref.skill.name;
|
|
48
|
+
case "mcp-server":
|
|
49
|
+
return ref.server.name;
|
|
50
|
+
case "subagent":
|
|
51
|
+
return ref.subagent.name;
|
|
52
|
+
case "rule":
|
|
53
|
+
return ref.rule.name;
|
|
54
|
+
case "hook":
|
|
55
|
+
return ref.hook.name;
|
|
56
|
+
case "knowledge":
|
|
57
|
+
return ref.knowledge.name;
|
|
58
|
+
case "pack":
|
|
59
|
+
return ref.pack.name;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const inventoryKey = (type, name) => `${type}:${name}`;
|
|
63
|
+
export const collectExtensionListItems = Effect.fn("Workspace.collectExtensionListItems")(function* (type) {
|
|
64
|
+
const ws = yield* WorkspaceMutations;
|
|
65
|
+
const inventory = yield* ws.records.getInventory(type === undefined ? {} : { type });
|
|
66
|
+
const types = type === undefined ? installableExtensionTypes : [type];
|
|
67
|
+
const rowsByKey = new Map();
|
|
68
|
+
const rowsByType = yield* Effect.forEach(types, (itemType) => ws.records.rows(itemType), {
|
|
69
|
+
concurrency: "unbounded",
|
|
70
|
+
});
|
|
71
|
+
for (const row of rowsByType.flat()) {
|
|
72
|
+
rowsByKey.set(inventoryKey(row.type, row.name), row);
|
|
73
|
+
}
|
|
74
|
+
const [skills, mcps, subagents, rules, hooks, knowledge, packs] = yield* Effect.all([
|
|
75
|
+
ws.getLockedSkills(),
|
|
76
|
+
ws.getLockedMcpServers(),
|
|
77
|
+
ws.getLockedSubagents(),
|
|
78
|
+
ws.getLockedRules(),
|
|
79
|
+
ws.getLockedHooks(),
|
|
80
|
+
ws.getLockedKnowledge(),
|
|
81
|
+
ws.getLockedPacks(),
|
|
82
|
+
]);
|
|
83
|
+
const accepted = (itemType, name) => {
|
|
84
|
+
switch (itemType) {
|
|
85
|
+
case "skill":
|
|
86
|
+
return skills[name];
|
|
87
|
+
case "mcp-server":
|
|
88
|
+
return mcps[name];
|
|
89
|
+
case "subagent":
|
|
90
|
+
return subagents[name];
|
|
91
|
+
case "rule":
|
|
92
|
+
return rules[name];
|
|
93
|
+
case "hook":
|
|
94
|
+
return hooks[name];
|
|
95
|
+
case "knowledge":
|
|
96
|
+
return knowledge[name];
|
|
97
|
+
case "pack":
|
|
98
|
+
return packs[name];
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
return inventory.items.map((row) => {
|
|
102
|
+
const locked = accepted(row.type, row.name);
|
|
103
|
+
const configuredSource = recordSource(rowsByKey.get(inventoryKey(row.type, row.name)));
|
|
104
|
+
const lockedSource = locked === undefined ? undefined : printSourceParams(lockEntryToSourceParams(locked));
|
|
105
|
+
const source = configuredSource ?? lockedSource;
|
|
106
|
+
const identitySource = locked?.type === "registry"
|
|
107
|
+
? `${locked.owner}/${extensionTypeToPlural[row.type]}/${locked.name}`
|
|
108
|
+
: (configuredSource ?? lockedSource);
|
|
109
|
+
const fqnSource = identitySource !== undefined && isWorkspaceSourceLocator(identitySource)
|
|
110
|
+
? identitySource.slice("workspace:".length)
|
|
111
|
+
: identitySource;
|
|
112
|
+
const parsed = fqnSource === undefined ? undefined : parseExtensionFqnParts(fqnSource);
|
|
113
|
+
const ref = parsed === undefined
|
|
114
|
+
? `${extensionTypeToPlural[row.type]}/${row.name}`
|
|
115
|
+
: `${parsed.owner}/${extensionTypeToPlural[parsed.type]}/${parsed.name}`;
|
|
116
|
+
return {
|
|
117
|
+
ref,
|
|
118
|
+
type: row.type,
|
|
119
|
+
name: row.name,
|
|
120
|
+
management: row.classification.lifecycle,
|
|
121
|
+
installed: row.installed,
|
|
122
|
+
enabled: row.enabled,
|
|
123
|
+
...(locked?.type === "registry" ? { version: locked.resolvedVersion } : {}),
|
|
124
|
+
...(source === undefined ? {} : { source }),
|
|
125
|
+
...(locked?.type === "registry" ? { sourceName: locked.sourceName } : {}),
|
|
126
|
+
assessment: { state: "not-checked" },
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
const decodeInstalledVersion = (value, ref) => Schema.decodeUnknownEffect(VersionSchema)(value).pipe(Effect.mapError(() => new WorkspaceInspectionFailed({
|
|
131
|
+
category: "validation",
|
|
132
|
+
detail: `Accepted version for ${ref} is invalid`,
|
|
133
|
+
})));
|
|
134
|
+
const constraintFromSource = (source) => {
|
|
135
|
+
if (source === undefined)
|
|
136
|
+
return Option.none();
|
|
137
|
+
const parsed = parseSourceQualifiedRegistrySourcePatternParts(source);
|
|
138
|
+
return Option.fromUndefinedOr(parsed?.versionRange);
|
|
139
|
+
};
|
|
140
|
+
const registryAssessment = Effect.fn("Workspace.registryExtensionAssessment")(function* (item, filter, record) {
|
|
141
|
+
const ws = yield* WorkspaceMutations;
|
|
142
|
+
if (record.type !== "registry") {
|
|
143
|
+
return {
|
|
144
|
+
state: "unknown",
|
|
145
|
+
reason: "Missing accepted Registry identity",
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
const identity = { owner: record.owner, type: item.type, name: record.name };
|
|
149
|
+
const sourceName = record.sourceName;
|
|
150
|
+
const source = yield* ws.getConfiguredSourceByName(sourceName);
|
|
151
|
+
if (Option.isNone(source) || source.value.type !== "registry") {
|
|
152
|
+
return {
|
|
153
|
+
state: "unknown",
|
|
154
|
+
reason: `Supplying Registry source "${sourceName}" is not configured`,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
const client = yield* createRegistryClient(source.value.location.href);
|
|
158
|
+
const index = yield* client.getExtensionIndex({
|
|
159
|
+
owner: identity.owner,
|
|
160
|
+
type: identity.type,
|
|
161
|
+
name: identity.name,
|
|
162
|
+
});
|
|
163
|
+
if (Option.isNone(index)) {
|
|
164
|
+
return {
|
|
165
|
+
state: "unknown",
|
|
166
|
+
reason: "Extension index was not found",
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
if (filter === "deprecated") {
|
|
170
|
+
return index.value.deprecation === null
|
|
171
|
+
? { state: "active" }
|
|
172
|
+
: {
|
|
173
|
+
state: "deprecated",
|
|
174
|
+
deprecation: index.value.deprecation,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
const installedVersion = yield* decodeInstalledVersion(record.resolvedVersion, item.ref);
|
|
178
|
+
const constraint = constraintFromSource(item.source);
|
|
179
|
+
const currency = checkCurrency(installedVersion, constraint, index.value);
|
|
180
|
+
const updateAvailable = Option.exists(currency.latestMatching, (latestMatching) => semver.gt(latestMatching, installedVersion));
|
|
181
|
+
return {
|
|
182
|
+
state: updateAvailable ? "available" : "current",
|
|
183
|
+
installedVersion,
|
|
184
|
+
...Option.match(constraint, {
|
|
185
|
+
onNone: () => ({}),
|
|
186
|
+
onSome: (value) => ({ constraint: value }),
|
|
187
|
+
}),
|
|
188
|
+
...Option.match(currency.latestMatching, {
|
|
189
|
+
onNone: () => ({}),
|
|
190
|
+
onSome: (value) => ({ latestMatching: value }),
|
|
191
|
+
}),
|
|
192
|
+
latestAvailable: currency.latestAvailable,
|
|
193
|
+
};
|
|
194
|
+
});
|
|
195
|
+
const gitAssessment = Effect.fn("Workspace.gitExtensionAssessment")(function* (item, record) {
|
|
196
|
+
const providers = yield* SourceHostProviders;
|
|
197
|
+
const adapter = yield* InspectionFailureAdapter;
|
|
198
|
+
if (record.type === "registry" || record.type === "local") {
|
|
199
|
+
return {
|
|
200
|
+
state: "unknown",
|
|
201
|
+
reason: "Accepted immutable resolution is missing",
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
const source = yield* resolveSource(printSourceParams(lockEntryToSourceParams(record))).pipe(Effect.result);
|
|
205
|
+
if (source._tag === "Failure") {
|
|
206
|
+
return {
|
|
207
|
+
state: "unknown",
|
|
208
|
+
reason: adapter.describeFailure(source.failure),
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
const refs = yield* providers
|
|
212
|
+
.find(source.success, {
|
|
213
|
+
names: [item.name],
|
|
214
|
+
type: item.type,
|
|
215
|
+
owner: Option.none(),
|
|
216
|
+
versionRange: Option.none(),
|
|
217
|
+
})
|
|
218
|
+
.pipe(Effect.result);
|
|
219
|
+
if (refs._tag === "Failure") {
|
|
220
|
+
return {
|
|
221
|
+
state: "unknown",
|
|
222
|
+
reason: adapter.describeFailure(refs.failure),
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
const match = refs.success.find((ref) => ref.type === item.type && refName(ref) === item.name);
|
|
226
|
+
if (match === undefined || match.refType !== "git-hosted") {
|
|
227
|
+
return {
|
|
228
|
+
state: "unknown",
|
|
229
|
+
reason: "Source revision could not be compared",
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
return {
|
|
233
|
+
state: match.gitTreeSha === record.resolvedTree && match.gitCommitSha === record.resolvedCommit
|
|
234
|
+
? "current"
|
|
235
|
+
: "changed",
|
|
236
|
+
installedRevision: `${record.resolvedCommit}:${record.resolvedTree}`,
|
|
237
|
+
currentRevision: `${match.gitCommitSha}:${match.gitTreeSha}`,
|
|
238
|
+
};
|
|
239
|
+
});
|
|
240
|
+
const gitAuthorities = new Set(["github", "gitlab", "bitbucket", "azurerepos", "git"]);
|
|
241
|
+
const assessItem = (item, filter, record) => Effect.gen(function* () {
|
|
242
|
+
if (!item.installed)
|
|
243
|
+
return { state: "not-applicable" };
|
|
244
|
+
if (record === undefined) {
|
|
245
|
+
return {
|
|
246
|
+
state: "unknown",
|
|
247
|
+
reason: "Installed extension has no accepted external resolution",
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
if (record.type === "registry")
|
|
251
|
+
return yield* registryAssessment(item, filter, record);
|
|
252
|
+
if (filter === "outdated" && gitAuthorities.has(record.type)) {
|
|
253
|
+
return yield* gitAssessment(item, record);
|
|
254
|
+
}
|
|
255
|
+
return { state: "not-applicable" };
|
|
256
|
+
});
|
|
257
|
+
export const assessExtensionListItems = Effect.fn("Workspace.assessExtensionListItems")(function* (items, filter) {
|
|
258
|
+
const ws = yield* WorkspaceMutations;
|
|
259
|
+
return yield* Effect.forEach(items, (item) => {
|
|
260
|
+
return getAcceptedEntry(ws, item.type, item.name).pipe(Effect.flatMap((accepted) => assessItem(item, filter, Option.getOrUndefined(accepted))), Effect.map((assessment) => ({ ...item, assessment })));
|
|
261
|
+
}, { concurrency: 6 });
|
|
262
|
+
});
|
|
263
|
+
//# sourceMappingURL=extension-list.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The application-supplied conversion from typed failures to the diagnostic
|
|
3
|
+
* sentences inspection results embed as `reason` text. Error rendering is
|
|
4
|
+
* application-owned: the CLI implements this with the same dispatcher it uses
|
|
5
|
+
* at its output boundary, so reasons inside assessments stay byte-identical
|
|
6
|
+
* with rendered errors. The feature keeps only the requirement, never the
|
|
7
|
+
* mapping.
|
|
8
|
+
*
|
|
9
|
+
* @experimental This API is unstable and may change without notice.
|
|
10
|
+
*/
|
|
11
|
+
import * as ServiceMap from "effect/Context";
|
|
12
|
+
export interface InspectionFailureAdapterService {
|
|
13
|
+
/** Render a failure as the diagnostic sentence an assessment reports. */
|
|
14
|
+
readonly describeFailure: (failure: unknown) => string;
|
|
15
|
+
}
|
|
16
|
+
declare const InspectionFailureAdapter_base: ServiceMap.ServiceClass<InspectionFailureAdapter, "@agentxm/workspace-inspection/failure-adapter/InspectionFailureAdapter", InspectionFailureAdapterService>;
|
|
17
|
+
export declare class InspectionFailureAdapter extends InspectionFailureAdapter_base {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=failure-adapter.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The application-supplied conversion from typed failures to the diagnostic
|
|
3
|
+
* sentences inspection results embed as `reason` text. Error rendering is
|
|
4
|
+
* application-owned: the CLI implements this with the same dispatcher it uses
|
|
5
|
+
* at its output boundary, so reasons inside assessments stay byte-identical
|
|
6
|
+
* with rendered errors. The feature keeps only the requirement, never the
|
|
7
|
+
* mapping.
|
|
8
|
+
*
|
|
9
|
+
* @experimental This API is unstable and may change without notice.
|
|
10
|
+
*/
|
|
11
|
+
import * as ServiceMap from "effect/Context";
|
|
12
|
+
export class InspectionFailureAdapter extends ServiceMap.Service()("@agentxm/workspace-inspection/failure-adapter/InspectionFailureAdapter") {
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=failure-adapter.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace-inspection feature: read-only assessment of the workspace's
|
|
3
|
+
* extension inventory against registries and sources (listing and
|
|
4
|
+
* version-currency checks).
|
|
5
|
+
*
|
|
6
|
+
* @experimental This API is unstable and may change without notice.
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export { WorkspaceInspectionFailed } from "./errors.js";
|
|
10
|
+
export { InspectionFailureAdapter, type InspectionFailureAdapterService, } from "./failure-adapter.js";
|
|
11
|
+
export { assessExtensionListItems, collectExtensionListItems, type ExtensionAssessment, type ExtensionAssessmentState, type ExtensionListFilter, type ExtensionListItem, } from "./extension-list.js";
|
|
12
|
+
export { checkCurrency, collectAllCurrencyEntries, collectAllUpdateEntries, collectHookCurrency, collectKnowledgeCurrency, collectMcpServerCurrency, collectPackCurrency, collectRuleCurrency, collectSkillCurrency, collectSkillSourceFreshness, collectMcpServerSourceFreshness, collectSubagentSourceFreshness, collectRuleSourceFreshness, collectHookSourceFreshness, collectKnowledgeSourceFreshness, sourceFreshnessCollectors, collectSubagentCurrency, type CurrencyResult, type CurrencyStatus, type ExtensionCurrencyEntry, type ExtensionSourceFreshnessEntry, type ExtensionUpdateEntry, } from "./version-currency/index.js";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace-inspection feature: read-only assessment of the workspace's
|
|
3
|
+
* extension inventory against registries and sources (listing and
|
|
4
|
+
* version-currency checks).
|
|
5
|
+
*
|
|
6
|
+
* @experimental This API is unstable and may change without notice.
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export { WorkspaceInspectionFailed } from "./errors.js";
|
|
10
|
+
export { InspectionFailureAdapter, } from "./failure-adapter.js";
|
|
11
|
+
export { assessExtensionListItems, collectExtensionListItems, } from "./extension-list.js";
|
|
12
|
+
export { checkCurrency, collectAllCurrencyEntries, collectAllUpdateEntries, collectHookCurrency, collectKnowledgeCurrency, collectMcpServerCurrency, collectPackCurrency, collectRuleCurrency, collectSkillCurrency, collectSkillSourceFreshness, collectMcpServerSourceFreshness, collectSubagentSourceFreshness, collectRuleSourceFreshness, collectHookSourceFreshness, collectKnowledgeSourceFreshness, sourceFreshnessCollectors, collectSubagentCurrency, } from "./version-currency/index.js";
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Currency assessment for a single extension version.
|
|
3
|
+
*
|
|
4
|
+
* Compares an installed version against the versions available in an
|
|
5
|
+
* ExtensionIndex, respecting an optional version constraint.
|
|
6
|
+
*
|
|
7
|
+
* @experimental This API is unstable and may change without notice.
|
|
8
|
+
*/
|
|
9
|
+
import * as Option from "effect/Option";
|
|
10
|
+
import type { Version } from "@agentxm/extension-model/unstable/version-constraints";
|
|
11
|
+
import type { ExtensionIndex } from "@agentxm/registry-protocol/unstable/registry/schema";
|
|
12
|
+
/**
|
|
13
|
+
* Currency status for a single extension.
|
|
14
|
+
*
|
|
15
|
+
* - `current` — installed version matches the latest satisfying version.
|
|
16
|
+
* - `update-available` — a newer version exists within the same major line.
|
|
17
|
+
* - `major-update-available` — a newer major version exists.
|
|
18
|
+
*/
|
|
19
|
+
export type CurrencyStatus = "current" | "update-available" | "major-update-available";
|
|
20
|
+
/**
|
|
21
|
+
* Result of a currency check for a single extension.
|
|
22
|
+
*
|
|
23
|
+
* @experimental This API is unstable and may change without notice.
|
|
24
|
+
*/
|
|
25
|
+
export interface CurrencyResult {
|
|
26
|
+
readonly status: CurrencyStatus;
|
|
27
|
+
readonly installedVersion: Version;
|
|
28
|
+
/** Latest version satisfying the declared constraint. None when no version satisfies. */
|
|
29
|
+
readonly latestMatching: Option.Option<Version>;
|
|
30
|
+
/** Absolute latest version in the index (regardless of constraint). */
|
|
31
|
+
readonly latestAvailable: Version;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Assess version currency for a single extension.
|
|
35
|
+
*
|
|
36
|
+
* @param installedVersion - Currently installed version.
|
|
37
|
+
* @param constraint - Optional version constraint from settings (e.g. `^1.0.0`).
|
|
38
|
+
* @param index - Extension index containing all available versions (newest-first).
|
|
39
|
+
*/
|
|
40
|
+
export declare const checkCurrency: (installedVersion: Version, constraint: Option.Option<string>, index: ExtensionIndex) => CurrencyResult;
|
|
41
|
+
//# sourceMappingURL=check-currency.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Currency assessment for a single extension version.
|
|
3
|
+
*
|
|
4
|
+
* Compares an installed version against the versions available in an
|
|
5
|
+
* ExtensionIndex, respecting an optional version constraint.
|
|
6
|
+
*
|
|
7
|
+
* @experimental This API is unstable and may change without notice.
|
|
8
|
+
*/
|
|
9
|
+
import * as Option from "effect/Option";
|
|
10
|
+
import * as semver from "semver";
|
|
11
|
+
import { resolveVersionInRange } from "@agentxm/extension-model/unstable/version-constraints";
|
|
12
|
+
import { selectVersion } from "@agentxm/registry-client";
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// Logic
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
/**
|
|
17
|
+
* Assess version currency for a single extension.
|
|
18
|
+
*
|
|
19
|
+
* @param installedVersion - Currently installed version.
|
|
20
|
+
* @param constraint - Optional version constraint from settings (e.g. `^1.0.0`).
|
|
21
|
+
* @param index - Extension index containing all available versions (newest-first).
|
|
22
|
+
*/
|
|
23
|
+
export const checkCurrency = (installedVersion, constraint, index) => {
|
|
24
|
+
const latestEntry = selectVersion(index.versions);
|
|
25
|
+
// The index should always have at least one version; fall back to installed.
|
|
26
|
+
const latestAvailable = Option.match(latestEntry, {
|
|
27
|
+
onNone: () => installedVersion,
|
|
28
|
+
onSome: (entry) => entry.version,
|
|
29
|
+
});
|
|
30
|
+
const matchingEntry = resolveVersionInRange(index.versions, constraint);
|
|
31
|
+
const latestMatching = Option.map(matchingEntry, (entry) => entry.version);
|
|
32
|
+
const status = determineStatus(installedVersion, latestMatching, latestAvailable);
|
|
33
|
+
return { status, installedVersion, latestMatching, latestAvailable };
|
|
34
|
+
};
|
|
35
|
+
const determineStatus = (installed, latestMatching, latestAvailable) => {
|
|
36
|
+
const installedMajor = semver.major(installed);
|
|
37
|
+
const availableMajor = semver.major(latestAvailable);
|
|
38
|
+
if (!semver.gt(latestAvailable, installed)) {
|
|
39
|
+
return "current";
|
|
40
|
+
}
|
|
41
|
+
if (availableMajor > installedMajor) {
|
|
42
|
+
return "major-update-available";
|
|
43
|
+
}
|
|
44
|
+
if (Option.isNone(latestMatching)) {
|
|
45
|
+
// No matching version found — treat as update-available since latest is same major.
|
|
46
|
+
return "update-available";
|
|
47
|
+
}
|
|
48
|
+
if (semver.gt(latestMatching.value, installed)) {
|
|
49
|
+
return "update-available";
|
|
50
|
+
}
|
|
51
|
+
return "current";
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=check-currency.js.map
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-type currency collectors and aggregator.
|
|
3
|
+
*
|
|
4
|
+
* Reads configured and locked entries from the WorkspaceMutations service, filters to
|
|
5
|
+
* enabled registry-sourced entries, fetches each extension's index from
|
|
6
|
+
* RegistryClient, and produces an array of ExtensionCurrencyEntry.
|
|
7
|
+
*
|
|
8
|
+
* @experimental This API is unstable and may change without notice.
|
|
9
|
+
*/
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import * as Option from "effect/Option";
|
|
12
|
+
import type { ExtensionType } from "@agentxm/extension-model/unstable/extensions";
|
|
13
|
+
import type { RegistryClient } from "@agentxm/registry-client";
|
|
14
|
+
import { SourceHostProviders } from "@agentxm/extension-sources";
|
|
15
|
+
import { type Version, type VersionRange } from "@agentxm/extension-model/unstable/version-constraints";
|
|
16
|
+
import { WorkspaceMutations } from "@agentxm/workspace-state";
|
|
17
|
+
import { type CurrencyResult } from "./check-currency.js";
|
|
18
|
+
import { WorkspaceInspectionFailed } from "../errors.js";
|
|
19
|
+
import { InspectionFailureAdapter } from "../failure-adapter.js";
|
|
20
|
+
/**
|
|
21
|
+
* Currency assessment for a single installed extension.
|
|
22
|
+
*
|
|
23
|
+
* @experimental This API is unstable and may change without notice.
|
|
24
|
+
*/
|
|
25
|
+
export interface ExtensionCurrencyEntry {
|
|
26
|
+
readonly kind: "registry-version";
|
|
27
|
+
/** Fully-qualified name: `@owner/type/name`. */
|
|
28
|
+
readonly ref: string;
|
|
29
|
+
readonly type: ExtensionType;
|
|
30
|
+
readonly installedVersion: Version;
|
|
31
|
+
readonly constraint: Option.Option<VersionRange>;
|
|
32
|
+
readonly currency: CurrencyResult;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Source freshness assessment for a Git-hosted extension.
|
|
36
|
+
*
|
|
37
|
+
* @experimental This API is unstable and may change without notice.
|
|
38
|
+
*/
|
|
39
|
+
export interface ExtensionSourceFreshnessEntry {
|
|
40
|
+
readonly kind: "source-freshness";
|
|
41
|
+
readonly ref: string;
|
|
42
|
+
readonly type: ExtensionType;
|
|
43
|
+
readonly source: string;
|
|
44
|
+
readonly installedTreeHash: Option.Option<string>;
|
|
45
|
+
readonly currentTreeHash: Option.Option<string>;
|
|
46
|
+
readonly status: "current" | "changed" | "unknown";
|
|
47
|
+
readonly reason: Option.Option<string>;
|
|
48
|
+
}
|
|
49
|
+
export type ExtensionUpdateEntry = ExtensionCurrencyEntry | ExtensionSourceFreshnessEntry;
|
|
50
|
+
/**
|
|
51
|
+
* Compare desired Git-hosted entries against their accepted immutable revision.
|
|
52
|
+
*/
|
|
53
|
+
declare const collectSourceFreshness: (args: {
|
|
54
|
+
readonly extensionType: ExtensionType;
|
|
55
|
+
}) => Effect.Effect<ExtensionSourceFreshnessEntry[], WorkspaceInspectionFailed | import("@agentxm/workspace-state").LockfileIoError | import("@agentxm/workspace-state").LockfileParseError | import("@agentxm/workspace-state").LockfileDecodeError | import("@agentxm/workspace-state").WorkspaceRootEscape | import("@agentxm/workspace-state").SettingsIoError | import("@agentxm/workspace-state").SettingsParseError | import("@agentxm/workspace-state").SettingsDecodeError, InspectionFailureAdapter | WorkspaceMutations | import("effect/FileSystem").FileSystem | import("effect/unstable/http/HttpClient").HttpClient | import("effect/Path").Path | import("@agentxm/extension-sources").WorkspaceCatalog | SourceHostProviders | import("effect/Scope").Scope>;
|
|
56
|
+
type SourceFreshnessCollector = () => ReturnType<typeof collectSourceFreshness>;
|
|
57
|
+
export declare const collectSkillSourceFreshness: SourceFreshnessCollector;
|
|
58
|
+
export declare const collectMcpServerSourceFreshness: SourceFreshnessCollector;
|
|
59
|
+
export declare const collectSubagentSourceFreshness: SourceFreshnessCollector;
|
|
60
|
+
export declare const collectRuleSourceFreshness: SourceFreshnessCollector;
|
|
61
|
+
export declare const collectHookSourceFreshness: SourceFreshnessCollector;
|
|
62
|
+
export declare const collectKnowledgeSourceFreshness: SourceFreshnessCollector;
|
|
63
|
+
/** Every per-type git-source freshness collector, in catalog order. */
|
|
64
|
+
export declare const sourceFreshnessCollectors: ReadonlyArray<SourceFreshnessCollector>;
|
|
65
|
+
/**
|
|
66
|
+
* Collect currency entries for all enabled, registry-sourced skills.
|
|
67
|
+
*/
|
|
68
|
+
export declare const collectSkillCurrency: (client: RegistryClient) => Effect.Effect<{
|
|
69
|
+
kind: "registry-version";
|
|
70
|
+
ref: string;
|
|
71
|
+
type: "skill" | "mcp-server" | "subagent" | "rule" | "hook" | "knowledge" | "pack";
|
|
72
|
+
installedVersion: string & import("effect/Brand").Brand<"Version">;
|
|
73
|
+
constraint: Option.Option<string & import("effect/Brand").Brand<"VersionRange">>;
|
|
74
|
+
currency: CurrencyResult;
|
|
75
|
+
}[], WorkspaceInspectionFailed | import("@agentxm/workspace-state").LockfileIoError | import("@agentxm/workspace-state").LockfileParseError | import("@agentxm/workspace-state").LockfileDecodeError | import("@agentxm/workspace-state").WorkspaceRootEscape | import("@agentxm/workspace-state").SettingsIoError | import("@agentxm/workspace-state").SettingsParseError | import("@agentxm/workspace-state").SettingsDecodeError | import("@agentxm/registry-client").RegistryProblem | import("@agentxm/registry-client").RegistryRequestFailed | import("@agentxm/registry-client").RegistryOperationFailed, WorkspaceMutations>;
|
|
76
|
+
/**
|
|
77
|
+
* Collect currency entries for all registry-sourced MCP servers.
|
|
78
|
+
*/
|
|
79
|
+
export declare const collectMcpServerCurrency: (client: RegistryClient) => Effect.Effect<{
|
|
80
|
+
kind: "registry-version";
|
|
81
|
+
ref: string;
|
|
82
|
+
type: "skill" | "mcp-server" | "subagent" | "rule" | "hook" | "knowledge" | "pack";
|
|
83
|
+
installedVersion: string & import("effect/Brand").Brand<"Version">;
|
|
84
|
+
constraint: Option.Option<string & import("effect/Brand").Brand<"VersionRange">>;
|
|
85
|
+
currency: CurrencyResult;
|
|
86
|
+
}[], WorkspaceInspectionFailed | import("@agentxm/workspace-state").LockfileIoError | import("@agentxm/workspace-state").LockfileParseError | import("@agentxm/workspace-state").LockfileDecodeError | import("@agentxm/workspace-state").WorkspaceRootEscape | import("@agentxm/workspace-state").SettingsIoError | import("@agentxm/workspace-state").SettingsParseError | import("@agentxm/workspace-state").SettingsDecodeError | import("@agentxm/registry-client").RegistryProblem | import("@agentxm/registry-client").RegistryRequestFailed | import("@agentxm/registry-client").RegistryOperationFailed, WorkspaceMutations>;
|
|
87
|
+
/**
|
|
88
|
+
* Collect currency entries for all enabled, registry-sourced subagents.
|
|
89
|
+
*/
|
|
90
|
+
export declare const collectSubagentCurrency: (client: RegistryClient) => Effect.Effect<{
|
|
91
|
+
kind: "registry-version";
|
|
92
|
+
ref: string;
|
|
93
|
+
type: "skill" | "mcp-server" | "subagent" | "rule" | "hook" | "knowledge" | "pack";
|
|
94
|
+
installedVersion: string & import("effect/Brand").Brand<"Version">;
|
|
95
|
+
constraint: Option.Option<string & import("effect/Brand").Brand<"VersionRange">>;
|
|
96
|
+
currency: CurrencyResult;
|
|
97
|
+
}[], WorkspaceInspectionFailed | import("@agentxm/workspace-state").LockfileIoError | import("@agentxm/workspace-state").LockfileParseError | import("@agentxm/workspace-state").LockfileDecodeError | import("@agentxm/workspace-state").WorkspaceRootEscape | import("@agentxm/workspace-state").SettingsIoError | import("@agentxm/workspace-state").SettingsParseError | import("@agentxm/workspace-state").SettingsDecodeError | import("@agentxm/registry-client").RegistryProblem | import("@agentxm/registry-client").RegistryRequestFailed | import("@agentxm/registry-client").RegistryOperationFailed, WorkspaceMutations>;
|
|
98
|
+
/**
|
|
99
|
+
* Collect currency entries for all registry-sourced packs.
|
|
100
|
+
*/
|
|
101
|
+
export declare const collectPackCurrency: (client: RegistryClient) => Effect.Effect<{
|
|
102
|
+
kind: "registry-version";
|
|
103
|
+
ref: string;
|
|
104
|
+
type: "skill" | "mcp-server" | "subagent" | "rule" | "hook" | "knowledge" | "pack";
|
|
105
|
+
installedVersion: string & import("effect/Brand").Brand<"Version">;
|
|
106
|
+
constraint: Option.Option<string & import("effect/Brand").Brand<"VersionRange">>;
|
|
107
|
+
currency: CurrencyResult;
|
|
108
|
+
}[], WorkspaceInspectionFailed | import("@agentxm/workspace-state").LockfileIoError | import("@agentxm/workspace-state").LockfileParseError | import("@agentxm/workspace-state").LockfileDecodeError | import("@agentxm/workspace-state").WorkspaceRootEscape | import("@agentxm/workspace-state").SettingsIoError | import("@agentxm/workspace-state").SettingsParseError | import("@agentxm/workspace-state").SettingsDecodeError | import("@agentxm/registry-client").RegistryProblem | import("@agentxm/registry-client").RegistryRequestFailed | import("@agentxm/registry-client").RegistryOperationFailed, WorkspaceMutations>;
|
|
109
|
+
/**
|
|
110
|
+
* Collect currency entries for all enabled, registry-sourced rules.
|
|
111
|
+
*/
|
|
112
|
+
export declare const collectRuleCurrency: (client: RegistryClient) => Effect.Effect<{
|
|
113
|
+
kind: "registry-version";
|
|
114
|
+
ref: string;
|
|
115
|
+
type: "skill" | "mcp-server" | "subagent" | "rule" | "hook" | "knowledge" | "pack";
|
|
116
|
+
installedVersion: string & import("effect/Brand").Brand<"Version">;
|
|
117
|
+
constraint: Option.Option<string & import("effect/Brand").Brand<"VersionRange">>;
|
|
118
|
+
currency: CurrencyResult;
|
|
119
|
+
}[], WorkspaceInspectionFailed | import("@agentxm/workspace-state").LockfileIoError | import("@agentxm/workspace-state").LockfileParseError | import("@agentxm/workspace-state").LockfileDecodeError | import("@agentxm/workspace-state").WorkspaceRootEscape | import("@agentxm/workspace-state").SettingsIoError | import("@agentxm/workspace-state").SettingsParseError | import("@agentxm/workspace-state").SettingsDecodeError | import("@agentxm/registry-client").RegistryProblem | import("@agentxm/registry-client").RegistryRequestFailed | import("@agentxm/registry-client").RegistryOperationFailed, WorkspaceMutations>;
|
|
120
|
+
/**
|
|
121
|
+
* Collect currency entries for all enabled, registry-sourced hooks.
|
|
122
|
+
*/
|
|
123
|
+
export declare const collectHookCurrency: (client: RegistryClient) => Effect.Effect<{
|
|
124
|
+
kind: "registry-version";
|
|
125
|
+
ref: string;
|
|
126
|
+
type: "skill" | "mcp-server" | "subagent" | "rule" | "hook" | "knowledge" | "pack";
|
|
127
|
+
installedVersion: string & import("effect/Brand").Brand<"Version">;
|
|
128
|
+
constraint: Option.Option<string & import("effect/Brand").Brand<"VersionRange">>;
|
|
129
|
+
currency: CurrencyResult;
|
|
130
|
+
}[], WorkspaceInspectionFailed | import("@agentxm/workspace-state").LockfileIoError | import("@agentxm/workspace-state").LockfileParseError | import("@agentxm/workspace-state").LockfileDecodeError | import("@agentxm/workspace-state").WorkspaceRootEscape | import("@agentxm/workspace-state").SettingsIoError | import("@agentxm/workspace-state").SettingsParseError | import("@agentxm/workspace-state").SettingsDecodeError | import("@agentxm/registry-client").RegistryProblem | import("@agentxm/registry-client").RegistryRequestFailed | import("@agentxm/registry-client").RegistryOperationFailed, WorkspaceMutations>;
|
|
131
|
+
/**
|
|
132
|
+
* Collect currency entries for all enabled, registry-sourced knowledge bundles.
|
|
133
|
+
*/
|
|
134
|
+
export declare const collectKnowledgeCurrency: (client: RegistryClient) => Effect.Effect<{
|
|
135
|
+
kind: "registry-version";
|
|
136
|
+
ref: string;
|
|
137
|
+
type: "skill" | "mcp-server" | "subagent" | "rule" | "hook" | "knowledge" | "pack";
|
|
138
|
+
installedVersion: string & import("effect/Brand").Brand<"Version">;
|
|
139
|
+
constraint: Option.Option<string & import("effect/Brand").Brand<"VersionRange">>;
|
|
140
|
+
currency: CurrencyResult;
|
|
141
|
+
}[], WorkspaceInspectionFailed | import("@agentxm/workspace-state").LockfileIoError | import("@agentxm/workspace-state").LockfileParseError | import("@agentxm/workspace-state").LockfileDecodeError | import("@agentxm/workspace-state").WorkspaceRootEscape | import("@agentxm/workspace-state").SettingsIoError | import("@agentxm/workspace-state").SettingsParseError | import("@agentxm/workspace-state").SettingsDecodeError | import("@agentxm/registry-client").RegistryProblem | import("@agentxm/registry-client").RegistryRequestFailed | import("@agentxm/registry-client").RegistryOperationFailed, WorkspaceMutations>;
|
|
142
|
+
/**
|
|
143
|
+
* Collect currency entries for all extension types and merge into a single array.
|
|
144
|
+
*/
|
|
145
|
+
export declare const collectAllCurrencyEntries: (client: RegistryClient) => Effect.Effect<{
|
|
146
|
+
kind: "registry-version";
|
|
147
|
+
ref: string;
|
|
148
|
+
type: "skill" | "mcp-server" | "subagent" | "rule" | "hook" | "knowledge" | "pack";
|
|
149
|
+
installedVersion: string & import("effect/Brand").Brand<"Version">;
|
|
150
|
+
constraint: Option.Option<string & import("effect/Brand").Brand<"VersionRange">>;
|
|
151
|
+
currency: CurrencyResult;
|
|
152
|
+
}[], WorkspaceInspectionFailed | import("@agentxm/workspace-state").LockfileIoError | import("@agentxm/workspace-state").LockfileParseError | import("@agentxm/workspace-state").LockfileDecodeError | import("@agentxm/workspace-state").WorkspaceRootEscape | import("@agentxm/workspace-state").SettingsIoError | import("@agentxm/workspace-state").SettingsParseError | import("@agentxm/workspace-state").SettingsDecodeError | import("@agentxm/registry-client").RegistryProblem | import("@agentxm/registry-client").RegistryRequestFailed | import("@agentxm/registry-client").RegistryOperationFailed, WorkspaceMutations>;
|
|
153
|
+
export declare const collectAllUpdateEntries: (client: RegistryClient) => Effect.Effect<(ExtensionSourceFreshnessEntry | {
|
|
154
|
+
kind: "registry-version";
|
|
155
|
+
ref: string;
|
|
156
|
+
type: "skill" | "mcp-server" | "subagent" | "rule" | "hook" | "knowledge" | "pack";
|
|
157
|
+
installedVersion: string & import("effect/Brand").Brand<"Version">;
|
|
158
|
+
constraint: Option.Option<string & import("effect/Brand").Brand<"VersionRange">>;
|
|
159
|
+
currency: CurrencyResult;
|
|
160
|
+
})[], WorkspaceInspectionFailed | import("@agentxm/workspace-state").LockfileIoError | import("@agentxm/workspace-state").LockfileParseError | import("@agentxm/workspace-state").LockfileDecodeError | import("@agentxm/workspace-state").WorkspaceRootEscape | import("@agentxm/workspace-state").SettingsIoError | import("@agentxm/workspace-state").SettingsParseError | import("@agentxm/workspace-state").SettingsDecodeError | import("@agentxm/registry-client").RegistryProblem | import("@agentxm/registry-client").RegistryRequestFailed | import("@agentxm/registry-client").RegistryOperationFailed, InspectionFailureAdapter | WorkspaceMutations | import("effect/FileSystem").FileSystem | import("effect/unstable/http/HttpClient").HttpClient | import("effect/Path").Path | import("@agentxm/extension-sources").WorkspaceCatalog | SourceHostProviders | import("effect/Scope").Scope>;
|
|
161
|
+
export {};
|
|
162
|
+
//# sourceMappingURL=collectors.d.ts.map
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-type currency collectors and aggregator.
|
|
3
|
+
*
|
|
4
|
+
* Reads configured and locked entries from the WorkspaceMutations service, filters to
|
|
5
|
+
* enabled registry-sourced entries, fetches each extension's index from
|
|
6
|
+
* RegistryClient, and produces an array of ExtensionCurrencyEntry.
|
|
7
|
+
*
|
|
8
|
+
* @experimental This API is unstable and may change without notice.
|
|
9
|
+
*/
|
|
10
|
+
import * as Array from "effect/Array";
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
|
+
import * as Option from "effect/Option";
|
|
13
|
+
import * as Schema from "effect/Schema";
|
|
14
|
+
import { parseSourceQualifiedRegistrySourcePatternParts, toExtensionTypePlural, } from "@agentxm/extension-model/unstable/extensions";
|
|
15
|
+
import { resolveSource, SourceHostProviders } from "@agentxm/extension-sources";
|
|
16
|
+
import { VersionSchema, } from "@agentxm/extension-model/unstable/version-constraints";
|
|
17
|
+
import { WorkspaceMutations } from "@agentxm/workspace-state";
|
|
18
|
+
import { isSourcedDesiredExtension } from "@agentxm/workspace-state";
|
|
19
|
+
import { checkCurrency } from "./check-currency.js";
|
|
20
|
+
import { WorkspaceInspectionFailed } from "../errors.js";
|
|
21
|
+
import { InspectionFailureAdapter } from "../failure-adapter.js";
|
|
22
|
+
// Registry currency reads share the same four-request transport cap used by
|
|
23
|
+
// publishing. Git source probes stay serial because each provider may allocate
|
|
24
|
+
// a clone/worktree and no higher subprocess capacity has been established.
|
|
25
|
+
const REGISTRY_READ_CONCURRENCY = 4;
|
|
26
|
+
const SOURCE_FRESHNESS_CONCURRENCY = 1;
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
// Helpers
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
/**
|
|
31
|
+
* Parse a version constraint from a settings source string like `@acme/skills/code-review@^1.0.0`.
|
|
32
|
+
*/
|
|
33
|
+
const parseConstraintFromSource = (source) => {
|
|
34
|
+
const parts = parseSourceQualifiedRegistrySourcePatternParts(source);
|
|
35
|
+
if (parts === undefined)
|
|
36
|
+
return Option.none();
|
|
37
|
+
return Option.fromUndefinedOr(parts.versionRange);
|
|
38
|
+
};
|
|
39
|
+
/** Build fully-qualified ref like `@acme/skills/code-review`. */
|
|
40
|
+
const buildFqn = (ownerHandle, type, name) => `${ownerHandle}/${toExtensionTypePlural(type)}/${name}`;
|
|
41
|
+
const getAcceptedResolution = (ws, type, name) => {
|
|
42
|
+
switch (type) {
|
|
43
|
+
case "skill":
|
|
44
|
+
return ws.getLockedSkill(name);
|
|
45
|
+
case "mcp-server":
|
|
46
|
+
return ws.getLockedMcpServer(name);
|
|
47
|
+
case "subagent":
|
|
48
|
+
return ws.getLockedSubagent(name);
|
|
49
|
+
case "rule":
|
|
50
|
+
return ws.getLockedRuleEntry(name);
|
|
51
|
+
case "hook":
|
|
52
|
+
return ws.getLockedHookEntry(name);
|
|
53
|
+
case "knowledge":
|
|
54
|
+
return ws.getLockedKnowledgeEntry(name);
|
|
55
|
+
case "pack":
|
|
56
|
+
return ws.getLockedPack(name);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const isGitAcceptedResolution = (entry) => entry.type === "github" ||
|
|
60
|
+
entry.type === "gitlab" ||
|
|
61
|
+
entry.type === "bitbucket" ||
|
|
62
|
+
entry.type === "azurerepos" ||
|
|
63
|
+
entry.type === "git";
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
// Generic collector
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
67
|
+
/**
|
|
68
|
+
* Collect currency from desired state and accepted Registry resolutions.
|
|
69
|
+
*/
|
|
70
|
+
const collectCurrency = (extensionType, client) => Effect.gen(function* () {
|
|
71
|
+
const ws = yield* WorkspaceMutations;
|
|
72
|
+
const graph = yield* ws.getDesiredStateGraph();
|
|
73
|
+
if (!graph.complete) {
|
|
74
|
+
return yield* new WorkspaceInspectionFailed({
|
|
75
|
+
category: "validation",
|
|
76
|
+
detail: "Cannot assess extension currency while the desired pack graph is incomplete",
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const accepted = yield* Effect.forEach(graph.nodes
|
|
80
|
+
.filter(isSourcedDesiredExtension)
|
|
81
|
+
.filter((node) => node.type === extensionType && node.enabled), (node) => getAcceptedResolution(ws, node.type, node.name).pipe(Effect.map((resolution) => ({ node, resolution }))));
|
|
82
|
+
const eligible = accepted.flatMap(({ node, resolution }) => Option.isSome(resolution) && resolution.value.type === "registry"
|
|
83
|
+
? [{ node, resolution: resolution.value }]
|
|
84
|
+
: []);
|
|
85
|
+
return yield* Effect.forEach(eligible, ({ node, resolution }) => Effect.gen(function* () {
|
|
86
|
+
const installedVersion = yield* Schema.decodeUnknownEffect(VersionSchema)(resolution.resolvedVersion).pipe(Effect.mapError(() => new WorkspaceInspectionFailed({
|
|
87
|
+
category: "validation",
|
|
88
|
+
detail: `Accepted version for ${node.type} "${node.name}" is invalid`,
|
|
89
|
+
})));
|
|
90
|
+
const constraint = parseConstraintFromSource(node.source);
|
|
91
|
+
const indexOption = yield* client.getExtensionIndex({
|
|
92
|
+
owner: resolution.owner,
|
|
93
|
+
type: extensionType,
|
|
94
|
+
name: resolution.name,
|
|
95
|
+
});
|
|
96
|
+
if (Option.isNone(indexOption))
|
|
97
|
+
return Option.none();
|
|
98
|
+
const currency = checkCurrency(installedVersion, constraint, indexOption.value);
|
|
99
|
+
return Option.some({
|
|
100
|
+
kind: "registry-version",
|
|
101
|
+
ref: buildFqn(resolution.owner, extensionType, resolution.name),
|
|
102
|
+
type: extensionType,
|
|
103
|
+
installedVersion,
|
|
104
|
+
constraint,
|
|
105
|
+
currency,
|
|
106
|
+
});
|
|
107
|
+
}), { concurrency: REGISTRY_READ_CONCURRENCY }).pipe(Effect.map(Array.getSomes));
|
|
108
|
+
});
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
110
|
+
// Git-hosted freshness collectors
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
const sourceFreshnessStatus = (installedTreeHash, currentTreeHash) => {
|
|
113
|
+
if (Option.isNone(installedTreeHash) || Option.isNone(currentTreeHash))
|
|
114
|
+
return "unknown";
|
|
115
|
+
return installedTreeHash.value === currentTreeHash.value ? "current" : "changed";
|
|
116
|
+
};
|
|
117
|
+
const freshnessEntry = ({ localName, extensionType, source, installedTreeHash, currentTreeHash, reason, }) => ({
|
|
118
|
+
kind: "source-freshness",
|
|
119
|
+
ref: `${toExtensionTypePlural(extensionType)}/${localName}`,
|
|
120
|
+
type: extensionType,
|
|
121
|
+
source,
|
|
122
|
+
installedTreeHash,
|
|
123
|
+
currentTreeHash,
|
|
124
|
+
status: Option.isSome(reason)
|
|
125
|
+
? "unknown"
|
|
126
|
+
: sourceFreshnessStatus(installedTreeHash, currentTreeHash),
|
|
127
|
+
reason,
|
|
128
|
+
});
|
|
129
|
+
/**
|
|
130
|
+
* The workspace-facing name a discovered ref carries.
|
|
131
|
+
*
|
|
132
|
+
* Each type nests its payload under its own key; a returning switch keeps a new
|
|
133
|
+
* extension type from silently never matching.
|
|
134
|
+
*/
|
|
135
|
+
const refExtensionName = (ref) => {
|
|
136
|
+
switch (ref.type) {
|
|
137
|
+
case "skill":
|
|
138
|
+
return ref.skill.name;
|
|
139
|
+
case "mcp-server":
|
|
140
|
+
return ref.server.name;
|
|
141
|
+
case "subagent":
|
|
142
|
+
return ref.subagent.name;
|
|
143
|
+
case "rule":
|
|
144
|
+
return ref.rule.name;
|
|
145
|
+
case "hook":
|
|
146
|
+
return ref.hook.name;
|
|
147
|
+
case "knowledge":
|
|
148
|
+
return ref.knowledge.name;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const matchingRefTreeSha = (refs, extensionType, localName) => {
|
|
152
|
+
const match = refs.find((ref) => ref.refType === "git-hosted" &&
|
|
153
|
+
ref.type === extensionType &&
|
|
154
|
+
refExtensionName(ref) === localName);
|
|
155
|
+
return match === undefined ? Option.none() : Option.some(match.gitTreeSha);
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Compare desired Git-hosted entries against their accepted immutable revision.
|
|
159
|
+
*/
|
|
160
|
+
const collectSourceFreshness = (args) => Effect.gen(function* () {
|
|
161
|
+
const providers = yield* SourceHostProviders;
|
|
162
|
+
const ws = yield* WorkspaceMutations;
|
|
163
|
+
const adapter = yield* InspectionFailureAdapter;
|
|
164
|
+
const { extensionType } = args;
|
|
165
|
+
const graph = yield* ws.getDesiredStateGraph();
|
|
166
|
+
if (!graph.complete) {
|
|
167
|
+
return yield* new WorkspaceInspectionFailed({
|
|
168
|
+
category: "validation",
|
|
169
|
+
detail: "Cannot assess source freshness while the desired pack graph is incomplete",
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
const accepted = yield* Effect.forEach(graph.nodes
|
|
173
|
+
.filter(isSourcedDesiredExtension)
|
|
174
|
+
.filter((node) => node.type === extensionType && node.enabled), (node) => getAcceptedResolution(ws, node.type, node.name).pipe(Effect.map((resolution) => ({ node, resolution }))));
|
|
175
|
+
const eligible = accepted.flatMap(({ node, resolution }) => Option.isSome(resolution) && isGitAcceptedResolution(resolution.value)
|
|
176
|
+
? [{ node, resolution: resolution.value }]
|
|
177
|
+
: []);
|
|
178
|
+
return yield* Effect.forEach(eligible, ({ node, resolution }) => Effect.gen(function* () {
|
|
179
|
+
const installedTreeHash = Option.some(resolution.resolvedTree);
|
|
180
|
+
const unresolved = (reason) => freshnessEntry({
|
|
181
|
+
localName: node.name,
|
|
182
|
+
extensionType,
|
|
183
|
+
source: node.source,
|
|
184
|
+
installedTreeHash,
|
|
185
|
+
currentTreeHash: Option.none(),
|
|
186
|
+
reason: Option.some(reason),
|
|
187
|
+
});
|
|
188
|
+
const sourceResult = yield* resolveSource(node.source).pipe(Effect.result);
|
|
189
|
+
if (sourceResult._tag === "Failure") {
|
|
190
|
+
return unresolved(adapter.describeFailure(sourceResult.failure));
|
|
191
|
+
}
|
|
192
|
+
const refsResult = yield* providers
|
|
193
|
+
.find(sourceResult.success, {
|
|
194
|
+
names: [node.name],
|
|
195
|
+
type: extensionType,
|
|
196
|
+
owner: Option.none(),
|
|
197
|
+
versionRange: Option.none(),
|
|
198
|
+
})
|
|
199
|
+
.pipe(Effect.result);
|
|
200
|
+
if (refsResult._tag === "Failure") {
|
|
201
|
+
return unresolved(adapter.describeFailure(refsResult.failure));
|
|
202
|
+
}
|
|
203
|
+
return freshnessEntry({
|
|
204
|
+
localName: node.name,
|
|
205
|
+
extensionType,
|
|
206
|
+
source: node.source,
|
|
207
|
+
installedTreeHash,
|
|
208
|
+
currentTreeHash: matchingRefTreeSha(refsResult.success, extensionType, node.name),
|
|
209
|
+
reason: Option.none(),
|
|
210
|
+
});
|
|
211
|
+
}), { concurrency: SOURCE_FRESHNESS_CONCURRENCY });
|
|
212
|
+
});
|
|
213
|
+
const makeSourceFreshnessCollector = (extensionType) => () => collectSourceFreshness({ extensionType });
|
|
214
|
+
export const collectSkillSourceFreshness = makeSourceFreshnessCollector("skill");
|
|
215
|
+
export const collectMcpServerSourceFreshness = makeSourceFreshnessCollector("mcp-server");
|
|
216
|
+
export const collectSubagentSourceFreshness = makeSourceFreshnessCollector("subagent");
|
|
217
|
+
export const collectRuleSourceFreshness = makeSourceFreshnessCollector("rule");
|
|
218
|
+
export const collectHookSourceFreshness = makeSourceFreshnessCollector("hook");
|
|
219
|
+
export const collectKnowledgeSourceFreshness = makeSourceFreshnessCollector("knowledge");
|
|
220
|
+
/** Every per-type git-source freshness collector, in catalog order. */
|
|
221
|
+
export const sourceFreshnessCollectors = [
|
|
222
|
+
collectSkillSourceFreshness,
|
|
223
|
+
collectMcpServerSourceFreshness,
|
|
224
|
+
collectSubagentSourceFreshness,
|
|
225
|
+
collectRuleSourceFreshness,
|
|
226
|
+
collectHookSourceFreshness,
|
|
227
|
+
collectKnowledgeSourceFreshness,
|
|
228
|
+
];
|
|
229
|
+
// ---------------------------------------------------------------------------
|
|
230
|
+
// Per-type collectors
|
|
231
|
+
// ---------------------------------------------------------------------------
|
|
232
|
+
/**
|
|
233
|
+
* Collect currency entries for all enabled, registry-sourced skills.
|
|
234
|
+
*/
|
|
235
|
+
export const collectSkillCurrency = (client) => collectCurrency("skill", client);
|
|
236
|
+
/**
|
|
237
|
+
* Collect currency entries for all registry-sourced MCP servers.
|
|
238
|
+
*/
|
|
239
|
+
export const collectMcpServerCurrency = (client) => collectCurrency("mcp-server", client);
|
|
240
|
+
/**
|
|
241
|
+
* Collect currency entries for all enabled, registry-sourced subagents.
|
|
242
|
+
*/
|
|
243
|
+
export const collectSubagentCurrency = (client) => collectCurrency("subagent", client);
|
|
244
|
+
/**
|
|
245
|
+
* Collect currency entries for all registry-sourced packs.
|
|
246
|
+
*/
|
|
247
|
+
export const collectPackCurrency = (client) => collectCurrency("pack", client);
|
|
248
|
+
/**
|
|
249
|
+
* Collect currency entries for all enabled, registry-sourced rules.
|
|
250
|
+
*/
|
|
251
|
+
export const collectRuleCurrency = (client) => collectCurrency("rule", client);
|
|
252
|
+
/**
|
|
253
|
+
* Collect currency entries for all enabled, registry-sourced hooks.
|
|
254
|
+
*/
|
|
255
|
+
export const collectHookCurrency = (client) => collectCurrency("hook", client);
|
|
256
|
+
/**
|
|
257
|
+
* Collect currency entries for all enabled, registry-sourced knowledge bundles.
|
|
258
|
+
*/
|
|
259
|
+
export const collectKnowledgeCurrency = (client) => collectCurrency("knowledge", client);
|
|
260
|
+
// ---------------------------------------------------------------------------
|
|
261
|
+
// Aggregator
|
|
262
|
+
// ---------------------------------------------------------------------------
|
|
263
|
+
/**
|
|
264
|
+
* Collect currency entries for all extension types and merge into a single array.
|
|
265
|
+
*/
|
|
266
|
+
export const collectAllCurrencyEntries = (client) => Effect.gen(function* () {
|
|
267
|
+
const [skills, mcpServers, subagents, packs, rules, hooks, knowledge] = yield* Effect.all([
|
|
268
|
+
collectSkillCurrency(client),
|
|
269
|
+
collectMcpServerCurrency(client),
|
|
270
|
+
collectSubagentCurrency(client),
|
|
271
|
+
collectPackCurrency(client),
|
|
272
|
+
collectRuleCurrency(client),
|
|
273
|
+
collectHookCurrency(client),
|
|
274
|
+
collectKnowledgeCurrency(client),
|
|
275
|
+
], { concurrency: SOURCE_FRESHNESS_CONCURRENCY });
|
|
276
|
+
return [...skills, ...mcpServers, ...subagents, ...packs, ...rules, ...hooks, ...knowledge];
|
|
277
|
+
});
|
|
278
|
+
export const collectAllUpdateEntries = (client) => Effect.gen(function* () {
|
|
279
|
+
const [currencyEntries, freshnessByType] = yield* Effect.all([
|
|
280
|
+
collectAllCurrencyEntries(client),
|
|
281
|
+
Effect.forEach(sourceFreshnessCollectors, (collect) => collect(), {
|
|
282
|
+
concurrency: SOURCE_FRESHNESS_CONCURRENCY,
|
|
283
|
+
}),
|
|
284
|
+
], { concurrency: SOURCE_FRESHNESS_CONCURRENCY });
|
|
285
|
+
return [...currencyEntries, ...freshnessByType.flat()];
|
|
286
|
+
});
|
|
287
|
+
//# sourceMappingURL=collectors.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version currency assessment for installed extensions.
|
|
3
|
+
*
|
|
4
|
+
* Shared module providing currency checks used by doctor, outdated, and update commands.
|
|
5
|
+
*
|
|
6
|
+
* @experimental This API is unstable and may change without notice.
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export { checkCurrency, type CurrencyResult, type CurrencyStatus } from "./check-currency.js";
|
|
10
|
+
export { collectAllCurrencyEntries, collectAllUpdateEntries, collectHookCurrency, collectKnowledgeCurrency, collectMcpServerCurrency, collectPackCurrency, collectRuleCurrency, collectSkillSourceFreshness, collectMcpServerSourceFreshness, collectSubagentSourceFreshness, collectRuleSourceFreshness, collectHookSourceFreshness, collectKnowledgeSourceFreshness, sourceFreshnessCollectors, collectSkillCurrency, collectSubagentCurrency, type ExtensionCurrencyEntry, type ExtensionSourceFreshnessEntry, type ExtensionUpdateEntry, } from "./collectors.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version currency assessment for installed extensions.
|
|
3
|
+
*
|
|
4
|
+
* Shared module providing currency checks used by doctor, outdated, and update commands.
|
|
5
|
+
*
|
|
6
|
+
* @experimental This API is unstable and may change without notice.
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export { checkCurrency } from "./check-currency.js";
|
|
10
|
+
export { collectAllCurrencyEntries, collectAllUpdateEntries, collectHookCurrency, collectKnowledgeCurrency, collectMcpServerCurrency, collectPackCurrency, collectRuleCurrency, collectSkillSourceFreshness, collectMcpServerSourceFreshness, collectSubagentSourceFreshness, collectRuleSourceFreshness, collectHookSourceFreshness, collectKnowledgeSourceFreshness, sourceFreshnessCollectors, collectSkillCurrency, collectSubagentCurrency, } from "./collectors.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentxm/workspace-inspection",
|
|
3
|
+
"version": "0.28.4-bootstrap.0",
|
|
4
|
+
"description": "AXM workspace-inspection feature: list, view, inventory, and version-currency queries 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/workspace-inspection"
|
|
16
|
+
},
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/src/index.d.ts",
|
|
21
|
+
"default": "./dist/src/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist/src/",
|
|
26
|
+
"!**/*.map"
|
|
27
|
+
],
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=22.19.0"
|
|
33
|
+
},
|
|
34
|
+
"nx": {
|
|
35
|
+
"includedScripts": []
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"effect": "4.0.0-rc.112",
|
|
39
|
+
"semver": "^7.8.5",
|
|
40
|
+
"@agentxm/extension-sources": "^0.28.4-bootstrap.0",
|
|
41
|
+
"@agentxm/extension-model": "^0.28.4-bootstrap.0",
|
|
42
|
+
"@agentxm/extension-workspace": "^0.28.4-bootstrap.0",
|
|
43
|
+
"@agentxm/registry-protocol": "^0.28.4-bootstrap.0",
|
|
44
|
+
"@agentxm/registry-client": "^0.28.4-bootstrap.0",
|
|
45
|
+
"@agentxm/workspace-state": "^0.28.4-bootstrap.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@effect/platform-node": "4.0.0-rc.112",
|
|
49
|
+
"@effect/vitest": "4.0.0-rc.112",
|
|
50
|
+
"@types/bun": "^1.3.14",
|
|
51
|
+
"@types/semver": "^7.5.8",
|
|
52
|
+
"@typescript/native": "npm:typescript@^7.0.2",
|
|
53
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
54
|
+
"vitest": "^4.1.10"
|
|
55
|
+
}
|
|
56
|
+
}
|