@agentxm/extension-publish 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/archive.d.ts +72 -0
- package/dist/src/archive.js +106 -0
- package/dist/src/authorization.d.ts +42 -0
- package/dist/src/authorization.js +42 -0
- package/dist/src/errors.d.ts +30 -0
- package/dist/src/errors.js +29 -0
- package/dist/src/index.d.ts +21 -0
- package/dist/src/index.js +21 -0
- package/dist/src/internal/glob.d.ts +39 -0
- package/dist/src/internal/glob.js +79 -0
- package/dist/src/jobs.d.ts +12 -0
- package/dist/src/jobs.js +20 -0
- package/dist/src/lint-gate.d.ts +47 -0
- package/dist/src/lint-gate.js +136 -0
- package/dist/src/preflight.d.ts +46 -0
- package/dist/src/preflight.js +125 -0
- package/dist/src/publish-ignore.d.ts +50 -0
- package/dist/src/publish-ignore.js +61 -0
- package/dist/src/publishable-types.d.ts +21 -0
- package/dist/src/publishable-types.js +15 -0
- package/dist/src/recovery.d.ts +11 -0
- package/dist/src/recovery.js +15 -0
- package/dist/src/settlement.d.ts +19 -0
- package/dist/src/settlement.js +70 -0
- package/package.json +54 -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,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build a deterministic zip archive of a directory.
|
|
3
|
+
*
|
|
4
|
+
* Uses fflate (pure JS) so publish works on platforms without a system
|
|
5
|
+
* `zip` binary (notably Windows). Entries are walked via the platform
|
|
6
|
+
* FileSystem service, sorted by relative path, and stamped with a fixed
|
|
7
|
+
* mtime so the byte output is reproducible.
|
|
8
|
+
*
|
|
9
|
+
* @experimental This API is unstable and may change without notice.
|
|
10
|
+
*/
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
|
+
import * as FileSystem from "effect/FileSystem";
|
|
13
|
+
import * as Path from "effect/Path";
|
|
14
|
+
import { PublishFailed } from "./errors.js";
|
|
15
|
+
/** @experimental This API is unstable and may change without notice. */
|
|
16
|
+
export interface BuildZipArchiveOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Glob patterns matched against archive-relative POSIX paths. Absent or
|
|
19
|
+
* empty leaves the archive exactly as it would have been built without this
|
|
20
|
+
* option — the default path is unchanged, so already-published integrity
|
|
21
|
+
* digests stay reproducible.
|
|
22
|
+
*/
|
|
23
|
+
readonly ignore?: ReadonlyArray<string> | undefined;
|
|
24
|
+
}
|
|
25
|
+
/** One file in the deterministic Registry archive plan. */
|
|
26
|
+
export interface ArchivePlanFile {
|
|
27
|
+
readonly path: string;
|
|
28
|
+
readonly size: number;
|
|
29
|
+
readonly matchedPatterns: ReadonlyArray<string>;
|
|
30
|
+
}
|
|
31
|
+
/** Match accounting for one declared ignore pattern. */
|
|
32
|
+
export interface ArchivePlanPattern {
|
|
33
|
+
readonly pattern: string;
|
|
34
|
+
readonly matchCount: number;
|
|
35
|
+
}
|
|
36
|
+
/** The effective Registry-only distribution boundary before ZIP construction. */
|
|
37
|
+
export interface ArchivePlan {
|
|
38
|
+
readonly included: ReadonlyArray<ArchivePlanFile>;
|
|
39
|
+
readonly excluded: ReadonlyArray<ArchivePlanFile>;
|
|
40
|
+
readonly patterns: ReadonlyArray<ArchivePlanPattern>;
|
|
41
|
+
readonly warnings: ReadonlyArray<string>;
|
|
42
|
+
readonly includedCount: number;
|
|
43
|
+
readonly excludedCount: number;
|
|
44
|
+
readonly uncompressedBytes: number;
|
|
45
|
+
}
|
|
46
|
+
/** Deterministic archive bytes paired with the exact plan that produced them. */
|
|
47
|
+
export interface PlannedZipArchive {
|
|
48
|
+
readonly archive: Uint8Array;
|
|
49
|
+
readonly plan: ArchivePlan;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Build a zip archive of a directory.
|
|
53
|
+
* Files are stored at the root of the zip (no enclosing directory).
|
|
54
|
+
* Directory entries are not emitted.
|
|
55
|
+
*/
|
|
56
|
+
export declare const planZipArchive: (dir: string, options?: BuildZipArchiveOptions) => Effect.Effect<{
|
|
57
|
+
archive: Uint8Array<ArrayBuffer>;
|
|
58
|
+
plan: {
|
|
59
|
+
included: ArchivePlanFile[];
|
|
60
|
+
excluded: ArchivePlanFile[];
|
|
61
|
+
patterns: {
|
|
62
|
+
pattern: string;
|
|
63
|
+
matchCount: number;
|
|
64
|
+
}[];
|
|
65
|
+
warnings: string[];
|
|
66
|
+
includedCount: number;
|
|
67
|
+
excludedCount: number;
|
|
68
|
+
uncompressedBytes: number;
|
|
69
|
+
};
|
|
70
|
+
}, PublishFailed, FileSystem.FileSystem | Path.Path>;
|
|
71
|
+
export declare const buildZipArchive: (dir: string, options?: BuildZipArchiveOptions) => Effect.Effect<Uint8Array<ArrayBuffer>, PublishFailed, FileSystem.FileSystem | Path.Path>;
|
|
72
|
+
//# sourceMappingURL=archive.d.ts.map
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// @effect-diagnostics globalDate:off — ZIP's driver API requires one fixed Date value and never reads the ambient clock
|
|
2
|
+
/**
|
|
3
|
+
* Build a deterministic zip archive of a directory.
|
|
4
|
+
*
|
|
5
|
+
* Uses fflate (pure JS) so publish works on platforms without a system
|
|
6
|
+
* `zip` binary (notably Windows). Entries are walked via the platform
|
|
7
|
+
* FileSystem service, sorted by relative path, and stamped with a fixed
|
|
8
|
+
* mtime so the byte output is reproducible.
|
|
9
|
+
*
|
|
10
|
+
* @experimental This API is unstable and may change without notice.
|
|
11
|
+
*/
|
|
12
|
+
import * as Effect from "effect/Effect";
|
|
13
|
+
import * as FileSystem from "effect/FileSystem";
|
|
14
|
+
import * as Path from "effect/Path";
|
|
15
|
+
import { zipSync } from "fflate";
|
|
16
|
+
import { PublishFailed } from "./errors.js";
|
|
17
|
+
import { expandGlob } from "./internal/glob.js";
|
|
18
|
+
// ZIP timestamps have no timezone. fflate serializes Date's local calendar
|
|
19
|
+
// fields, so construct those fields locally to keep the encoded bytes stable
|
|
20
|
+
// across host timezones.
|
|
21
|
+
// eslint-disable-next-line no-restricted-syntax -- ZIP's driver API requires Date; this fixed value never reads the ambient clock.
|
|
22
|
+
const DETERMINISTIC_MTIME = new Date(2020, 0, 1, 0, 0, 0, 0);
|
|
23
|
+
const READ_CONCURRENCY = 16;
|
|
24
|
+
/**
|
|
25
|
+
* Build a zip archive of a directory.
|
|
26
|
+
* Files are stored at the root of the zip (no enclosing directory).
|
|
27
|
+
* Directory entries are not emitted.
|
|
28
|
+
*/
|
|
29
|
+
export const planZipArchive = (dir, options) => Effect.gen(function* () {
|
|
30
|
+
const fs = yield* FileSystem.FileSystem;
|
|
31
|
+
const path = yield* Path.Path;
|
|
32
|
+
const files = yield* Effect.gen(function* () {
|
|
33
|
+
const rawEntries = yield* fs.readDirectory(dir, { recursive: true });
|
|
34
|
+
const toZipPath = path.sep === "/" ? (s) => s : (s) => s.split(path.sep).join("/");
|
|
35
|
+
const candidates = yield* Effect.forEach(rawEntries, (relRaw) => Effect.gen(function* () {
|
|
36
|
+
const abs = path.join(dir, relRaw);
|
|
37
|
+
const info = yield* fs.stat(abs);
|
|
38
|
+
return {
|
|
39
|
+
rel: toZipPath(relRaw),
|
|
40
|
+
abs,
|
|
41
|
+
isFile: info.type === "File",
|
|
42
|
+
size: Number(info.size),
|
|
43
|
+
};
|
|
44
|
+
}), { concurrency: READ_CONCURRENCY });
|
|
45
|
+
const onlyFiles = candidates.filter((c) => c.isFile);
|
|
46
|
+
onlyFiles.sort((a, b) => (a.rel < b.rel ? -1 : a.rel > b.rel ? 1 : 0));
|
|
47
|
+
return onlyFiles;
|
|
48
|
+
}).pipe(Effect.mapError((cause) => new PublishFailed({
|
|
49
|
+
category: "internal",
|
|
50
|
+
detail: "Failed to read source directory for zip archive",
|
|
51
|
+
cause,
|
|
52
|
+
})));
|
|
53
|
+
const patterns = options?.ignore ?? [];
|
|
54
|
+
const paths = files.map((file) => file.rel);
|
|
55
|
+
const matchesByPattern = patterns.map((pattern) => ({
|
|
56
|
+
pattern,
|
|
57
|
+
matches: new Set(expandGlob(pattern, paths)),
|
|
58
|
+
}));
|
|
59
|
+
const planned = files.map((file) => ({
|
|
60
|
+
path: file.rel,
|
|
61
|
+
size: file.size,
|
|
62
|
+
matchedPatterns: matchesByPattern
|
|
63
|
+
.filter(({ matches }) => matches.has(file.rel))
|
|
64
|
+
.map(({ pattern }) => pattern),
|
|
65
|
+
}));
|
|
66
|
+
const included = planned.filter((file) => file.matchedPatterns.length === 0);
|
|
67
|
+
const excluded = planned.filter((file) => file.matchedPatterns.length > 0);
|
|
68
|
+
const includedPaths = new Set(included.map((file) => file.path));
|
|
69
|
+
const contents = yield* Effect.forEach(files.filter((file) => includedPaths.has(file.rel)), ({ rel, abs }) => fs.readFile(abs).pipe(Effect.map((bytes) => [rel, bytes])), { concurrency: READ_CONCURRENCY }).pipe(Effect.mapError((cause) => new PublishFailed({
|
|
70
|
+
category: "internal",
|
|
71
|
+
detail: "Failed to read file for zip archive",
|
|
72
|
+
cause,
|
|
73
|
+
})));
|
|
74
|
+
const zippable = {};
|
|
75
|
+
for (const [rel, bytes] of contents) {
|
|
76
|
+
zippable[rel] = [bytes, { mtime: DETERMINISTIC_MTIME }];
|
|
77
|
+
}
|
|
78
|
+
const archive = yield* Effect.try({
|
|
79
|
+
try: () => zipSync(zippable, { mtime: DETERMINISTIC_MTIME }),
|
|
80
|
+
catch: (cause) => new PublishFailed({
|
|
81
|
+
category: "internal",
|
|
82
|
+
detail: "Failed to build zip archive",
|
|
83
|
+
cause,
|
|
84
|
+
}),
|
|
85
|
+
});
|
|
86
|
+
const patternPlans = matchesByPattern.map(({ pattern, matches }) => ({
|
|
87
|
+
pattern,
|
|
88
|
+
matchCount: matches.size,
|
|
89
|
+
}));
|
|
90
|
+
return {
|
|
91
|
+
archive,
|
|
92
|
+
plan: {
|
|
93
|
+
included,
|
|
94
|
+
excluded,
|
|
95
|
+
patterns: patternPlans,
|
|
96
|
+
warnings: patternPlans
|
|
97
|
+
.filter(({ matchCount }) => matchCount === 0)
|
|
98
|
+
.map(({ pattern }) => `publish.ignore pattern "${pattern}" matched no files.`),
|
|
99
|
+
includedCount: included.length,
|
|
100
|
+
excludedCount: excluded.length,
|
|
101
|
+
uncompressedBytes: included.reduce((total, file) => total + file.size, 0),
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
export const buildZipArchive = (dir, options) => planZipArchive(dir, options).pipe(Effect.map(({ archive }) => archive));
|
|
106
|
+
//# sourceMappingURL=archive.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication requirements and grant bindings for exact publication.
|
|
3
|
+
*
|
|
4
|
+
* The feature never invokes authentication itself: it expresses the
|
|
5
|
+
* requirement as typed precondition data and consumes the authorization
|
|
6
|
+
* RESULT as a structural grant value. The application sequences the
|
|
7
|
+
* registry-auth feature to satisfy the requirement and passes each issued
|
|
8
|
+
* grant into the upload binding as data.
|
|
9
|
+
*/
|
|
10
|
+
import type { OperationPrecondition } from "@agentxm/workspace-operations";
|
|
11
|
+
import type { PublishVisibility } from "@agentxm/registry-protocol/unstable/publish";
|
|
12
|
+
import type { PublicationVisibilityInput, Sha256Hex } from "@agentxm/registry-protocol/unstable/registry";
|
|
13
|
+
import type { PublishExtensionArgs } from "@agentxm/registry-client";
|
|
14
|
+
/**
|
|
15
|
+
* One exact publish capability the application obtained from the Registry
|
|
16
|
+
* authorization flow. Structurally satisfied by the auth feature's issued
|
|
17
|
+
* capability; this package never depends on that feature.
|
|
18
|
+
*/
|
|
19
|
+
export interface PublishGrant {
|
|
20
|
+
readonly accessToken: string;
|
|
21
|
+
readonly visibility: PublishVisibility;
|
|
22
|
+
readonly condition: string;
|
|
23
|
+
readonly publicationSetDigest: Sha256Hex;
|
|
24
|
+
readonly publicationDescriptorDigest: Sha256Hex;
|
|
25
|
+
}
|
|
26
|
+
/** The authoritative preview facts one upload binds to. */
|
|
27
|
+
export interface ResolvedPublishPreview {
|
|
28
|
+
readonly visibility: PublishVisibility;
|
|
29
|
+
readonly visibilityInput: PublicationVisibilityInput;
|
|
30
|
+
readonly condition?: string;
|
|
31
|
+
readonly publicationSetDigest: string;
|
|
32
|
+
readonly publicationDescriptorDigest: string;
|
|
33
|
+
}
|
|
34
|
+
export declare const publishAuthenticationPreconditions: (options: {
|
|
35
|
+
readonly preview: boolean;
|
|
36
|
+
readonly remoteRegistry: boolean;
|
|
37
|
+
readonly authenticated: boolean;
|
|
38
|
+
readonly hasPublishCandidates: boolean;
|
|
39
|
+
}) => ReadonlyArray<OperationPrecondition>;
|
|
40
|
+
export declare const exactPublishUploadBinding: (capability: PublishGrant, visibilityInput: PublicationVisibilityInput) => Pick<PublishExtensionArgs, "accessToken" | "condition" | "visibility" | "visibilityInput" | "publicationSetDigest" | "publicationDescriptorDigest">;
|
|
41
|
+
export declare const previewPublishUploadBinding: (preview: ResolvedPublishPreview) => Pick<PublishExtensionArgs, "condition" | "visibility" | "visibilityInput" | "publicationSetDigest" | "publicationDescriptorDigest">;
|
|
42
|
+
//# sourceMappingURL=authorization.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication requirements and grant bindings for exact publication.
|
|
3
|
+
*
|
|
4
|
+
* The feature never invokes authentication itself: it expresses the
|
|
5
|
+
* requirement as typed precondition data and consumes the authorization
|
|
6
|
+
* RESULT as a structural grant value. The application sequences the
|
|
7
|
+
* registry-auth feature to satisfy the requirement and passes each issued
|
|
8
|
+
* grant into the upload binding as data.
|
|
9
|
+
*/
|
|
10
|
+
export const publishAuthenticationPreconditions = (options) => options.preview &&
|
|
11
|
+
options.remoteRegistry &&
|
|
12
|
+
!options.authenticated &&
|
|
13
|
+
options.hasPublishCandidates
|
|
14
|
+
? [
|
|
15
|
+
{
|
|
16
|
+
id: "authentication",
|
|
17
|
+
label: "Registry authentication",
|
|
18
|
+
status: "unmet",
|
|
19
|
+
detail: "Publishing requires human authorization before apply; authenticate before preparing a release workflow.",
|
|
20
|
+
blockedOn: "human",
|
|
21
|
+
command: "axm login --device-code --json",
|
|
22
|
+
},
|
|
23
|
+
]
|
|
24
|
+
: [];
|
|
25
|
+
export const exactPublishUploadBinding = (capability, visibilityInput) => ({
|
|
26
|
+
accessToken: capability.accessToken,
|
|
27
|
+
condition: capability.condition,
|
|
28
|
+
publicationSetDigest: capability.publicationSetDigest,
|
|
29
|
+
publicationDescriptorDigest: capability.publicationDescriptorDigest,
|
|
30
|
+
visibilityInput,
|
|
31
|
+
...(capability.visibility.disposition === "establish"
|
|
32
|
+
? { visibility: capability.visibility }
|
|
33
|
+
: {}),
|
|
34
|
+
});
|
|
35
|
+
export const previewPublishUploadBinding = (preview) => ({
|
|
36
|
+
...(preview.condition === undefined ? {} : { condition: preview.condition }),
|
|
37
|
+
publicationSetDigest: preview.publicationSetDigest,
|
|
38
|
+
publicationDescriptorDigest: preview.publicationDescriptorDigest,
|
|
39
|
+
visibilityInput: preview.visibilityInput,
|
|
40
|
+
...(preview.visibility.disposition === "establish" ? { visibility: preview.visibility } : {}),
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=authorization.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed failures for the extension-publish feature. 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 PublishFailed_base: Schema.Class<PublishFailed, Schema.TaggedStruct<"PublishFailed", {
|
|
10
|
+
readonly category: Schema.Literals<readonly ["conflict", "internal", "not_found", "usage", "validation"]>;
|
|
11
|
+
readonly detail: Schema.String;
|
|
12
|
+
readonly recover: Schema.optional<Schema.String>;
|
|
13
|
+
readonly cmd: Schema.optional<Schema.String>;
|
|
14
|
+
readonly suggestions: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
15
|
+
readonly description: Schema.String;
|
|
16
|
+
readonly cmd: Schema.optional<Schema.String>;
|
|
17
|
+
readonly url: Schema.optional<Schema.String>;
|
|
18
|
+
}>>>;
|
|
19
|
+
readonly cause: Schema.optional<Schema.Unknown>;
|
|
20
|
+
}>, import("effect/Cause").YieldableError>;
|
|
21
|
+
/**
|
|
22
|
+
* A publish policy step could not proceed. The carried fields mirror the
|
|
23
|
+
* application error envelope's inputs 1:1: `category` selects the code,
|
|
24
|
+
* `recover` folds into the leading suggested action, and `detail`,
|
|
25
|
+
* `suggestions`, and `cause` carry over verbatim.
|
|
26
|
+
*/
|
|
27
|
+
export declare class PublishFailed extends PublishFailed_base {
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed failures for the extension-publish feature. 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
|
+
const CarriedSuggestedActionSchema = Schema.Struct({
|
|
10
|
+
description: Schema.String,
|
|
11
|
+
cmd: Schema.optional(Schema.String),
|
|
12
|
+
url: Schema.optional(Schema.String),
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* A publish policy step could not proceed. The carried fields mirror the
|
|
16
|
+
* application error envelope's inputs 1:1: `category` selects the code,
|
|
17
|
+
* `recover` folds into the leading suggested action, and `detail`,
|
|
18
|
+
* `suggestions`, and `cause` carry over verbatim.
|
|
19
|
+
*/
|
|
20
|
+
export class PublishFailed extends Schema.TaggedError()("PublishFailed", {
|
|
21
|
+
category: Schema.Literals(["conflict", "internal", "not_found", "usage", "validation"]),
|
|
22
|
+
detail: Schema.String,
|
|
23
|
+
recover: Schema.optional(Schema.String),
|
|
24
|
+
cmd: Schema.optional(Schema.String),
|
|
25
|
+
suggestions: Schema.optional(Schema.Array(CarriedSuggestedActionSchema)),
|
|
26
|
+
cause: Schema.optional(Schema.Unknown),
|
|
27
|
+
}) {
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extension-publish feature: publish selection policy, publication
|
|
3
|
+
* validation, archive planning, authentication requirements, upload
|
|
4
|
+
* settlement, and recovery. Authentication is expressed as typed
|
|
5
|
+
* precondition data and consumed as structural grant values; the application
|
|
6
|
+
* sequences the registry-auth feature to satisfy it.
|
|
7
|
+
*
|
|
8
|
+
* @experimental All exports from this module are unstable and may change without notice.
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
export { PublishFailed } from "./errors.js";
|
|
12
|
+
export { PUBLISHABLE_TYPES, isPublishableType, type PublishableType } from "./publishable-types.js";
|
|
13
|
+
export { runPublishLintGate, type PublishLintArgs } from "./lint-gate.js";
|
|
14
|
+
export { PublishIgnoreError, protectedPublishPaths, publishArchiveOptions, resolvePublishIgnore, } from "./publish-ignore.js";
|
|
15
|
+
export { buildZipArchive, planZipArchive, type ArchivePlan, type ArchivePlanFile, type ArchivePlanPattern, type BuildZipArchiveOptions, type PlannedZipArchive, } from "./archive.js";
|
|
16
|
+
export { settlePublish, type PublishSettlement, type PublishSettlementFailure, type SettledPublish, } from "./settlement.js";
|
|
17
|
+
export { exactPublishUploadBinding, previewPublishUploadBinding, publishAuthenticationPreconditions, type PublishGrant, type ResolvedPublishPreview, } from "./authorization.js";
|
|
18
|
+
export { buildPublishJobs, type PublishPlanCandidate } from "./jobs.js";
|
|
19
|
+
export { publishRecoverySelection, type PublishRecoveryItem } from "./recovery.js";
|
|
20
|
+
export { alreadyPublishedVersionConflict, findPackPublishDivergenceFindings, localPackConstraintFailures, nonMonotonicVersionConflict, validatePublishOwners, type LocalPackConstraintCandidate, type PublishAdvisoryFinding, type PublishAdvisorySuggestion, } from "./preflight.js";
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extension-publish feature: publish selection policy, publication
|
|
3
|
+
* validation, archive planning, authentication requirements, upload
|
|
4
|
+
* settlement, and recovery. Authentication is expressed as typed
|
|
5
|
+
* precondition data and consumed as structural grant values; the application
|
|
6
|
+
* sequences the registry-auth feature to satisfy it.
|
|
7
|
+
*
|
|
8
|
+
* @experimental All exports from this module are unstable and may change without notice.
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
export { PublishFailed } from "./errors.js";
|
|
12
|
+
export { PUBLISHABLE_TYPES, isPublishableType } from "./publishable-types.js";
|
|
13
|
+
export { runPublishLintGate } from "./lint-gate.js";
|
|
14
|
+
export { PublishIgnoreError, protectedPublishPaths, publishArchiveOptions, resolvePublishIgnore, } from "./publish-ignore.js";
|
|
15
|
+
export { buildZipArchive, planZipArchive, } from "./archive.js";
|
|
16
|
+
export { settlePublish, } from "./settlement.js";
|
|
17
|
+
export { exactPublishUploadBinding, previewPublishUploadBinding, publishAuthenticationPreconditions, } from "./authorization.js";
|
|
18
|
+
export { buildPublishJobs } from "./jobs.js";
|
|
19
|
+
export { publishRecoverySelection } from "./recovery.js";
|
|
20
|
+
export { alreadyPublishedVersionConflict, findPackPublishDivergenceFindings, localPackConstraintFailures, nonMonotonicVersionConflict, validatePublishOwners, } from "./preflight.js";
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Glob expansion for extension names.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately duplicated from the CLI-destined glob module: the feature may
|
|
5
|
+
* not depend on application utilities, and this helper is within the
|
|
6
|
+
* sanctioned duplication budget for small pure functions.
|
|
7
|
+
*
|
|
8
|
+
* Expands `*` wildcards against a list of names. Only `*` is supported
|
|
9
|
+
* as a wildcard — all other characters are treated as literals.
|
|
10
|
+
*
|
|
11
|
+
* @experimental This API is unstable and may change without notice.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Expand a glob pattern against a list of names.
|
|
15
|
+
*
|
|
16
|
+
* Only `*` wildcards are supported. All other characters (including `?`, `[`, `]`)
|
|
17
|
+
* are treated as literals. Matching is case-sensitive.
|
|
18
|
+
*
|
|
19
|
+
* @param pattern - The pattern to match (may contain `*`)
|
|
20
|
+
* @param names - Available names to match against
|
|
21
|
+
* @returns Matching names in their original order
|
|
22
|
+
*/
|
|
23
|
+
export declare const expandGlob: (pattern: string, names: ReadonlyArray<string>) => ReadonlyArray<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Expand multiple glob patterns against a list of skill names.
|
|
26
|
+
*
|
|
27
|
+
* Returns the union of all matches, deduplicated, preserving the original
|
|
28
|
+
* order of `names`.
|
|
29
|
+
*
|
|
30
|
+
* @param patterns - Patterns to match (may contain `*`)
|
|
31
|
+
* @param names - Available names to match against
|
|
32
|
+
* @returns Matching names in their original order, deduplicated
|
|
33
|
+
*/
|
|
34
|
+
export declare const expandGlobs: (patterns: ReadonlyArray<string>, names: ReadonlyArray<string>) => ReadonlyArray<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Returns true when an input should be treated as a glob pattern.
|
|
37
|
+
*/
|
|
38
|
+
export declare const isGlobPattern: (input: string) => boolean;
|
|
39
|
+
//# sourceMappingURL=glob.d.ts.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Glob expansion for extension names.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately duplicated from the CLI-destined glob module: the feature may
|
|
5
|
+
* not depend on application utilities, and this helper is within the
|
|
6
|
+
* sanctioned duplication budget for small pure functions.
|
|
7
|
+
*
|
|
8
|
+
* Expands `*` wildcards against a list of names. Only `*` is supported
|
|
9
|
+
* as a wildcard — all other characters are treated as literals.
|
|
10
|
+
*
|
|
11
|
+
* @experimental This API is unstable and may change without notice.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Expand a glob pattern against a list of names.
|
|
15
|
+
*
|
|
16
|
+
* Only `*` wildcards are supported. All other characters (including `?`, `[`, `]`)
|
|
17
|
+
* are treated as literals. Matching is case-sensitive.
|
|
18
|
+
*
|
|
19
|
+
* @param pattern - The pattern to match (may contain `*`)
|
|
20
|
+
* @param names - Available names to match against
|
|
21
|
+
* @returns Matching names in their original order
|
|
22
|
+
*/
|
|
23
|
+
export const expandGlob = (pattern, names) => {
|
|
24
|
+
const matches = (name) => {
|
|
25
|
+
let patternIndex = 0;
|
|
26
|
+
let nameIndex = 0;
|
|
27
|
+
let wildcardIndex = -1;
|
|
28
|
+
let wildcardNameIndex = 0;
|
|
29
|
+
while (nameIndex < name.length) {
|
|
30
|
+
const token = pattern[patternIndex];
|
|
31
|
+
if (token !== undefined && token !== "*" && token === name[nameIndex]) {
|
|
32
|
+
patternIndex += 1;
|
|
33
|
+
nameIndex += 1;
|
|
34
|
+
}
|
|
35
|
+
else if (token === "*") {
|
|
36
|
+
wildcardIndex = patternIndex;
|
|
37
|
+
wildcardNameIndex = nameIndex;
|
|
38
|
+
patternIndex += 1;
|
|
39
|
+
}
|
|
40
|
+
else if (wildcardIndex >= 0) {
|
|
41
|
+
patternIndex = wildcardIndex + 1;
|
|
42
|
+
wildcardNameIndex += 1;
|
|
43
|
+
nameIndex = wildcardNameIndex;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
while (pattern[patternIndex] === "*") {
|
|
50
|
+
patternIndex += 1;
|
|
51
|
+
}
|
|
52
|
+
return patternIndex === pattern.length;
|
|
53
|
+
};
|
|
54
|
+
return names.filter(matches);
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Expand multiple glob patterns against a list of skill names.
|
|
58
|
+
*
|
|
59
|
+
* Returns the union of all matches, deduplicated, preserving the original
|
|
60
|
+
* order of `names`.
|
|
61
|
+
*
|
|
62
|
+
* @param patterns - Patterns to match (may contain `*`)
|
|
63
|
+
* @param names - Available names to match against
|
|
64
|
+
* @returns Matching names in their original order, deduplicated
|
|
65
|
+
*/
|
|
66
|
+
export const expandGlobs = (patterns, names) => {
|
|
67
|
+
const matched = new Set();
|
|
68
|
+
for (const pattern of patterns) {
|
|
69
|
+
for (const name of expandGlob(pattern, names)) {
|
|
70
|
+
matched.add(name);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return names.filter((n) => matched.has(n));
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Returns true when an input should be treated as a glob pattern.
|
|
77
|
+
*/
|
|
78
|
+
export const isGlobPattern = (input) => input.includes("*");
|
|
79
|
+
//# sourceMappingURL=glob.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Job, PlannedJobStep } from "@agentxm/workspace-operations";
|
|
2
|
+
import type { PublishableType } from "./publishable-types.js";
|
|
3
|
+
/** The selection facts one publish candidate contributes to job planning. */
|
|
4
|
+
export interface PublishPlanCandidate {
|
|
5
|
+
readonly fqn: string;
|
|
6
|
+
readonly type: PublishableType;
|
|
7
|
+
readonly dependencies?: Readonly<Record<string, unknown>>;
|
|
8
|
+
readonly includedDependency?: true;
|
|
9
|
+
}
|
|
10
|
+
/** Creates dependency edges without expanding the user's selection. */
|
|
11
|
+
export declare const buildPublishJobs: <Candidate extends PublishPlanCandidate, Requirements = never, Output = never>(candidates: ReadonlyArray<Candidate>, candidateStep: (candidate: Candidate) => PlannedJobStep<Requirements, Output>) => ReadonlyArray<Job<Requirements, Output>>;
|
|
12
|
+
//# sourceMappingURL=jobs.d.ts.map
|
package/dist/src/jobs.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Creates dependency edges without expanding the user's selection. */
|
|
2
|
+
export const buildPublishJobs = (candidates, candidateStep) => {
|
|
3
|
+
const selectedFqns = new Set(candidates.map((candidate) => candidate.fqn));
|
|
4
|
+
return [
|
|
5
|
+
{
|
|
6
|
+
concurrency: 4,
|
|
7
|
+
executionPolicy: "best-effort",
|
|
8
|
+
steps: candidates.map((candidate) => ({
|
|
9
|
+
...candidateStep(candidate),
|
|
10
|
+
key: candidate.fqn,
|
|
11
|
+
...(candidate.type !== "pack"
|
|
12
|
+
? {}
|
|
13
|
+
: {
|
|
14
|
+
dependsOn: Object.keys(candidate.dependencies ?? {}).filter((fqn) => selectedFqns.has(fqn)),
|
|
15
|
+
}),
|
|
16
|
+
})),
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=jobs.js.map
|