@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
|
@@ -1,199 +1,315 @@
|
|
|
1
|
+
// src/contracts/runtime-components.ts
|
|
1
2
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
3
|
+
import {
|
|
4
|
+
compiledContentModelV1Schema,
|
|
5
|
+
contentExecutableSetV1Schema,
|
|
6
|
+
contentModelReleaseV1Schema,
|
|
7
|
+
contentModelSha256Schema,
|
|
8
|
+
contentRouteContributionSetV1Schema,
|
|
9
|
+
contentSdkDescriptorSetV1Schema
|
|
10
|
+
} from "./content-model.js";
|
|
11
|
+
import { prefixedIdSchema } from "./ids-core.js";
|
|
12
|
+
|
|
13
|
+
// src/contracts/wordpress-php-toolkit.json
|
|
14
|
+
var wordpress_php_toolkit_default = {
|
|
15
|
+
version: "0.9.0",
|
|
16
|
+
archiveUrl: "https://github.com/WordPress/php-toolkit/releases/download/v0.9.0/data-liberation.zip",
|
|
17
|
+
archiveBytes: 883739,
|
|
18
|
+
archiveSha256: "sha256:ba6e691936699ae7f5ceaa0129ef7e7a10f1db77c559a32f824e8307747b7b54",
|
|
19
|
+
archivePath: "data-liberation/php-toolkit.phar",
|
|
20
|
+
embeddedPath: "engine/vendor/php-toolkit.phar",
|
|
21
|
+
sha256: "sha256:bd452b61fd6ee9f4838ff416a3d225e6c82a742ffaf325a57ad327828eda446a"
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// src/contracts/runtime-components.ts
|
|
25
|
+
var runtimeCapabilityIdSchema = z.string().min(1).max(160).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/).brand();
|
|
26
|
+
var runtimeComponentIdSchema = z.string().min(1).max(160).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/).brand();
|
|
27
|
+
var RUNTIME_ACCESS_BROWSER_STATE_CAPABILITY = runtimeCapabilityIdSchema.parse(
|
|
28
|
+
"runtime.access.browser-state.v1"
|
|
29
|
+
);
|
|
30
|
+
var SPACEFAST_WORDPRESS_COMPONENT_RELEASE = {
|
|
31
|
+
wordpress: {
|
|
32
|
+
version: "7.1",
|
|
33
|
+
archiveUrl: "https://wordpress.org/wordpress-7.1.zip",
|
|
34
|
+
archiveBytes: 37216004,
|
|
35
|
+
archiveSha256: "sha256:d1ae02b5ae18428031ffc3943659fa87ab361d827f4aa804adf9276e4dc75df6"
|
|
36
|
+
},
|
|
37
|
+
secureCustomFields: {
|
|
38
|
+
version: "6.9.5",
|
|
39
|
+
software: "plugin://https://downloads.wordpress.org/plugin/secure-custom-fields.6.9.5.zip",
|
|
40
|
+
archiveUrl: "https://downloads.wordpress.org/plugin/secure-custom-fields.6.9.5.zip",
|
|
41
|
+
archiveBytes: 5532990,
|
|
42
|
+
archiveSha256: "sha256:2f3c6be871e23192bbcaf0f0870a8103678b078d168983cb39d95e0b0d25dbf3"
|
|
43
|
+
},
|
|
44
|
+
redirection: {
|
|
45
|
+
version: "5.10.0",
|
|
46
|
+
software: "plugin://https://downloads.wordpress.org/plugin/redirection.5.10.0.zip",
|
|
47
|
+
archiveUrl: "https://downloads.wordpress.org/plugin/redirection.5.10.0.zip",
|
|
48
|
+
archiveBytes: 494067,
|
|
49
|
+
archiveSha256: "sha256:966ac6267cd6a99f2d79ec05db1dee2e0aa0cddb6060b1c32cde2ffde739e333"
|
|
50
|
+
},
|
|
51
|
+
blockTransformer: {
|
|
52
|
+
version: "0.6.2",
|
|
53
|
+
software: "plugin://https://codeload.github.com/Automattic/blocks-engine-php-transformer/zip/refs/tags/v0.6.2",
|
|
54
|
+
archiveUrl: "https://codeload.github.com/Automattic/blocks-engine-php-transformer/zip/refs/tags/v0.6.2",
|
|
55
|
+
archiveBytes: 786827,
|
|
56
|
+
archiveSha256: "sha256:16492638259e8f0c1676332e52df27dd005552cca4a3f50055274363030a5a49"
|
|
57
|
+
},
|
|
58
|
+
phpToolkit: wordpress_php_toolkit_default,
|
|
59
|
+
// Jetpack is the one component the platform locks but does not always
|
|
60
|
+
// install: it is a per-team feature, and wp.cloud ships its own managed build
|
|
61
|
+
// rather than an archive we pin. The lock therefore names the software lane,
|
|
62
|
+
// not a version — licenses attach to whatever Jetpack the platform ships.
|
|
63
|
+
jetpack: {
|
|
64
|
+
version: "latest",
|
|
65
|
+
software: "plugins/jetpack/latest"
|
|
66
|
+
},
|
|
67
|
+
quickjsAbi: "rquickjs-0.12",
|
|
68
|
+
managedTheme: "spacefast-managed"
|
|
69
|
+
};
|
|
70
|
+
var RUNTIME_COMPONENT_V1_REQUIRED_IDS = [
|
|
71
|
+
"wordpress-core",
|
|
72
|
+
"runtime-engine",
|
|
73
|
+
"immutable-loader",
|
|
74
|
+
"content-kernel",
|
|
75
|
+
"managed-theme",
|
|
76
|
+
"secure-custom-fields",
|
|
77
|
+
"redirection",
|
|
78
|
+
"block-transformer",
|
|
79
|
+
"php-toolkit",
|
|
80
|
+
"jetpack",
|
|
81
|
+
"quickjs-abi"
|
|
26
82
|
];
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
83
|
+
var JETPACK_RUNTIME_COMPONENT_ID = runtimeComponentIdSchema.parse("jetpack");
|
|
84
|
+
var RUNTIME_COMPONENT_KINDS = [
|
|
85
|
+
"wordpress-core",
|
|
86
|
+
"runtime-engine",
|
|
87
|
+
"mu-plugin",
|
|
88
|
+
"plugin",
|
|
89
|
+
"theme",
|
|
90
|
+
"block-transformer",
|
|
91
|
+
"quickjs-abi",
|
|
92
|
+
"runtime-library"
|
|
35
93
|
];
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
94
|
+
var runtimeComponentKindSchema = z.enum(RUNTIME_COMPONENT_KINDS);
|
|
95
|
+
var runtimeComponentV1RequiredKinds = {
|
|
96
|
+
"wordpress-core": "wordpress-core",
|
|
97
|
+
"runtime-engine": "runtime-engine",
|
|
98
|
+
"immutable-loader": "mu-plugin",
|
|
99
|
+
"content-kernel": "mu-plugin",
|
|
100
|
+
"managed-theme": "theme",
|
|
101
|
+
"secure-custom-fields": "plugin",
|
|
102
|
+
redirection: "plugin",
|
|
103
|
+
"block-transformer": "block-transformer",
|
|
104
|
+
"php-toolkit": "runtime-library",
|
|
105
|
+
jetpack: "plugin",
|
|
106
|
+
"quickjs-abi": "quickjs-abi"
|
|
47
107
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
108
|
+
var runtimeComponentSourceSchema = z.discriminatedUnion("kind", [
|
|
109
|
+
z.object({
|
|
110
|
+
kind: z.literal("archive"),
|
|
111
|
+
url: z.string().url(),
|
|
112
|
+
bytes: z.number().int().positive()
|
|
113
|
+
}).strict(),
|
|
114
|
+
z.object({
|
|
115
|
+
kind: z.literal("embedded"),
|
|
116
|
+
path: z.string().min(1).max(512).refine((path) => !path.startsWith("/") && !path.split("/").includes(".."), {
|
|
117
|
+
message: "embedded component paths must be relative and cannot traverse"
|
|
54
118
|
})
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
.refine((path) => !path.startsWith("/") && !path.split("/").includes(".."), {
|
|
64
|
-
message: "embedded component paths must be relative and cannot traverse",
|
|
65
|
-
}),
|
|
66
|
-
})
|
|
67
|
-
.strict(),
|
|
119
|
+
}).strict(),
|
|
120
|
+
// The provider owns the bytes: wp.cloud installs and updates this component
|
|
121
|
+
// from its own managed build, so the lock pins the software lane it may come
|
|
122
|
+
// from and readiness is proven by observation instead of a byte digest.
|
|
123
|
+
z.object({
|
|
124
|
+
kind: z.literal("provider-managed"),
|
|
125
|
+
software: z.string().min(1).max(255)
|
|
126
|
+
}).strict()
|
|
68
127
|
]);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
128
|
+
var runtimeComponentV1Schema = z.object({
|
|
129
|
+
id: runtimeComponentIdSchema,
|
|
130
|
+
kind: runtimeComponentKindSchema,
|
|
131
|
+
version: z.string().min(1).max(160),
|
|
132
|
+
sha256: contentModelSha256Schema,
|
|
133
|
+
source: runtimeComponentSourceSchema,
|
|
134
|
+
installedArtifact: z.object({
|
|
135
|
+
path: z.string().min(1).max(512).refine((path) => !path.startsWith("/") && !path.split("/").includes(".."), {
|
|
136
|
+
message: "installed component paths must be relative and cannot traverse"
|
|
137
|
+
}),
|
|
138
|
+
sha256: contentModelSha256Schema
|
|
139
|
+
}).strict().optional(),
|
|
140
|
+
provides: z.array(runtimeCapabilityIdSchema).max(100),
|
|
141
|
+
activation: z.enum(["always", "installed", "on-demand"])
|
|
142
|
+
}).strict().refine((component) => new Set(component.provides).size === component.provides.length, {
|
|
143
|
+
path: ["provides"],
|
|
144
|
+
message: "provided capabilities must be unique"
|
|
145
|
+
}).refine(
|
|
146
|
+
(component) => component.activation === "installed" === (component.installedArtifact !== void 0),
|
|
147
|
+
{
|
|
148
|
+
path: ["installedArtifact"],
|
|
149
|
+
message: "installed activation requires exactly one installed artifact receipt"
|
|
150
|
+
}
|
|
151
|
+
).refine(
|
|
152
|
+
(component) => component.activation !== "installed" || component.source.kind === "archive",
|
|
153
|
+
{
|
|
154
|
+
path: ["source"],
|
|
155
|
+
message: "installed components must come from a pinned archive"
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
var runtimeComponentInventoryV1Schema = z.object({
|
|
159
|
+
format: z.literal("spacefast.wordpress-components"),
|
|
160
|
+
version: z.literal(1),
|
|
161
|
+
platformRelease: z.string().min(1).max(160),
|
|
162
|
+
digest: contentModelSha256Schema,
|
|
163
|
+
components: z.array(runtimeComponentV1Schema).min(1).max(100)
|
|
164
|
+
}).strict().superRefine((inventory, context) => {
|
|
165
|
+
const ids = inventory.components.map((component) => component.id);
|
|
166
|
+
if (new Set(ids).size !== ids.length) {
|
|
167
|
+
context.addIssue({
|
|
168
|
+
code: "custom",
|
|
169
|
+
path: ["components"],
|
|
170
|
+
message: "component ids must be unique"
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
for (const required of RUNTIME_COMPONENT_V1_REQUIRED_IDS) {
|
|
174
|
+
const matching = inventory.components.filter((component) => component.id === required);
|
|
175
|
+
if (matching.length !== 1) {
|
|
176
|
+
context.addIssue({
|
|
177
|
+
code: "custom",
|
|
178
|
+
path: ["components"],
|
|
179
|
+
message: `component inventory requires exactly one ${required} component`
|
|
180
|
+
});
|
|
181
|
+
} else if (matching[0]?.kind !== runtimeComponentV1RequiredKinds[required]) {
|
|
182
|
+
context.addIssue({
|
|
183
|
+
code: "custom",
|
|
184
|
+
path: ["components"],
|
|
185
|
+
message: `${required} must use component kind ${runtimeComponentV1RequiredKinds[required]}`
|
|
186
|
+
});
|
|
118
187
|
}
|
|
188
|
+
}
|
|
119
189
|
});
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
.refine((requirements) => new Set(requirements.capabilities).size === requirements.capabilities.length, {
|
|
190
|
+
var contentModelRequirementsV1Schema = z.object({
|
|
191
|
+
format: z.literal("spacefast.content-model-requirements"),
|
|
192
|
+
version: z.literal(1),
|
|
193
|
+
inputDigest: contentModelSha256Schema,
|
|
194
|
+
wordpressAbi: z.literal(1),
|
|
195
|
+
capabilities: z.array(runtimeCapabilityIdSchema).max(100)
|
|
196
|
+
}).strict().refine(
|
|
197
|
+
(requirements) => new Set(requirements.capabilities).size === requirements.capabilities.length,
|
|
198
|
+
{
|
|
130
199
|
path: ["capabilities"],
|
|
131
|
-
message: "
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
200
|
+
message: "content model capabilities must be unique"
|
|
201
|
+
}
|
|
202
|
+
);
|
|
203
|
+
var compiledContentModelArtifactsV1Schema = z.object({
|
|
204
|
+
compiled: compiledContentModelV1Schema,
|
|
205
|
+
model: contentModelReleaseV1Schema,
|
|
206
|
+
executables: contentExecutableSetV1Schema,
|
|
207
|
+
sdk: contentSdkDescriptorSetV1Schema,
|
|
208
|
+
routes: contentRouteContributionSetV1Schema,
|
|
209
|
+
requirements: contentModelRequirementsV1Schema
|
|
210
|
+
}).strict();
|
|
211
|
+
var runtimeComponentPlacementTargetV1Schema = z.object({
|
|
212
|
+
spaceId: prefixedIdSchema("spc", "Space"),
|
|
213
|
+
runtimeInstanceId: z.string().min(1).max(255),
|
|
214
|
+
siteId: z.string().min(1).max(255)
|
|
215
|
+
}).strict();
|
|
216
|
+
var runtimeComponentPoolPlacementTargetV1Schema = z.object({
|
|
217
|
+
sitePoolId: prefixedIdSchema("site", "Site"),
|
|
218
|
+
runtimeInstanceId: z.string().min(1).max(255),
|
|
219
|
+
siteId: z.string().min(1).max(255)
|
|
220
|
+
}).strict();
|
|
221
|
+
var runtimeComponentReceiptTargetV1Schema = z.union([
|
|
222
|
+
runtimeComponentPlacementTargetV1Schema,
|
|
223
|
+
runtimeComponentPoolPlacementTargetV1Schema
|
|
224
|
+
]);
|
|
225
|
+
var runtimeComponentPlacementReceiptFields = {
|
|
226
|
+
format: z.literal("spacefast.component-placement"),
|
|
227
|
+
version: z.literal(1),
|
|
228
|
+
operationId: z.string().min(1).max(160),
|
|
229
|
+
target: runtimeComponentReceiptTargetV1Schema,
|
|
230
|
+
platformRelease: z.string().min(1).max(160),
|
|
231
|
+
expectedInventoryDigest: contentModelSha256Schema
|
|
147
232
|
};
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
})
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
z
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
])
|
|
195
|
-
|
|
196
|
-
|
|
233
|
+
var readyPlacementSubstrateV1Schema = z.object({
|
|
234
|
+
wordpress: z.object({
|
|
235
|
+
boot: z.literal("ready"),
|
|
236
|
+
database: z.literal("ready"),
|
|
237
|
+
tables: z.literal("ready")
|
|
238
|
+
}).strict(),
|
|
239
|
+
routing: z.object({
|
|
240
|
+
state: z.literal("ready"),
|
|
241
|
+
snapshotRevision: contentModelSha256Schema,
|
|
242
|
+
inventoryDigest: contentModelSha256Schema
|
|
243
|
+
}).strict(),
|
|
244
|
+
mail: z.object({ state: z.literal("ready") }).strict(),
|
|
245
|
+
journal: z.object({ state: z.literal("ready") }).strict(),
|
|
246
|
+
// Which `on-demand` components the box actually runs. Always components are
|
|
247
|
+
// covered by the inventory digest; these are not installed everywhere, so
|
|
248
|
+
// the receipt reports what is there and the control plane decides whether
|
|
249
|
+
// that matches what it has converged.
|
|
250
|
+
onDemandActive: z.array(runtimeComponentIdSchema).max(20)
|
|
251
|
+
}).strict();
|
|
252
|
+
var runtimeComponentPlacementReceiptV1Schema = z.discriminatedUnion("status", [
|
|
253
|
+
z.object({
|
|
254
|
+
...runtimeComponentPlacementReceiptFields,
|
|
255
|
+
status: z.literal("ready"),
|
|
256
|
+
observedInventoryDigest: contentModelSha256Schema,
|
|
257
|
+
substrate: readyPlacementSubstrateV1Schema
|
|
258
|
+
}).strict(),
|
|
259
|
+
z.object({
|
|
260
|
+
...runtimeComponentPlacementReceiptFields,
|
|
261
|
+
status: z.literal("blocked"),
|
|
262
|
+
// A pre-receipt Space has no control-plane routing baseline yet. New
|
|
263
|
+
// engines return the routing they observed so that one guarded retry
|
|
264
|
+
// can bind the first receipt without pretending the route set is
|
|
265
|
+
// empty. Optional keeps the control plane compatible with engines
|
|
266
|
+
// published before this adoption field existed.
|
|
267
|
+
observedRouting: z.object({
|
|
268
|
+
snapshotRevision: contentModelSha256Schema,
|
|
269
|
+
inventoryDigest: contentModelSha256Schema
|
|
270
|
+
}).strict().optional(),
|
|
271
|
+
problems: z.array(
|
|
272
|
+
z.object({
|
|
273
|
+
componentId: runtimeComponentIdSchema.optional(),
|
|
274
|
+
code: z.string().min(1).max(160),
|
|
275
|
+
detail: z.string().min(1).max(2e3)
|
|
276
|
+
}).strict()
|
|
277
|
+
).min(1).max(100)
|
|
278
|
+
}).strict()
|
|
279
|
+
]).refine(
|
|
280
|
+
(receipt) => receipt.status !== "ready" || receipt.observedInventoryDigest === receipt.expectedInventoryDigest,
|
|
281
|
+
{
|
|
197
282
|
path: ["observedInventoryDigest"],
|
|
198
|
-
message: "a ready receipt must observe the expected inventory digest"
|
|
199
|
-
}
|
|
283
|
+
message: "a ready receipt must observe the expected inventory digest"
|
|
284
|
+
}
|
|
285
|
+
);
|
|
286
|
+
var runtimeComponentStageRequestV1Schema = z.object({
|
|
287
|
+
format: z.literal("spacefast.component-stage"),
|
|
288
|
+
version: z.literal(1),
|
|
289
|
+
operationId: z.string().min(1).max(160),
|
|
290
|
+
target: runtimeComponentPlacementReceiptFields.target,
|
|
291
|
+
expectedInventoryDigest: contentModelSha256Schema,
|
|
292
|
+
routing: z.object({
|
|
293
|
+
snapshotRevision: contentModelSha256Schema,
|
|
294
|
+
inventoryDigest: contentModelSha256Schema
|
|
295
|
+
}).strict()
|
|
296
|
+
}).strict();
|
|
297
|
+
export {
|
|
298
|
+
JETPACK_RUNTIME_COMPONENT_ID,
|
|
299
|
+
RUNTIME_ACCESS_BROWSER_STATE_CAPABILITY,
|
|
300
|
+
RUNTIME_COMPONENT_KINDS,
|
|
301
|
+
RUNTIME_COMPONENT_V1_REQUIRED_IDS,
|
|
302
|
+
SPACEFAST_WORDPRESS_COMPONENT_RELEASE,
|
|
303
|
+
compiledContentModelArtifactsV1Schema,
|
|
304
|
+
contentModelRequirementsV1Schema,
|
|
305
|
+
runtimeCapabilityIdSchema,
|
|
306
|
+
runtimeComponentIdSchema,
|
|
307
|
+
runtimeComponentInventoryV1Schema,
|
|
308
|
+
runtimeComponentKindSchema,
|
|
309
|
+
runtimeComponentPlacementReceiptV1Schema,
|
|
310
|
+
runtimeComponentPlacementTargetV1Schema,
|
|
311
|
+
runtimeComponentPoolPlacementTargetV1Schema,
|
|
312
|
+
runtimeComponentReceiptTargetV1Schema,
|
|
313
|
+
runtimeComponentStageRequestV1Schema,
|
|
314
|
+
runtimeComponentV1Schema
|
|
315
|
+
};
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
import { type ConnectorCallState, type ConnectorRun, type ConnectorJsonValue } from "./connectors.js";
|
|
2
|
+
export type ConnectorToolProxy = {
|
|
3
|
+
(args?: Record<string, ConnectorJsonValue>): Promise<ConnectorJsonValue | null>;
|
|
4
|
+
[tool: string]: ConnectorToolProxy;
|
|
5
|
+
};
|
|
6
|
+
export type Connectors = Record<string, ConnectorToolProxy> & {
|
|
7
|
+
call(role: string, tool: string, args: Record<string, ConnectorJsonValue>, handler?: {
|
|
8
|
+
name: string;
|
|
9
|
+
mode: "read" | "write";
|
|
10
|
+
callIndex?: number;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
state: ConnectorCallState;
|
|
13
|
+
run?: ConnectorRun;
|
|
14
|
+
}>;
|
|
15
|
+
};
|
|
1
16
|
/**
|
|
2
17
|
* Platform services that tenant code reaches through the runtime rather than
|
|
3
18
|
* through a credential of its own: Gravatar, spam checking, and mail.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CONNECTOR_CALL_STATE_COPY, } from "./connectors.js";
|
|
1
2
|
/**
|
|
2
3
|
* Platform services that tenant code reaches through the runtime rather than
|
|
3
4
|
* through a credential of its own: Gravatar, spam checking, and mail.
|
|
@@ -77,6 +78,28 @@ export const SPAM_CONTENT_TYPES = [
|
|
|
77
78
|
* one tier and a string on the other.
|
|
78
79
|
*/
|
|
79
80
|
export const RUNTIME_SERVICE_CLIENT_SOURCE = String.raw `
|
|
81
|
+
class ConnectorCallError extends Error {
|
|
82
|
+
constructor(state) { super(state.message); this.name = "ConnectorCallError"; this.state = state; }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const CONNECTOR_STATE_COPY = ${JSON.stringify(CONNECTOR_CALL_STATE_COPY)};
|
|
86
|
+
|
|
87
|
+
function makeConnectorProxy(call, handler) {
|
|
88
|
+
let callIndex = 0;
|
|
89
|
+
const tool = (role, path) => new Proxy(async (args = {}) => {
|
|
90
|
+
let answer;
|
|
91
|
+
try { answer = await call(role, path.join("."), args, { ...handler, callIndex: callIndex++ }); }
|
|
92
|
+
catch (error) {
|
|
93
|
+
const code = ["connector_write_in_read_handler", "connector_forbidden", "service_capability_denied"].includes(error?.code) ? "forbidden" : "unavailable";
|
|
94
|
+
throw new ConnectorCallError({ code, role, message: CONNECTOR_STATE_COPY[code] });
|
|
95
|
+
}
|
|
96
|
+
if (answer.state.code !== "ok") throw new ConnectorCallError({ ...answer.state, role });
|
|
97
|
+
return answer.run?.result ?? null;
|
|
98
|
+
}, { get: (_, name) => name === "then" ? undefined : typeof name === "string" ? tool(role, [...path, name]) : undefined });
|
|
99
|
+
return new Proxy({ call }, { get: (target, role) => role === "call" ? target.call : typeof role === "string" && role !== "then" ? tool(role, []) : undefined });
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
80
103
|
const SERVICE_DEFAULTS = ${JSON.stringify(GRAVATAR_DEFAULTS)};
|
|
81
104
|
const SERVICE_RATINGS = ${JSON.stringify(GRAVATAR_RATINGS)};
|
|
82
105
|
const SPAM_TYPES = ${JSON.stringify(SPAM_CONTENT_TYPES)};
|
|
@@ -409,6 +432,8 @@ function makeEmail(call) {
|
|
|
409
432
|
|
|
410
433
|
function makeRuntimeServices(call, requestContext) {
|
|
411
434
|
return {
|
|
435
|
+
connectors: makeConnectorProxy((role, tool, args, handler) =>
|
|
436
|
+
call("connectors", "call", { role, tool, args, handler })),
|
|
412
437
|
gravatar: makeGravatar(call),
|
|
413
438
|
spam: makeSpam(call, requestContext),
|
|
414
439
|
email: makeEmail(call),
|
|
@@ -18,10 +18,19 @@ export declare const runtimeStorageListQuerySchema: z.ZodObject<{
|
|
|
18
18
|
cursor: z.ZodOptional<z.ZodString>;
|
|
19
19
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
20
20
|
}, z.core.$strict>;
|
|
21
|
+
/**
|
|
22
|
+
* The uploader's own name for an object: presentation only, never a path.
|
|
23
|
+
*
|
|
24
|
+
* The id is the identity — this is what a person reads in a list and what a
|
|
25
|
+
* download is saved as. Separators are refused rather than stripped so the
|
|
26
|
+
* value the caller sent is the value that comes back.
|
|
27
|
+
*/
|
|
28
|
+
export declare const runtimeStorageFilenameSchema: z.ZodString;
|
|
21
29
|
export declare const runtimeStorageObjectSchema: z.ZodObject<{
|
|
22
30
|
id: z.ZodString;
|
|
23
31
|
contentType: z.ZodString;
|
|
24
32
|
createdAt: z.ZodString;
|
|
33
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
25
34
|
size: z.ZodNumber;
|
|
26
35
|
uploaderId: z.ZodString;
|
|
27
36
|
sha256: z.ZodString;
|
|
@@ -33,6 +42,7 @@ export declare const runtimeStorageListResponseSchema: z.ZodObject<{
|
|
|
33
42
|
id: z.ZodString;
|
|
34
43
|
contentType: z.ZodString;
|
|
35
44
|
createdAt: z.ZodString;
|
|
45
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
36
46
|
size: z.ZodNumber;
|
|
37
47
|
uploaderId: z.ZodString;
|
|
38
48
|
sha256: z.ZodString;
|
|
@@ -42,11 +52,33 @@ export declare const runtimeStorageListResponseSchema: z.ZodObject<{
|
|
|
42
52
|
hasMore: z.ZodBoolean;
|
|
43
53
|
}, z.core.$strict>;
|
|
44
54
|
export type RuntimeStorageListResponse = z.infer<typeof runtimeStorageListResponseSchema>;
|
|
55
|
+
/**
|
|
56
|
+
* The upload's metadata rides the URL because the body is the file.
|
|
57
|
+
*
|
|
58
|
+
* `contentType` comes from the request's own `Content-Type`, which is where a
|
|
59
|
+
* raw-body upload already states it; only the name has nowhere else to go.
|
|
60
|
+
*/
|
|
61
|
+
export declare const runtimeStorageUploadQuerySchema: z.ZodObject<{
|
|
62
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, z.core.$strict>;
|
|
64
|
+
export declare const runtimeStorageUploadPublicResponseSchema: z.ZodObject<{
|
|
65
|
+
data: z.ZodObject<{
|
|
66
|
+
id: z.ZodString;
|
|
67
|
+
contentType: z.ZodString;
|
|
68
|
+
createdAt: z.ZodString;
|
|
69
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
70
|
+
size: z.ZodNumber;
|
|
71
|
+
uploaderId: z.ZodString;
|
|
72
|
+
sha256: z.ZodString;
|
|
73
|
+
url: z.ZodString;
|
|
74
|
+
}, z.core.$strict>;
|
|
75
|
+
}, z.core.$strip>;
|
|
45
76
|
export declare const runtimeStorageListPublicResponseSchema: z.ZodObject<{
|
|
46
77
|
data: z.ZodArray<z.ZodObject<{
|
|
47
78
|
id: z.ZodString;
|
|
48
79
|
contentType: z.ZodString;
|
|
49
80
|
createdAt: z.ZodString;
|
|
81
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
50
82
|
size: z.ZodNumber;
|
|
51
83
|
uploaderId: z.ZodString;
|
|
52
84
|
sha256: z.ZodString;
|