@spacefast/common 0.2.2 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/marketplace-prompts.d.ts +1 -0
- package/dist/agents/marketplace-prompts.js +6 -0
- package/dist/agents/registry/core.d.ts +4 -12
- package/dist/agents/registry/core.js +7 -28
- package/dist/config/domains.d.ts +10 -8
- package/dist/config/domains.js +4 -7
- package/dist/contracts/access-core.d.ts +135 -0
- package/dist/contracts/access-core.js +242 -0
- package/dist/contracts/access-profiles.d.ts +8 -8
- package/dist/contracts/access-profiles.js +8 -8
- package/dist/contracts/access.d.ts +14 -103
- package/dist/contracts/access.js +10 -210
- package/dist/contracts/activity.d.ts +54 -55
- package/dist/contracts/activity.js +38 -9
- package/dist/contracts/api-keys.d.ts +69 -26
- package/dist/contracts/api-keys.js +29 -2
- package/dist/contracts/application-journal.d.ts +197 -4
- package/dist/contracts/application-journal.js +97 -16
- package/dist/contracts/auth.d.ts +20 -0
- package/dist/contracts/auth.js +18 -0
- package/dist/contracts/beta.d.ts +13 -0
- package/dist/contracts/beta.js +28 -0
- package/dist/contracts/billing.d.ts +2 -2
- package/dist/contracts/bootstrap.d.ts +23 -6
- package/dist/contracts/builds.d.ts +18 -4
- package/dist/contracts/builds.js +7 -4
- package/dist/contracts/channels.d.ts +43 -0
- package/dist/contracts/channels.js +22 -6
- package/dist/contracts/comments.d.ts +49 -0
- package/dist/contracts/comments.js +61 -2
- package/dist/contracts/commerce.d.ts +19 -13
- package/dist/contracts/connector-access.d.ts +28 -0
- package/dist/contracts/connector-access.js +31 -0
- package/dist/contracts/connectors.d.ts +2382 -0
- package/dist/contracts/connectors.js +941 -0
- package/dist/contracts/content-contract-verification.d.ts +112 -58
- package/dist/contracts/content-contract-verification.js +42 -54
- package/dist/contracts/content-model-emit.d.ts +97 -0
- package/dist/contracts/content-model-emit.js +306 -0
- package/dist/contracts/content-model-sdk.d.ts +101 -0
- package/dist/contracts/content-model-sdk.js +232 -0
- package/dist/contracts/{content-program.d.ts → content-model.d.ts} +338 -82
- package/dist/contracts/{content-program.js → content-model.js} +291 -63
- package/dist/contracts/content-platform-fixture.d.ts +380 -110
- package/dist/contracts/content-platform-fixture.js +8 -8
- package/dist/contracts/content-sync.d.ts +197 -74
- package/dist/contracts/content-sync.js +98 -37
- package/dist/contracts/content.d.ts +30 -422
- package/dist/contracts/content.js +34 -294
- package/dist/contracts/dashboard-prefs.d.ts +10 -3
- package/dist/contracts/dashboard-prefs.js +6 -3
- package/dist/contracts/data-location.d.ts +9 -0
- package/dist/contracts/data-location.js +7 -0
- package/dist/contracts/deployment-comparison.d.ts +67 -0
- package/dist/contracts/deployment-comparison.js +68 -0
- package/dist/contracts/device-auth.d.ts +55 -11
- package/dist/contracts/domains.d.ts +40 -16
- package/dist/contracts/domains.js +23 -0
- package/dist/contracts/enums.d.ts +1 -10
- package/dist/contracts/enums.js +0 -15
- package/dist/contracts/error-code-meta.d.ts +384 -20
- package/dist/contracts/error-code-meta.js +200 -5
- package/dist/contracts/error-codes.d.ts +17 -4
- package/dist/contracts/error-codes.js +108 -10
- package/dist/contracts/events.d.ts +5 -0
- package/dist/contracts/events.js +12 -3
- package/dist/contracts/execution.d.ts +5 -1
- package/dist/contracts/execution.js +4 -0
- package/dist/contracts/feature-lifecycle.d.ts +53 -20
- package/dist/contracts/feature-lifecycle.js +65 -23
- package/dist/contracts/features.d.ts +57 -31
- package/dist/contracts/features.js +0 -1
- package/dist/contracts/feedback.d.ts +124 -0
- package/dist/contracts/feedback.js +64 -0
- package/dist/contracts/fixtures/content-model-sdk-v1.generated.d.ts +129 -0
- package/dist/contracts/fixtures/content-model-sdk-v1.generated.js +48 -0
- package/dist/contracts/fixtures/content-platform-v1.json +101 -49
- package/dist/contracts/frame-session.d.ts +60 -10
- package/dist/contracts/frame-session.js +52 -12
- package/dist/contracts/functions.d.ts +28 -2
- package/dist/contracts/functions.js +25 -2
- package/dist/contracts/grant-copy.d.ts +2 -0
- package/dist/contracts/grant-copy.js +2 -0
- package/dist/contracts/grants-core.d.ts +95 -0
- package/dist/contracts/grants-core.js +435 -0
- package/dist/contracts/grants.d.ts +13 -84
- package/dist/contracts/grants.js +21 -369
- package/dist/contracts/ids-core.d.ts +11 -0
- package/dist/contracts/ids-core.js +14 -0
- package/dist/contracts/ids.d.ts +7 -4
- package/dist/contracts/ids.js +12 -4
- package/dist/contracts/internal.d.ts +18 -0
- package/dist/contracts/internal.js +19 -0
- package/dist/contracts/mcp.d.ts +8 -18
- package/dist/contracts/mcp.js +2 -23
- package/dist/contracts/notifications.d.ts +4 -1
- package/dist/contracts/notifications.js +1 -0
- package/dist/contracts/oauth-resources.d.ts +46 -9
- package/dist/contracts/oauth-resources.js +50 -1
- package/dist/contracts/oauth-scope-actions.d.ts +27 -3
- package/dist/contracts/oauth-scope-actions.js +18 -8
- package/dist/contracts/operations.d.ts +1 -1
- package/dist/contracts/partner-account.d.ts +629 -0
- package/dist/contracts/partner-account.js +18 -0
- package/dist/contracts/principal-assertion.d.ts +74 -1
- package/dist/contracts/principal-assertion.js +67 -3
- package/dist/contracts/publish-archive.d.ts +22 -1
- package/dist/contracts/push-new.d.ts +3 -3
- package/dist/contracts/push-new.js +1 -1
- package/dist/contracts/quotas.js +2 -1
- package/dist/contracts/repository-connections.d.ts +10 -6
- package/dist/contracts/repository-connections.js +15 -0
- package/dist/contracts/resources.d.ts +6 -5
- package/dist/contracts/resources.js +7 -0
- package/dist/contracts/route-inventory.d.ts +74 -19
- package/dist/contracts/route-inventory.js +20 -6
- package/dist/contracts/runtime-api.d.ts +415 -4
- package/dist/contracts/runtime-api.js +60 -15
- package/dist/contracts/runtime-app.d.ts +6 -1
- package/dist/contracts/runtime-components.d.ts +646 -18
- package/dist/contracts/runtime-components.js +304 -188
- package/dist/contracts/runtime-services.d.ts +15 -0
- package/dist/contracts/runtime-services.js +25 -0
- package/dist/contracts/runtime-storage.d.ts +32 -0
- package/dist/contracts/runtime-storage.js +37 -0
- package/dist/contracts/source-workspaces.d.ts +511 -0
- package/dist/contracts/source-workspaces.js +276 -0
- package/dist/contracts/space-config-spacefast.d.ts +394 -0
- package/dist/contracts/space-config-spacefast.js +70 -0
- package/dist/contracts/space-config.d.ts +177 -90
- package/dist/contracts/space-config.js +77 -92
- package/dist/contracts/spaces.d.ts +132 -24
- package/dist/contracts/spaces.js +77 -13
- package/dist/contracts/superadmin-connectors.d.ts +371 -0
- package/dist/contracts/superadmin-connectors.js +61 -0
- package/dist/contracts/superadmin-emails.d.ts +1 -1
- package/dist/contracts/superadmin-emails.js +1 -1
- package/dist/contracts/superadmin-entities.d.ts +105 -0
- package/dist/contracts/superadmin-entities.js +64 -0
- package/dist/contracts/superadmin-runtime.d.ts +35 -116
- package/dist/contracts/superadmin-runtime.js +13 -69
- package/dist/contracts/superadmin-search.d.ts +12 -14
- package/dist/contracts/superadmin-search.js +2 -2
- package/dist/contracts/superadmin-spaces.d.ts +15 -72
- package/dist/contracts/superadmin-spaces.js +2 -7
- package/dist/contracts/superadmin-teams.d.ts +12 -0
- package/dist/contracts/superadmin-teams.js +7 -1
- package/dist/contracts/superadmin-tenants.d.ts +44 -16
- package/dist/contracts/superadmin.d.ts +2 -2
- package/dist/contracts/tags.d.ts +12 -12
- package/dist/contracts/teams.d.ts +29 -1
- package/dist/contracts/teams.js +24 -2
- package/dist/contracts/tenants.d.ts +98 -0
- package/dist/contracts/tenants.js +20 -0
- package/dist/contracts/transfers.d.ts +92 -0
- package/dist/contracts/transfers.js +37 -0
- package/dist/contracts/usage.d.ts +9 -1
- package/dist/contracts/usage.js +2 -0
- package/dist/contracts/visual-review.d.ts +448 -0
- package/dist/contracts/visual-review.js +156 -0
- package/dist/contracts/wordpress-php-toolkit.json +9 -0
- package/dist/contracts/work-mode.d.ts +24 -0
- package/dist/contracts/work-mode.js +17 -0
- package/dist/contracts/wp-cli.d.ts +66 -0
- package/dist/contracts/wp-cli.js +68 -0
- package/dist/contracts/zero-catalog.d.ts +29 -0
- package/dist/contracts/zero-catalog.js +55 -0
- package/dist/contracts/zero-platform-abilities.generated.d.ts +31 -0
- package/dist/contracts/zero-platform-abilities.generated.js +373 -0
- package/dist/contracts/zero-spacefast.d.ts +444 -0
- package/dist/contracts/zero-spacefast.js +149 -0
- package/dist/contracts/zero-types.d.ts +47 -0
- package/dist/contracts/zero-types.js +263 -0
- package/dist/contracts/zero.d.ts +781 -14
- package/dist/contracts/zero.js +204 -10
- package/dist/dashboard-paths/index.d.ts +2 -2
- package/dist/dashboard-paths/route-reservations.generated.d.ts +2 -2
- package/dist/dashboard-paths/route-reservations.generated.js +5 -0
- package/dist/docs/agent-prose.d.ts +1 -1
- package/dist/docs/agent-prose.js +15 -18
- package/dist/docs/agent-setup.d.ts +1 -1
- package/dist/docs/agent-setup.js +5 -13
- package/dist/docs/catalog.d.ts +64 -28
- package/dist/docs/catalog.js +155 -28
- package/dist/docs/error-docs.d.ts +361 -17
- package/dist/docs/error-docs.js +365 -21
- package/dist/docs/reference-urls.js +1 -1
- package/dist/docs/skills.d.ts +84 -84
- package/dist/docs/skills.js +66 -47
- package/dist/docs/start-prompts.d.ts +14 -0
- package/dist/docs/start-prompts.js +20 -0
- package/dist/utils/account-labels.d.ts +7 -0
- package/dist/utils/account-labels.js +15 -0
- package/dist/utils/auth.d.ts +1 -0
- package/dist/utils/auth.js +1 -0
- package/dist/utils/credential-policy.d.ts +22 -1
- package/dist/utils/credential-policy.js +55 -6
- package/dist/utils/local-space-state.d.ts +7 -0
- package/dist/utils/local-space-state.js +7 -0
- package/dist/utils/logger.d.ts +34 -0
- package/dist/utils/logger.js +144 -0
- package/dist/utils/page-routes.d.ts +9 -0
- package/dist/utils/page-routes.js +82 -0
- package/dist/utils/pages.d.ts +2 -0
- package/dist/utils/pages.js +7 -0
- package/dist/utils/publish-form-data.d.ts +2 -0
- package/dist/utils/publish-form-data.js +2 -0
- package/dist/utils/publish-policy-spacefast.d.ts +13 -0
- package/dist/utils/publish-policy-spacefast.js +117 -0
- package/dist/utils/publish-policy.d.ts +22 -16
- package/dist/utils/publish-policy.fixtures.json +15 -0
- package/dist/utils/publish-policy.js +62 -139
- package/dist/utils/query-client.js +9 -1
- package/dist/utils/runtime-upload.d.ts +4 -0
- package/dist/utils/runtime-upload.js +5 -0
- package/dist/utils/space-config.d.ts +2 -3
- package/dist/utils/space-config.js +1 -1
- package/dist/utils/uploaded-source.d.ts +4 -0
- package/dist/utils/uploaded-source.js +12 -0
- package/dist/visual-review.d.ts +4 -0
- package/dist/visual-review.js +208 -0
- package/dist/vocabulary.d.ts +38 -0
- package/dist/vocabulary.js +55 -0
- package/package.json +7 -2
- package/dist/agents/registry/deeplink-probes.d.ts +0 -23
- package/dist/agents/registry/deeplink-probes.js +0 -18
package/dist/contracts/grants.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { grantCapabilitySchema, grantConstraintsSchema, grantReferenceSchema, identityConnectionPublicKeySchema, grantResourceSetSchema, grantTargetSelectorSchema, GRANT_CAPABILITIES, uniqueArray, } from "./grants-core.js";
|
|
3
3
|
import { registeredIdSchema } from "./ids.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"access.manage",
|
|
10
|
-
];
|
|
11
|
-
export const grantCapabilitySchema = z.enum(GRANT_CAPABILITIES);
|
|
4
|
+
// Spacefast's sharing model: WHO holds an authority, and how it is stored,
|
|
5
|
+
// minted and revoked. The vocabulary an authority is expressed in — capabilities,
|
|
6
|
+
// resource patterns, targets, constraints — is host-agnostic and lives in
|
|
7
|
+
// `./grants-core.js`, which this module re-exports so a Grant reads whole.
|
|
8
|
+
export * from "./grants-core.js";
|
|
12
9
|
export const GRANT_AUDIENCE_KINDS = [
|
|
13
10
|
"public",
|
|
14
11
|
"team",
|
|
@@ -19,7 +16,6 @@ export const GRANT_AUDIENCE_KINDS = [
|
|
|
19
16
|
"external",
|
|
20
17
|
];
|
|
21
18
|
export const grantAudienceKindSchema = z.enum(GRANT_AUDIENCE_KINDS);
|
|
22
|
-
const grantReferenceSchema = z.string().trim().min(1).max(255);
|
|
23
19
|
export const grantAudienceSchema = z.discriminatedUnion("kind", [
|
|
24
20
|
z.object({ kind: z.literal("public") }).strict(),
|
|
25
21
|
z.object({ kind: z.literal("team"), teamId: grantReferenceSchema }).strict(),
|
|
@@ -35,357 +31,6 @@ export const grantAudienceSchema = z.discriminatedUnion("kind", [
|
|
|
35
31
|
})
|
|
36
32
|
.strict(),
|
|
37
33
|
]);
|
|
38
|
-
function hasUnsafePatternCharacter(value) {
|
|
39
|
-
for (const character of value) {
|
|
40
|
-
const codePoint = character.codePointAt(0);
|
|
41
|
-
if (codePoint === undefined ||
|
|
42
|
-
codePoint <= 0x1f ||
|
|
43
|
-
codePoint === 0x7f ||
|
|
44
|
-
character === "\\" ||
|
|
45
|
-
character === "?" ||
|
|
46
|
-
character === "#") {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Canonical resource-pattern syntax shared by config compilation and evaluation.
|
|
54
|
-
* `*` matches one path segment and `**` matches zero or more segments. Wildcards
|
|
55
|
-
* are whole segments so a pattern can never disguise an encoded separator.
|
|
56
|
-
*
|
|
57
|
-
* Unlike URL-route canonicalization, resource patterns retain a terminal
|
|
58
|
-
* `index.html`: Grants can constrain the visitor-facing route and the artifact
|
|
59
|
-
* it resolves to independently.
|
|
60
|
-
*/
|
|
61
|
-
export function normalizeGrantResourcePattern(input) {
|
|
62
|
-
if (!input.startsWith("/") || input.startsWith("//") || hasUnsafePatternCharacter(input)) {
|
|
63
|
-
throw new TypeError("resource pattern must be a plain absolute URL path pattern");
|
|
64
|
-
}
|
|
65
|
-
if (/%2f|%5c|%2a/iu.test(input)) {
|
|
66
|
-
throw new TypeError("resource pattern contains an ambiguous encoded separator or wildcard");
|
|
67
|
-
}
|
|
68
|
-
let decoded;
|
|
69
|
-
try {
|
|
70
|
-
decoded = decodeURIComponent(input);
|
|
71
|
-
}
|
|
72
|
-
catch {
|
|
73
|
-
throw new TypeError("resource pattern contains malformed percent encoding");
|
|
74
|
-
}
|
|
75
|
-
if (hasUnsafePatternCharacter(decoded)) {
|
|
76
|
-
throw new TypeError("resource pattern contains an unsafe character");
|
|
77
|
-
}
|
|
78
|
-
const segments = [];
|
|
79
|
-
for (const rawSegment of decoded.split("/")) {
|
|
80
|
-
const segment = rawSegment.normalize("NFC");
|
|
81
|
-
if (segment === "" || segment === ".")
|
|
82
|
-
continue;
|
|
83
|
-
if (segment === "..") {
|
|
84
|
-
if (segments.length === 0)
|
|
85
|
-
throw new TypeError("resource pattern escapes the URL root");
|
|
86
|
-
segments.pop();
|
|
87
|
-
continue;
|
|
88
|
-
}
|
|
89
|
-
if (segment.includes("*") && segment !== "*" && segment !== "**") {
|
|
90
|
-
throw new TypeError("resource wildcards must occupy a whole path segment");
|
|
91
|
-
}
|
|
92
|
-
segments.push(segment);
|
|
93
|
-
}
|
|
94
|
-
return segments.length === 0 ? "/" : `/${segments.join("/")}`;
|
|
95
|
-
}
|
|
96
|
-
export const grantResourcePatternSchema = z
|
|
97
|
-
.string()
|
|
98
|
-
.min(1)
|
|
99
|
-
.max(1024)
|
|
100
|
-
.check((context) => {
|
|
101
|
-
try {
|
|
102
|
-
context.value = normalizeGrantResourcePattern(context.value);
|
|
103
|
-
}
|
|
104
|
-
catch (error) {
|
|
105
|
-
context.issues.push({
|
|
106
|
-
code: "custom",
|
|
107
|
-
input: context.value,
|
|
108
|
-
message: error instanceof Error ? error.message : "invalid resource pattern",
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
function uniqueArray(values) {
|
|
113
|
-
return new Set(values).size === values.length;
|
|
114
|
-
}
|
|
115
|
-
export const GRANT_RESOURCE_PATTERN_LIMIT = 100;
|
|
116
|
-
export const grantResourceSetSchema = z
|
|
117
|
-
.object({
|
|
118
|
-
include: z.array(grantResourcePatternSchema).min(1).max(GRANT_RESOURCE_PATTERN_LIMIT),
|
|
119
|
-
exclude: z.array(grantResourcePatternSchema).max(GRANT_RESOURCE_PATTERN_LIMIT).default([]),
|
|
120
|
-
})
|
|
121
|
-
.strict()
|
|
122
|
-
.superRefine((value, context) => {
|
|
123
|
-
if (value.include.length + value.exclude.length > GRANT_RESOURCE_PATTERN_LIMIT) {
|
|
124
|
-
context.addIssue({
|
|
125
|
-
code: "custom",
|
|
126
|
-
message: `resource sets support up to ${GRANT_RESOURCE_PATTERN_LIMIT} patterns`,
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
if (!uniqueArray(value.include)) {
|
|
130
|
-
context.addIssue({
|
|
131
|
-
code: "custom",
|
|
132
|
-
path: ["include"],
|
|
133
|
-
message: "include patterns must be unique",
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
if (!uniqueArray(value.exclude)) {
|
|
137
|
-
context.addIssue({
|
|
138
|
-
code: "custom",
|
|
139
|
-
path: ["exclude"],
|
|
140
|
-
message: "exclude patterns must be unique",
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
export const GRANT_TARGET_KINDS = ["live", "version", "branch", "all_versions"];
|
|
145
|
-
export const grantTargetKindSchema = z.enum(GRANT_TARGET_KINDS);
|
|
146
|
-
export const grantTargetSelectorSchema = z.discriminatedUnion("kind", [
|
|
147
|
-
z.object({ kind: z.literal("live") }).strict(),
|
|
148
|
-
z.object({ kind: z.literal("version"), versionId: grantReferenceSchema }).strict(),
|
|
149
|
-
z.object({ kind: z.literal("branch"), branch: grantReferenceSchema }).strict(),
|
|
150
|
-
z.object({ kind: z.literal("all_versions") }).strict(),
|
|
151
|
-
]);
|
|
152
|
-
function parseIpv4(input) {
|
|
153
|
-
const parts = input.split(".");
|
|
154
|
-
if (parts.length !== 4)
|
|
155
|
-
return null;
|
|
156
|
-
let bits = 0n;
|
|
157
|
-
for (const part of parts) {
|
|
158
|
-
if (!/^(?:0|[1-9][0-9]{0,2})$/u.test(part))
|
|
159
|
-
return null;
|
|
160
|
-
const value = Number(part);
|
|
161
|
-
if (value > 255)
|
|
162
|
-
return null;
|
|
163
|
-
bits = (bits << 8n) | BigInt(value);
|
|
164
|
-
}
|
|
165
|
-
return { bits, width: 32 };
|
|
166
|
-
}
|
|
167
|
-
function parseIpv6(input) {
|
|
168
|
-
if (input === "" || input.includes("%") || input.split("::").length > 2)
|
|
169
|
-
return null;
|
|
170
|
-
let value = input.toLowerCase();
|
|
171
|
-
const ipv4Tail = value.match(/(?:^|:)([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)$/u)?.[1];
|
|
172
|
-
if (ipv4Tail) {
|
|
173
|
-
const parsed = parseIpv4(ipv4Tail);
|
|
174
|
-
if (!parsed)
|
|
175
|
-
return null;
|
|
176
|
-
value = `${value.slice(0, -ipv4Tail.length)}${Number((parsed.bits >> 16n) & 0xffffn).toString(16)}:${Number(parsed.bits & 0xffffn).toString(16)}`;
|
|
177
|
-
}
|
|
178
|
-
const [leftText, rightText] = value.split("::");
|
|
179
|
-
const left = leftText ? leftText.split(":") : [];
|
|
180
|
-
const right = rightText ? rightText.split(":") : [];
|
|
181
|
-
if ([...left, ...right].some((part) => !/^[0-9a-f]{1,4}$/u.test(part)))
|
|
182
|
-
return null;
|
|
183
|
-
const compressed = value.includes("::");
|
|
184
|
-
const missing = 8 - left.length - right.length;
|
|
185
|
-
if ((!compressed && missing !== 0) || (compressed && missing < 1))
|
|
186
|
-
return null;
|
|
187
|
-
const parts = [...left, ...Array.from({ length: missing }, () => "0"), ...right];
|
|
188
|
-
if (parts.length !== 8)
|
|
189
|
-
return null;
|
|
190
|
-
return {
|
|
191
|
-
bits: parts.reduce((bits, part) => (bits << 16n) | BigInt(`0x${part}`), 0n),
|
|
192
|
-
width: 128,
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
function parseIpAddress(input) {
|
|
196
|
-
return parseIpv4(input) ?? parseIpv6(input);
|
|
197
|
-
}
|
|
198
|
-
export function normalizeGrantNetworkCidr(input) {
|
|
199
|
-
const value = input.trim().toLowerCase();
|
|
200
|
-
const separator = value.lastIndexOf("/");
|
|
201
|
-
const address = separator === -1 ? value : value.slice(0, separator);
|
|
202
|
-
const parsed = parseIpAddress(address);
|
|
203
|
-
if (!parsed)
|
|
204
|
-
throw new TypeError("network rules require a valid IPv4 or IPv6 address");
|
|
205
|
-
if (separator === -1)
|
|
206
|
-
return value;
|
|
207
|
-
const prefixText = value.slice(separator + 1);
|
|
208
|
-
if (!/^(?:0|[1-9][0-9]{0,2})$/u.test(prefixText)) {
|
|
209
|
-
throw new TypeError("network rules require a valid CIDR prefix");
|
|
210
|
-
}
|
|
211
|
-
const prefix = Number(prefixText);
|
|
212
|
-
if (prefix > parsed.width)
|
|
213
|
-
throw new TypeError("network CIDR prefix exceeds its address width");
|
|
214
|
-
return `${address}/${prefix}`;
|
|
215
|
-
}
|
|
216
|
-
export function grantNetworkCidrMatches(cidr, ipAddress) {
|
|
217
|
-
let canonical;
|
|
218
|
-
try {
|
|
219
|
-
canonical = normalizeGrantNetworkCidr(cidr);
|
|
220
|
-
}
|
|
221
|
-
catch {
|
|
222
|
-
return false;
|
|
223
|
-
}
|
|
224
|
-
const separator = canonical.lastIndexOf("/");
|
|
225
|
-
const networkText = separator === -1 ? canonical : canonical.slice(0, separator);
|
|
226
|
-
const network = parseIpAddress(networkText);
|
|
227
|
-
const address = parseIpAddress(ipAddress.trim().toLowerCase());
|
|
228
|
-
if (!network || !address || network.width !== address.width)
|
|
229
|
-
return false;
|
|
230
|
-
const prefix = separator === -1 ? network.width : Number(canonical.slice(separator + 1));
|
|
231
|
-
if (prefix === 0)
|
|
232
|
-
return true;
|
|
233
|
-
const shift = BigInt(network.width - prefix);
|
|
234
|
-
return network.bits >> shift === address.bits >> shift;
|
|
235
|
-
}
|
|
236
|
-
const grantNetworkCidrSchema = z
|
|
237
|
-
.string()
|
|
238
|
-
.min(1)
|
|
239
|
-
.max(64)
|
|
240
|
-
.check((context) => {
|
|
241
|
-
try {
|
|
242
|
-
context.value = normalizeGrantNetworkCidr(context.value);
|
|
243
|
-
}
|
|
244
|
-
catch (error) {
|
|
245
|
-
context.issues.push({
|
|
246
|
-
code: "custom",
|
|
247
|
-
input: context.value,
|
|
248
|
-
message: error instanceof Error ? error.message : "invalid network rule",
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
const grantCountrySchema = z
|
|
253
|
-
.string()
|
|
254
|
-
.length(2)
|
|
255
|
-
.overwrite((country) => country.toUpperCase())
|
|
256
|
-
.refine((country) => ISO_COUNTRY_CODES.includes(country), "Country must be an ISO 3166-1 alpha-2 code.");
|
|
257
|
-
const grantConstraintDateSchema = z.string().datetime();
|
|
258
|
-
const grantConstraintMaxUsesSchema = z.number().int().positive().max(1_000_000);
|
|
259
|
-
const grantConstraintIpCidrsSchema = z.array(grantNetworkCidrSchema).min(1).max(50);
|
|
260
|
-
const grantConstraintCountriesSchema = z.array(grantCountrySchema).min(1).max(250);
|
|
261
|
-
const grantConstraintUserAgentsSchema = z.array(z.string().trim().min(1).max(200)).min(1).max(50);
|
|
262
|
-
const grantNetworkConstraintsSchema = z
|
|
263
|
-
.object({
|
|
264
|
-
ipCidrs: grantConstraintIpCidrsSchema.optional(),
|
|
265
|
-
countries: grantConstraintCountriesSchema.optional(),
|
|
266
|
-
excludedCountries: grantConstraintCountriesSchema.optional(),
|
|
267
|
-
excludedUserAgentSubstrings: grantConstraintUserAgentsSchema.optional(),
|
|
268
|
-
})
|
|
269
|
-
.strict()
|
|
270
|
-
.superRefine((network, context) => {
|
|
271
|
-
if (network.ipCidrs === undefined &&
|
|
272
|
-
network.countries === undefined &&
|
|
273
|
-
network.excludedCountries === undefined &&
|
|
274
|
-
network.excludedUserAgentSubstrings === undefined) {
|
|
275
|
-
context.addIssue({
|
|
276
|
-
code: "custom",
|
|
277
|
-
message: "network requires at least one IP, country, or user-agent selector",
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
export const grantConstraintsSchema = z
|
|
282
|
-
.object({
|
|
283
|
-
notBefore: grantConstraintDateSchema.optional(),
|
|
284
|
-
expiresAt: grantConstraintDateSchema.optional(),
|
|
285
|
-
maxUses: grantConstraintMaxUsesSchema.optional(),
|
|
286
|
-
requireVerifiedEmail: z.boolean().optional(),
|
|
287
|
-
network: grantNetworkConstraintsSchema.optional(),
|
|
288
|
-
})
|
|
289
|
-
.strict()
|
|
290
|
-
.superRefine((value, context) => {
|
|
291
|
-
if (value.notBefore !== undefined &&
|
|
292
|
-
value.expiresAt !== undefined &&
|
|
293
|
-
Date.parse(value.notBefore) >= Date.parse(value.expiresAt)) {
|
|
294
|
-
context.addIssue({
|
|
295
|
-
code: "custom",
|
|
296
|
-
path: ["expiresAt"],
|
|
297
|
-
message: "expiresAt must be later than notBefore",
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
/** Field-scoped PATCH shape. `null` clears one constraint without replacing its siblings. */
|
|
302
|
-
export const grantConstraintsPatchSchema = z
|
|
303
|
-
.object({
|
|
304
|
-
notBefore: grantConstraintDateSchema.nullable().optional(),
|
|
305
|
-
expiresAt: grantConstraintDateSchema.nullable().optional(),
|
|
306
|
-
maxUses: grantConstraintMaxUsesSchema.nullable().optional(),
|
|
307
|
-
requireVerifiedEmail: z.boolean().nullable().optional(),
|
|
308
|
-
network: z
|
|
309
|
-
.object({
|
|
310
|
-
ipCidrs: grantConstraintIpCidrsSchema.nullable().optional(),
|
|
311
|
-
countries: grantConstraintCountriesSchema.nullable().optional(),
|
|
312
|
-
excludedCountries: grantConstraintCountriesSchema.nullable().optional(),
|
|
313
|
-
excludedUserAgentSubstrings: grantConstraintUserAgentsSchema.nullable().optional(),
|
|
314
|
-
})
|
|
315
|
-
.strict()
|
|
316
|
-
.nullable()
|
|
317
|
-
.optional(),
|
|
318
|
-
})
|
|
319
|
-
.strict();
|
|
320
|
-
export function diffGrantConstraints(original, draft) {
|
|
321
|
-
const network = JSON.stringify(original.network) === JSON.stringify(draft.network)
|
|
322
|
-
? undefined
|
|
323
|
-
: draft.network === undefined
|
|
324
|
-
? null
|
|
325
|
-
: {
|
|
326
|
-
...(JSON.stringify(original.network?.ipCidrs) === JSON.stringify(draft.network.ipCidrs)
|
|
327
|
-
? {}
|
|
328
|
-
: { ipCidrs: draft.network.ipCidrs ?? null }),
|
|
329
|
-
...(JSON.stringify(original.network?.countries) ===
|
|
330
|
-
JSON.stringify(draft.network.countries)
|
|
331
|
-
? {}
|
|
332
|
-
: { countries: draft.network.countries ?? null }),
|
|
333
|
-
...(JSON.stringify(original.network?.excludedCountries) ===
|
|
334
|
-
JSON.stringify(draft.network.excludedCountries)
|
|
335
|
-
? {}
|
|
336
|
-
: { excludedCountries: draft.network.excludedCountries ?? null }),
|
|
337
|
-
...(JSON.stringify(original.network?.excludedUserAgentSubstrings) ===
|
|
338
|
-
JSON.stringify(draft.network.excludedUserAgentSubstrings)
|
|
339
|
-
? {}
|
|
340
|
-
: {
|
|
341
|
-
excludedUserAgentSubstrings: draft.network.excludedUserAgentSubstrings ?? null,
|
|
342
|
-
}),
|
|
343
|
-
};
|
|
344
|
-
const patch = {
|
|
345
|
-
...(original.notBefore === draft.notBefore ? {} : { notBefore: draft.notBefore ?? null }),
|
|
346
|
-
...(original.expiresAt === draft.expiresAt ? {} : { expiresAt: draft.expiresAt ?? null }),
|
|
347
|
-
...(original.maxUses === draft.maxUses ? {} : { maxUses: draft.maxUses ?? null }),
|
|
348
|
-
...(original.requireVerifiedEmail === draft.requireVerifiedEmail
|
|
349
|
-
? {}
|
|
350
|
-
: { requireVerifiedEmail: draft.requireVerifiedEmail ?? null }),
|
|
351
|
-
...(network === undefined ? {} : { network }),
|
|
352
|
-
};
|
|
353
|
-
return Object.keys(patch).length === 0 ? undefined : patch;
|
|
354
|
-
}
|
|
355
|
-
export function applyGrantConstraintsPatch(current, patch) {
|
|
356
|
-
const network = patch.network === undefined
|
|
357
|
-
? current.network
|
|
358
|
-
: patch.network === null
|
|
359
|
-
? undefined
|
|
360
|
-
: {
|
|
361
|
-
...current.network,
|
|
362
|
-
...(patch.network.ipCidrs === undefined
|
|
363
|
-
? {}
|
|
364
|
-
: { ipCidrs: patch.network.ipCidrs ?? undefined }),
|
|
365
|
-
...(patch.network.countries === undefined
|
|
366
|
-
? {}
|
|
367
|
-
: { countries: patch.network.countries ?? undefined }),
|
|
368
|
-
...(patch.network.excludedCountries === undefined
|
|
369
|
-
? {}
|
|
370
|
-
: { excludedCountries: patch.network.excludedCountries ?? undefined }),
|
|
371
|
-
...(patch.network.excludedUserAgentSubstrings === undefined
|
|
372
|
-
? {}
|
|
373
|
-
: {
|
|
374
|
-
excludedUserAgentSubstrings: patch.network.excludedUserAgentSubstrings ?? undefined,
|
|
375
|
-
}),
|
|
376
|
-
};
|
|
377
|
-
const compactNetwork = network && Object.values(network).some((value) => value !== undefined) ? network : undefined;
|
|
378
|
-
return grantConstraintsSchema.parse({
|
|
379
|
-
...current,
|
|
380
|
-
...(patch.notBefore === undefined ? {} : { notBefore: patch.notBefore ?? undefined }),
|
|
381
|
-
...(patch.expiresAt === undefined ? {} : { expiresAt: patch.expiresAt ?? undefined }),
|
|
382
|
-
...(patch.maxUses === undefined ? {} : { maxUses: patch.maxUses ?? undefined }),
|
|
383
|
-
...(patch.requireVerifiedEmail === undefined
|
|
384
|
-
? {}
|
|
385
|
-
: { requireVerifiedEmail: patch.requireVerifiedEmail ?? undefined }),
|
|
386
|
-
network: compactNetwork,
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
34
|
export const GRANT_SOURCE_KINDS = ["config", "managed", "system"];
|
|
390
35
|
export const grantSourceKindSchema = z.enum(GRANT_SOURCE_KINDS);
|
|
391
36
|
export const PRECLAIM_OPEN_GRANT_SOURCE_REFERENCE = "open:preclaim-author";
|
|
@@ -416,6 +61,21 @@ const grantDimensionsSchema = z
|
|
|
416
61
|
})
|
|
417
62
|
.strict();
|
|
418
63
|
function validateGrantAudienceCapabilityBoundary(value, context) {
|
|
64
|
+
if (value.constraints.frameOrigin !== undefined && value.audience.kind !== "link") {
|
|
65
|
+
context.addIssue({
|
|
66
|
+
code: "custom",
|
|
67
|
+
path: ["constraints", "frameOrigin"],
|
|
68
|
+
message: "frameOrigin is available only for Link audiences",
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (value.constraints.frameOrigin !== undefined &&
|
|
72
|
+
(value.constraints.requireVerifiedEmail === true || value.constraints.network !== undefined)) {
|
|
73
|
+
context.addIssue({
|
|
74
|
+
code: "custom",
|
|
75
|
+
path: ["constraints", "frameOrigin"],
|
|
76
|
+
message: "Frame Links cannot use email or network checks",
|
|
77
|
+
});
|
|
78
|
+
}
|
|
419
79
|
if (value.audience.kind === "public" &&
|
|
420
80
|
value.capabilities.some((capability) => capability === "content.publish" || capability === "access.manage")) {
|
|
421
81
|
context.addIssue({
|
|
@@ -807,14 +467,6 @@ export const credentialRevocationSchema = z
|
|
|
807
467
|
.strict();
|
|
808
468
|
export const IDENTITY_CONNECTION_DEFAULT_TTL_SECONDS = 8 * 60 * 60;
|
|
809
469
|
export const EXTERNAL_IDENTITY_MAX_TTL_SECONDS = 30 * 60;
|
|
810
|
-
export const identityConnectionPublicKeySchema = z
|
|
811
|
-
.object({
|
|
812
|
-
kid: z.string().min(1).max(64),
|
|
813
|
-
publicKey: z
|
|
814
|
-
.string()
|
|
815
|
-
.regex(/^[A-Za-z0-9_-]{43}$/, "publicKey must be a raw Ed25519 public key"),
|
|
816
|
-
})
|
|
817
|
-
.strict();
|
|
818
470
|
/**
|
|
819
471
|
* Issuers the platform stamps on its own external Grants. A Team-configured
|
|
820
472
|
* connection may not claim one: the authority reference an external audience
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** An id in one prefixed family, e.g. `spc_…`. */
|
|
3
|
+
export type PrefixedId<P extends string = string> = `${P}_${string}`;
|
|
4
|
+
/**
|
|
5
|
+
* Validate an id in one prefixed family. `label` names the resource in the
|
|
6
|
+
* failure message ("Invalid Space id"), so a caller that has a registry can
|
|
7
|
+
* spend it and a caller that does not can pass the prefix itself.
|
|
8
|
+
*/
|
|
9
|
+
export declare function prefixedIdSchema<P extends string>(prefix: P, label: string): z.ZodTemplateLiteral<`${`${P}_` extends infer T extends string | number | bigint | boolean | null | undefined ? T extends undefined ? "" : T : never}${string}`>;
|
|
10
|
+
/** Mint a globally unique id in one prefixed family. */
|
|
11
|
+
export declare function createPrefixedId<P extends string>(prefix: P): PrefixedId<P>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const ID_BODY_PATTERN = /^[A-Za-z0-9]+$/;
|
|
3
|
+
/**
|
|
4
|
+
* Validate an id in one prefixed family. `label` names the resource in the
|
|
5
|
+
* failure message ("Invalid Space id"), so a caller that has a registry can
|
|
6
|
+
* spend it and a caller that does not can pass the prefix itself.
|
|
7
|
+
*/
|
|
8
|
+
export function prefixedIdSchema(prefix, label) {
|
|
9
|
+
return z.templateLiteral([z.literal(`${prefix}_`), z.string().regex(ID_BODY_PATTERN)], `Invalid ${label} id`);
|
|
10
|
+
}
|
|
11
|
+
/** Mint a globally unique id in one prefixed family. */
|
|
12
|
+
export function createPrefixedId(prefix) {
|
|
13
|
+
return `${prefix}_${crypto.randomUUID().replaceAll("-", "")}`;
|
|
14
|
+
}
|
package/dist/contracts/ids.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type PrefixedId } from "./ids-core.js";
|
|
2
2
|
export declare const ID_PREFIXES: {
|
|
3
3
|
readonly ten: "Tenant";
|
|
4
4
|
readonly site: "Site";
|
|
5
5
|
readonly spc: "Space";
|
|
6
|
+
readonly swk: "SourceWorkspace";
|
|
6
7
|
readonly ver: "Version";
|
|
7
8
|
readonly cmt: "CommentThread";
|
|
8
9
|
readonly bld: "Build";
|
|
@@ -37,12 +38,14 @@ export declare const ID_PREFIXES: {
|
|
|
37
38
|
readonly pti: "PartnerTokenIssuer";
|
|
38
39
|
readonly usg: "UsageRecord";
|
|
39
40
|
readonly upr: "UsagePeriod";
|
|
41
|
+
readonly cxn: "ConnectorConnection";
|
|
42
|
+
readonly cxr: "ConnectorRun";
|
|
40
43
|
};
|
|
41
44
|
export type IdPrefix = keyof typeof ID_PREFIXES;
|
|
42
45
|
/** Any registered public resource id, e.g. `spc_…` or `ver_…`. */
|
|
43
|
-
export type Id =
|
|
46
|
+
export type Id = PrefixedId<IdPrefix>;
|
|
44
47
|
/** Validate an id belonging to one registered public resource family. */
|
|
45
|
-
export declare function registeredIdSchema<P extends IdPrefix>(prefix: P):
|
|
48
|
+
export declare function registeredIdSchema<P extends IdPrefix>(prefix: P): import("zod").ZodTemplateLiteral<`${`${P}_` extends infer T extends string | number | bigint | boolean | null | undefined ? T extends undefined ? "" : T : never}${string}`>;
|
|
46
49
|
export declare const MAIN_TENANT_ID = "ten_main";
|
|
47
50
|
/** Mint a globally unique id for a registered public resource prefix. */
|
|
48
|
-
export declare function createId<P extends IdPrefix>(prefix: P):
|
|
51
|
+
export declare function createId<P extends IdPrefix>(prefix: P): PrefixedId<P>;
|
package/dist/contracts/ids.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//
|
|
1
|
+
import { createPrefixedId, prefixedIdSchema } from "./ids-core.js";
|
|
2
|
+
// The SPACEFAST id prefix registry (the platform spec "Id prefix registry").
|
|
3
|
+
// The prefixed-id grammar itself is host-agnostic and lives in `./ids-core.js`;
|
|
4
|
+
// this file is the concrete list of families Spacefast mints, so it is a
|
|
5
|
+
// Spacefast-private contract that Zero-side packages must not import.
|
|
3
6
|
// Every PUBLIC resource registers a prefix here before it ships; ids are globally
|
|
4
7
|
// unique and handle ids (operations, exports, imports, transfers, builds) are
|
|
5
8
|
// fetchable at a top-level collection with no extra context. Control-plane-internal
|
|
@@ -10,6 +13,7 @@ export const ID_PREFIXES = {
|
|
|
10
13
|
ten: "Tenant",
|
|
11
14
|
site: "Site",
|
|
12
15
|
spc: "Space",
|
|
16
|
+
swk: "SourceWorkspace",
|
|
13
17
|
ver: "Version",
|
|
14
18
|
cmt: "CommentThread",
|
|
15
19
|
bld: "Build",
|
|
@@ -45,10 +49,14 @@ export const ID_PREFIXES = {
|
|
|
45
49
|
pti: "PartnerTokenIssuer",
|
|
46
50
|
usg: "UsageRecord",
|
|
47
51
|
upr: "UsagePeriod",
|
|
52
|
+
// Connectors. A connector is addressed by its team-unique slug and a policy
|
|
53
|
+
// rule by the engine's own opaque id, so neither mints a prefix here.
|
|
54
|
+
cxn: "ConnectorConnection",
|
|
55
|
+
cxr: "ConnectorRun",
|
|
48
56
|
};
|
|
49
57
|
/** Validate an id belonging to one registered public resource family. */
|
|
50
58
|
export function registeredIdSchema(prefix) {
|
|
51
|
-
return
|
|
59
|
+
return prefixedIdSchema(prefix, ID_PREFIXES[prefix]);
|
|
52
60
|
}
|
|
53
61
|
// The main Stattic tenant every self-serve team/user/resource lives under. A
|
|
54
62
|
// well-known CONSTANT, never configuration: grammatically a normal tenant id with
|
|
@@ -56,5 +64,5 @@ export function registeredIdSchema(prefix) {
|
|
|
56
64
|
export const MAIN_TENANT_ID = "ten_main";
|
|
57
65
|
/** Mint a globally unique id for a registered public resource prefix. */
|
|
58
66
|
export function createId(prefix) {
|
|
59
|
-
return
|
|
67
|
+
return createPrefixedId(prefix);
|
|
60
68
|
}
|
|
@@ -40,6 +40,15 @@ export declare const uploadTargetSchema: z.ZodObject<{
|
|
|
40
40
|
sha256: z.ZodOptional<z.ZodString>;
|
|
41
41
|
contentType: z.ZodOptional<z.ZodString>;
|
|
42
42
|
}, z.core.$strip>;
|
|
43
|
+
export declare const bulkCasUploadSchema: z.ZodObject<{
|
|
44
|
+
kind: z.ZodLiteral<"zip-cas-v1">;
|
|
45
|
+
method: z.ZodLiteral<"PUT">;
|
|
46
|
+
url: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
|
47
|
+
headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
48
|
+
maxCompressedBytes: z.ZodNumber;
|
|
49
|
+
maxExpandedBytes: z.ZodNumber;
|
|
50
|
+
maxBlobs: z.ZodNumber;
|
|
51
|
+
}, z.core.$strip>;
|
|
43
52
|
export declare const uploadInstructionsSchema: z.ZodObject<{
|
|
44
53
|
id: z.ZodString;
|
|
45
54
|
mode: z.ZodEnum<{
|
|
@@ -69,6 +78,15 @@ export declare const uploadInstructionsSchema: z.ZodObject<{
|
|
|
69
78
|
sha256: z.ZodOptional<z.ZodString>;
|
|
70
79
|
contentType: z.ZodOptional<z.ZodString>;
|
|
71
80
|
}, z.core.$strip>>>;
|
|
81
|
+
bulk: z.ZodOptional<z.ZodObject<{
|
|
82
|
+
kind: z.ZodLiteral<"zip-cas-v1">;
|
|
83
|
+
method: z.ZodLiteral<"PUT">;
|
|
84
|
+
url: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
|
85
|
+
headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
86
|
+
maxCompressedBytes: z.ZodNumber;
|
|
87
|
+
maxExpandedBytes: z.ZodNumber;
|
|
88
|
+
maxBlobs: z.ZodNumber;
|
|
89
|
+
}, z.core.$strip>>;
|
|
72
90
|
links: z.ZodObject<{
|
|
73
91
|
refresh: z.ZodString;
|
|
74
92
|
resume: z.ZodOptional<z.ZodString>;
|
|
@@ -60,6 +60,22 @@ export const uploadTargetSchema = z.object({
|
|
|
60
60
|
.optional(),
|
|
61
61
|
contentType: z.string().optional(),
|
|
62
62
|
});
|
|
63
|
+
export const bulkCasUploadSchema = z.object({
|
|
64
|
+
kind: z.literal("zip-cas-v1"),
|
|
65
|
+
method: z.literal("PUT"),
|
|
66
|
+
url: z
|
|
67
|
+
.string()
|
|
68
|
+
.url()
|
|
69
|
+
.or(z.string().startsWith("/"))
|
|
70
|
+
.describe("Upload-auth runtime URL that accepts a ZIP of SHA-named CAS blobs."),
|
|
71
|
+
headers: z
|
|
72
|
+
.record(z.string().min(1), z.string())
|
|
73
|
+
.default({})
|
|
74
|
+
.describe("Exact headers to send with the bulk upload request."),
|
|
75
|
+
maxCompressedBytes: z.number().int().positive(),
|
|
76
|
+
maxExpandedBytes: z.number().int().positive(),
|
|
77
|
+
maxBlobs: z.number().int().positive(),
|
|
78
|
+
});
|
|
63
79
|
export const uploadInstructionsSchema = z.object({
|
|
64
80
|
id: z.string().min(1).describe("Upload session id (upl_…) minted by the runtime."),
|
|
65
81
|
mode: uploadSessionModeSchema,
|
|
@@ -78,6 +94,9 @@ export const uploadInstructionsSchema = z.object({
|
|
|
78
94
|
.array(uploadTargetSchema)
|
|
79
95
|
.default([])
|
|
80
96
|
.describe("Opaque upload targets, bounded by the instruction payload budget. Upload these, then call `links.refresh` for the remainder."),
|
|
97
|
+
bulk: bulkCasUploadSchema
|
|
98
|
+
.optional()
|
|
99
|
+
.describe("Optional direct runtime transport for this page's content-addressed targets. Clients that do not support it continue with targets."),
|
|
81
100
|
links: z.object({
|
|
82
101
|
// The key names the action — mint a fresh instruction page for whatever the
|
|
83
102
|
// session still needs — not the route that happens to serve it.
|
package/dist/contracts/mcp.d.ts
CHANGED
|
@@ -1,21 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const HOSTED_MCP_SERVER_VERSION: "2026-08-22";
|
|
3
|
-
export declare const HOSTED_MCP_TOOL_CATALOG: readonly [{
|
|
4
|
-
readonly name: "execute";
|
|
5
|
-
readonly description: "Run JavaScript against the OpenAPI-generated Spacefast catalog in a secure sandbox.";
|
|
6
|
-
}, {
|
|
7
|
-
readonly name: "skills";
|
|
8
|
-
readonly description: "Fetch Spacefast how-to guidance for an MCP workflow.";
|
|
9
|
-
}, {
|
|
10
|
-
readonly name: "resume";
|
|
11
|
-
readonly description: "Resume an execution that paused for approval or input.";
|
|
12
|
-
}, {
|
|
13
|
-
readonly name: "publish";
|
|
14
|
-
readonly description: "Publish inline files as a new immutable Spacefast version.";
|
|
15
|
-
}, {
|
|
16
|
-
readonly name: "search_docs";
|
|
17
|
-
readonly description: "Search the published Spacefast documentation. An exact slug or path returns that page in full.";
|
|
18
|
-
}];
|
|
19
2
|
export declare const hostedMcpSessionStatusSchema: z.ZodEnum<{
|
|
20
3
|
active: "active";
|
|
21
4
|
expired: "expired";
|
|
@@ -24,6 +7,7 @@ export declare const hostedMcpSessionStatusSchema: z.ZodEnum<{
|
|
|
24
7
|
}>;
|
|
25
8
|
export declare const hostedMcpSessionSchema: z.ZodObject<{
|
|
26
9
|
sessionId: z.ZodString;
|
|
10
|
+
closable: z.ZodBoolean;
|
|
27
11
|
clientId: z.ZodNullable<z.ZodString>;
|
|
28
12
|
credentialId: z.ZodNullable<z.ZodString>;
|
|
29
13
|
credentialKind: z.ZodNullable<z.ZodString>;
|
|
@@ -86,6 +70,7 @@ export declare const hostedMcpDashboardSchema: z.ZodObject<{
|
|
|
86
70
|
}, z.core.$strip>;
|
|
87
71
|
sessions: z.ZodArray<z.ZodObject<{
|
|
88
72
|
sessionId: z.ZodString;
|
|
73
|
+
closable: z.ZodBoolean;
|
|
89
74
|
clientId: z.ZodNullable<z.ZodString>;
|
|
90
75
|
credentialId: z.ZodNullable<z.ZodString>;
|
|
91
76
|
credentialKind: z.ZodNullable<z.ZodString>;
|
|
@@ -137,6 +122,7 @@ export declare const hostedMcpDashboardResponseSchema: z.ZodObject<{
|
|
|
137
122
|
}, z.core.$strip>;
|
|
138
123
|
sessions: z.ZodArray<z.ZodObject<{
|
|
139
124
|
sessionId: z.ZodString;
|
|
125
|
+
closable: z.ZodBoolean;
|
|
140
126
|
clientId: z.ZodNullable<z.ZodString>;
|
|
141
127
|
credentialId: z.ZodNullable<z.ZodString>;
|
|
142
128
|
credentialKind: z.ZodNullable<z.ZodString>;
|
|
@@ -185,6 +171,7 @@ export declare const hostedMcpProxyTokenResponseSchema: z.ZodObject<{
|
|
|
185
171
|
export declare const hostedMcpCloseSessionResponseSchema: z.ZodObject<{
|
|
186
172
|
data: z.ZodObject<{
|
|
187
173
|
sessionId: z.ZodString;
|
|
174
|
+
closable: z.ZodBoolean;
|
|
188
175
|
clientId: z.ZodNullable<z.ZodString>;
|
|
189
176
|
credentialId: z.ZodNullable<z.ZodString>;
|
|
190
177
|
credentialKind: z.ZodNullable<z.ZodString>;
|
|
@@ -211,6 +198,7 @@ export declare const hostedMcpSessionEventsResponseSchema: z.ZodObject<{
|
|
|
211
198
|
data: z.ZodObject<{
|
|
212
199
|
session: z.ZodObject<{
|
|
213
200
|
sessionId: z.ZodString;
|
|
201
|
+
closable: z.ZodBoolean;
|
|
214
202
|
clientId: z.ZodNullable<z.ZodString>;
|
|
215
203
|
credentialId: z.ZodNullable<z.ZodString>;
|
|
216
204
|
credentialKind: z.ZodNullable<z.ZodString>;
|
|
@@ -247,19 +235,21 @@ export declare const hostedMcpSessionEventsResponseSchema: z.ZodObject<{
|
|
|
247
235
|
}, z.core.$strip>;
|
|
248
236
|
}, z.core.$strip>;
|
|
249
237
|
export declare const hostedMcpPausedExecutionSchema: z.ZodObject<{
|
|
238
|
+
allowAlways: z.ZodBoolean;
|
|
250
239
|
text: z.ZodString;
|
|
251
240
|
structured: z.ZodUnknown;
|
|
252
241
|
}, z.core.$strip>;
|
|
253
242
|
export declare const hostedMcpPausedExecutionResponseSchema: z.ZodObject<{
|
|
254
243
|
data: z.ZodObject<{
|
|
244
|
+
allowAlways: z.ZodBoolean;
|
|
255
245
|
text: z.ZodString;
|
|
256
246
|
structured: z.ZodUnknown;
|
|
257
247
|
}, z.core.$strip>;
|
|
258
248
|
}, z.core.$strip>;
|
|
259
249
|
export declare const hostedMcpApprovalActionSchema: z.ZodEnum<{
|
|
260
250
|
accept: "accept";
|
|
261
|
-
cancel: "cancel";
|
|
262
251
|
decline: "decline";
|
|
252
|
+
cancel: "cancel";
|
|
263
253
|
}>;
|
|
264
254
|
export declare const hostedMcpApprovalResponseSchema: z.ZodObject<{
|
|
265
255
|
data: z.ZodObject<{
|