@capybara-hq/plugin-sdk 0.1.0-rc.67 → 0.1.0-rc.69
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/define-extension.d.ts +1 -6
- package/dist/define-extension.js +2 -23
- package/dist/field-meta.d.ts +3 -2
- package/dist/field-meta.js +8 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/platform-only.d.ts +3 -2
- package/dist/platform-only.js +5 -5
- package/dist/plugin-manifest.js +2 -29
- package/package.json +1 -1
- package/schemas/plugin.v1.schema.json +0 -36
- package/dist/legacy-org-access.d.ts +0 -17
- package/dist/legacy-org-access.js +0 -12
|
@@ -47,10 +47,5 @@ export declare class ExtensionManifestError extends Error {
|
|
|
47
47
|
}
|
|
48
48
|
/** Plugin name rule (manifest `name`; a connector template's `plugin` is validated by it too). */
|
|
49
49
|
export declare const EXTENSION_NAME_RE: RegExp;
|
|
50
|
-
/**
|
|
51
|
-
* Validates the plugin manifest and returns it unchanged; throws ExtensionManifestError when
|
|
52
|
-
* invalid. One transition exception: a `config.org` key (modules packed before core#720) is dropped,
|
|
53
|
-
* not refused, and the returned manifest is then a copy with `config: { deployment }` only; any
|
|
54
|
-
* other `config` key besides `deployment` still throws.
|
|
55
|
-
*/
|
|
50
|
+
/** Validates the plugin manifest and returns it unchanged; throws ExtensionManifestError when invalid. */
|
|
56
51
|
export declare function defineExtension(m: ExtensionManifest): ExtensionManifest;
|
package/dist/define-extension.js
CHANGED
|
@@ -33,12 +33,7 @@ function checkRefs(label, refs, fail, forbidBrokered = false) {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Validates the plugin manifest and returns it unchanged; throws ExtensionManifestError when
|
|
38
|
-
* invalid. One transition exception: a `config.org` key (modules packed before core#720) is dropped,
|
|
39
|
-
* not refused, and the returned manifest is then a copy with `config: { deployment }` only; any
|
|
40
|
-
* other `config` key besides `deployment` still throws.
|
|
41
|
-
*/
|
|
36
|
+
/** Validates the plugin manifest and returns it unchanged; throws ExtensionManifestError when invalid. */
|
|
42
37
|
export function defineExtension(m) {
|
|
43
38
|
const plugin = typeof m?.name === "string" && m.name !== "" ? m.name : "<unnamed>";
|
|
44
39
|
const fail = (msg) => {
|
|
@@ -81,7 +76,6 @@ export function defineExtension(m) {
|
|
|
81
76
|
fail(`field "optional" entry "${r}" overlaps with "provides" or "requires"`);
|
|
82
77
|
}
|
|
83
78
|
}
|
|
84
|
-
let legacyOrg = false;
|
|
85
79
|
if (m.config !== undefined) {
|
|
86
80
|
if (typeof m.config !== "object" || m.config === null || Array.isArray(m.config)) {
|
|
87
81
|
fail(`field "config" must be an object`);
|
|
@@ -89,10 +83,6 @@ export function defineExtension(m) {
|
|
|
89
83
|
for (const key of Object.keys(m.config)) {
|
|
90
84
|
if (key === "deployment")
|
|
91
85
|
continue;
|
|
92
|
-
if (key === "org") {
|
|
93
|
-
legacyOrg = true;
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
86
|
fail(`config.${key} is not a config level: the only one is config.deployment`);
|
|
97
87
|
}
|
|
98
88
|
}
|
|
@@ -105,16 +95,5 @@ export function defineExtension(m) {
|
|
|
105
95
|
const uiErrs = validateUiContributions(m.ui, m.permissions);
|
|
106
96
|
if (uiErrs.length > 0)
|
|
107
97
|
fail(`invalid ui: ${uiErrs.join("; ")}`);
|
|
108
|
-
return
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* The manifest without the `config.org` key of a module packed before core#720 (a copy, so the
|
|
112
|
-
* module's own object is untouched). Dropped silently (the SDK has no logger): its fields never
|
|
113
|
-
* reach the static manifest, the permission set, the config levels or the views. Runtime tolerance
|
|
114
|
-
* only: the packer and `capybara-plugin check` still refuse `config.org` in new packs. Removed with
|
|
115
|
-
* the other pre-core#720 readers in core#720 plan Task 17.
|
|
116
|
-
*/
|
|
117
|
-
function withoutLegacyOrgConfig(m) {
|
|
118
|
-
const { org: _legacyOrg, ...config } = m.config;
|
|
119
|
-
return { ...m, config };
|
|
98
|
+
return m;
|
|
120
99
|
}
|
package/dist/field-meta.d.ts
CHANGED
|
@@ -9,8 +9,9 @@ type Meta = Record<string, unknown>;
|
|
|
9
9
|
export declare function wrapperChain(schema: z.ZodTypeAny): z.ZodTypeAny[];
|
|
10
10
|
/**
|
|
11
11
|
* The meta of a config field merged across its wrapper chain: an outer key wins over an inner one,
|
|
12
|
-
* except `secret`, which
|
|
13
|
-
* never hides a secret). Zod's `id` is
|
|
12
|
+
* except `secret` and `platformOnly`, which are true when any node of the chain carries them
|
|
13
|
+
* (fail-safe: a wrapper's meta never hides a secret or clears a platform-only mark). Zod's `id` is
|
|
14
|
+
* left out: it names one schema instance.
|
|
14
15
|
*/
|
|
15
16
|
export declare function chainMeta(schema: z.ZodTypeAny): Meta;
|
|
16
17
|
/** Sets `key: value` on the schema's meta, keeping every mark found through its wrappers. */
|
package/dist/field-meta.js
CHANGED
|
@@ -23,23 +23,29 @@ export function wrapperChain(schema) {
|
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* The meta of a config field merged across its wrapper chain: an outer key wins over an inner one,
|
|
26
|
-
* except `secret`, which
|
|
27
|
-
* never hides a secret). Zod's `id` is
|
|
26
|
+
* except `secret` and `platformOnly`, which are true when any node of the chain carries them
|
|
27
|
+
* (fail-safe: a wrapper's meta never hides a secret or clears a platform-only mark). Zod's `id` is
|
|
28
|
+
* left out: it names one schema instance.
|
|
28
29
|
*/
|
|
29
30
|
export function chainMeta(schema) {
|
|
30
31
|
const out = {};
|
|
31
32
|
let secret = false;
|
|
33
|
+
let platformOnly = false;
|
|
32
34
|
for (const node of wrapperChain(schema).reverse()) {
|
|
33
35
|
const m = node.meta();
|
|
34
36
|
if (!m)
|
|
35
37
|
continue;
|
|
36
38
|
if (m.secret === true)
|
|
37
39
|
secret = true;
|
|
40
|
+
if (m.platformOnly === true)
|
|
41
|
+
platformOnly = true;
|
|
38
42
|
Object.assign(out, m);
|
|
39
43
|
}
|
|
40
44
|
delete out.id;
|
|
41
45
|
if (secret)
|
|
42
46
|
out.secret = true;
|
|
47
|
+
if (platformOnly)
|
|
48
|
+
out.platformOnly = true;
|
|
43
49
|
return out;
|
|
44
50
|
}
|
|
45
51
|
/** Sets `key: value` on the schema's meta, keeping every mark found through its wrappers. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.1.0-rc.
|
|
1
|
+
export declare const SDK_VERSION = "0.1.0-rc.69";
|
|
2
2
|
export * from "./agent-template.js";
|
|
3
3
|
export * from "./avatar-presets.js";
|
|
4
4
|
export * from "./bootstrap.js";
|
|
@@ -24,7 +24,6 @@ export * from "./git-hosts.js";
|
|
|
24
24
|
export * from "./hooks.js";
|
|
25
25
|
export * from "./http-access.js";
|
|
26
26
|
export * from "./identity.js";
|
|
27
|
-
export * from "./legacy-org-access.js";
|
|
28
27
|
export * from "./marketplace.js";
|
|
29
28
|
export * from "./model.js";
|
|
30
29
|
export * from "./model-params.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.1.0-rc.
|
|
1
|
+
export const SDK_VERSION = "0.1.0-rc.69";
|
|
2
2
|
export * from "./agent-template.js";
|
|
3
3
|
export * from "./avatar-presets.js";
|
|
4
4
|
export * from "./bootstrap.js";
|
|
@@ -24,7 +24,6 @@ export * from "./git-hosts.js";
|
|
|
24
24
|
export * from "./hooks.js";
|
|
25
25
|
export * from "./http-access.js";
|
|
26
26
|
export * from "./identity.js";
|
|
27
|
-
export * from "./legacy-org-access.js";
|
|
28
27
|
export * from "./marketplace.js";
|
|
29
28
|
export * from "./model.js";
|
|
30
29
|
export * from "./model-params.js";
|
package/dist/platform-only.d.ts
CHANGED
|
@@ -20,7 +20,8 @@ import type { z } from "zod";
|
|
|
20
20
|
export declare function platformOnly<T extends z.ZodTypeAny>(schema: T): T;
|
|
21
21
|
/**
|
|
22
22
|
* Whether a schema carries the {@link platformOnly} mark. It sees through `.optional()`,
|
|
23
|
-
* `.default()`, `.nullable()`, `.prefault()`, `.catch()` and `.readonly()` (
|
|
24
|
-
*
|
|
23
|
+
* `.default()`, `.nullable()`, `.prefault()`, `.catch()` and `.readonly()` (true when any node of
|
|
24
|
+
* the chain carries the mark, like `secret`: an outer `false` never clears an inner `true`), so it
|
|
25
|
+
* agrees with the `"x-platform-only"` that `configJsonSchema` publishes.
|
|
25
26
|
*/
|
|
26
27
|
export declare function isPlatformOnly(schema: z.ZodTypeAny): boolean;
|
package/dist/platform-only.js
CHANGED
|
@@ -22,14 +22,14 @@ export function platformOnly(schema) {
|
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Whether a schema carries the {@link platformOnly} mark. It sees through `.optional()`,
|
|
25
|
-
* `.default()`, `.nullable()`, `.prefault()`, `.catch()` and `.readonly()` (
|
|
26
|
-
*
|
|
25
|
+
* `.default()`, `.nullable()`, `.prefault()`, `.catch()` and `.readonly()` (true when any node of
|
|
26
|
+
* the chain carries the mark, like `secret`: an outer `false` never clears an inner `true`), so it
|
|
27
|
+
* agrees with the `"x-platform-only"` that `configJsonSchema` publishes.
|
|
27
28
|
*/
|
|
28
29
|
export function isPlatformOnly(schema) {
|
|
29
30
|
for (const node of wrapperChain(schema)) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return v === true;
|
|
31
|
+
if (node.meta()?.platformOnly === true)
|
|
32
|
+
return true;
|
|
33
33
|
}
|
|
34
34
|
return false;
|
|
35
35
|
}
|
package/dist/plugin-manifest.js
CHANGED
|
@@ -98,25 +98,6 @@ const configSchemaJson = z
|
|
|
98
98
|
.refine((v) => new TextEncoder().encode(JSON.stringify(v)).length <= CONFIG_UI_LIMITS.configSchemaBytes, {
|
|
99
99
|
message: `must be at most ${CONFIG_UI_LIMITS.configSchemaBytes} bytes of JSON (${CONFIG_UI_LIMITS.configSchemaBytes / 1024} KiB)`,
|
|
100
100
|
});
|
|
101
|
-
/**
|
|
102
|
-
* Transition only: packages packed before core#720 carry the old org-only config in plugin.json:
|
|
103
|
-
* `extension.manifest.config.org` (the org config field list, often `[]`) and
|
|
104
|
-
* `extension.configSchemas.org` (its form schema). Published tarballs are immutable, so the reader
|
|
105
|
-
* accepts both and drops them: they never reach the parsed manifest, the permission set, the
|
|
106
|
-
* config levels or the views. Nothing else reads them, `defineExtension` drops a module's
|
|
107
|
-
* `config.org` the same way, and the packer refuses it and never writes either. Removed once the official plugins are
|
|
108
|
-
* republished and re-pinned (core#720 plan Task 17).
|
|
109
|
-
*/
|
|
110
|
-
const legacyPackedBeforeCore720 = {
|
|
111
|
-
configOrg: configFields.optional().meta({
|
|
112
|
-
deprecated: true,
|
|
113
|
-
description: "Ignored: written only by packers before core#720.",
|
|
114
|
-
}),
|
|
115
|
-
configSchemasOrg: configSchemaJson.optional().meta({
|
|
116
|
-
deprecated: true,
|
|
117
|
-
description: "Ignored: written only by packers before core#720.",
|
|
118
|
-
}),
|
|
119
|
-
};
|
|
120
101
|
const staticExtensionManifest = z.strictObject({
|
|
121
102
|
name: z.string(),
|
|
122
103
|
version: z.string(),
|
|
@@ -126,9 +107,7 @@ const staticExtensionManifest = z.strictObject({
|
|
|
126
107
|
optional: z.array(z.string()),
|
|
127
108
|
permissions: z.record(z.string(), z.unknown()),
|
|
128
109
|
ui: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
129
|
-
config: z
|
|
130
|
-
.strictObject({ deployment: configFields, org: legacyPackedBeforeCore720.configOrg })
|
|
131
|
-
.transform(({ org: _legacyOrg, ...config }) => config),
|
|
110
|
+
config: z.strictObject({ deployment: configFields }),
|
|
132
111
|
});
|
|
133
112
|
const setupGuide = z.strictObject({
|
|
134
113
|
id: z.string().regex(CATALOG_ITEM_NAME_RE, {
|
|
@@ -169,13 +148,7 @@ const extensionSection = z.strictObject({
|
|
|
169
148
|
manifest: staticExtensionManifest,
|
|
170
149
|
migrations: dotPath("migrations").optional(),
|
|
171
150
|
ui: dotPath("ui").optional(),
|
|
172
|
-
configSchemas: z
|
|
173
|
-
.strictObject({
|
|
174
|
-
deployment: configSchemaJson.optional(),
|
|
175
|
-
org: legacyPackedBeforeCore720.configSchemasOrg,
|
|
176
|
-
})
|
|
177
|
-
.transform(({ org: _legacyOrg, ...schemas }) => schemas)
|
|
178
|
-
.optional(),
|
|
151
|
+
configSchemas: z.strictObject({ deployment: configSchemaJson.optional() }).optional(),
|
|
179
152
|
client: clientSection.optional(),
|
|
180
153
|
});
|
|
181
154
|
const schema = z
|
package/package.json
CHANGED
|
@@ -351,33 +351,6 @@
|
|
|
351
351
|
],
|
|
352
352
|
"additionalProperties": false
|
|
353
353
|
}
|
|
354
|
-
},
|
|
355
|
-
"org": {
|
|
356
|
-
"deprecated": true,
|
|
357
|
-
"description": "Ignored: written only by packers before core#720.",
|
|
358
|
-
"maxItems": 1000,
|
|
359
|
-
"type": "array",
|
|
360
|
-
"items": {
|
|
361
|
-
"type": "object",
|
|
362
|
-
"properties": {
|
|
363
|
-
"path": {
|
|
364
|
-
"type": "string",
|
|
365
|
-
"maxLength": 1000
|
|
366
|
-
},
|
|
367
|
-
"secret": {
|
|
368
|
-
"type": "boolean"
|
|
369
|
-
},
|
|
370
|
-
"hot": {
|
|
371
|
-
"type": "boolean"
|
|
372
|
-
}
|
|
373
|
-
},
|
|
374
|
-
"required": [
|
|
375
|
-
"path",
|
|
376
|
-
"secret",
|
|
377
|
-
"hot"
|
|
378
|
-
],
|
|
379
|
-
"additionalProperties": false
|
|
380
|
-
}
|
|
381
354
|
}
|
|
382
355
|
},
|
|
383
356
|
"required": [
|
|
@@ -419,15 +392,6 @@
|
|
|
419
392
|
"type": "string"
|
|
420
393
|
},
|
|
421
394
|
"additionalProperties": {}
|
|
422
|
-
},
|
|
423
|
-
"org": {
|
|
424
|
-
"deprecated": true,
|
|
425
|
-
"description": "Ignored: written only by packers before core#720.",
|
|
426
|
-
"type": "object",
|
|
427
|
-
"propertyNames": {
|
|
428
|
-
"type": "string"
|
|
429
|
-
},
|
|
430
|
-
"additionalProperties": {}
|
|
431
395
|
}
|
|
432
396
|
},
|
|
433
397
|
"additionalProperties": false
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated Removed by core#720; kept only so plugin modules packed before core#720 still load.
|
|
4
|
-
* Fields are org-overridable by default (`platformOnly` marks platform-only). Removed in core#720
|
|
5
|
-
* plan Task 17.
|
|
6
|
-
*/
|
|
7
|
-
export type OrgAccess = "readonly" | "override";
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Removed by core#720; kept only so plugin modules packed before core#720 still load;
|
|
10
|
-
* fields are org-overridable by default (`platformOnly` marks platform-only). Removed in core#720
|
|
11
|
-
* plan Task 17.
|
|
12
|
-
*
|
|
13
|
-
* A no-op: it returns `schema` unchanged and adds no meta. Both levels are ignored: the field stays
|
|
14
|
-
* an ordinary deployment field, overridable by orgs unless it is marked {@link platformOnly};
|
|
15
|
-
* `"readonly"` in particular makes nothing visible to orgs or read-only. New code never calls it.
|
|
16
|
-
*/
|
|
17
|
-
export declare function orgAccess<T extends z.ZodTypeAny>(schema: T, _access: OrgAccess): T;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated Removed by core#720; kept only so plugin modules packed before core#720 still load;
|
|
3
|
-
* fields are org-overridable by default (`platformOnly` marks platform-only). Removed in core#720
|
|
4
|
-
* plan Task 17.
|
|
5
|
-
*
|
|
6
|
-
* A no-op: it returns `schema` unchanged and adds no meta. Both levels are ignored: the field stays
|
|
7
|
-
* an ordinary deployment field, overridable by orgs unless it is marked {@link platformOnly};
|
|
8
|
-
* `"readonly"` in particular makes nothing visible to orgs or read-only. New code never calls it.
|
|
9
|
-
*/
|
|
10
|
-
export function orgAccess(schema, _access) {
|
|
11
|
-
return schema;
|
|
12
|
-
}
|