@capybara-hq/plugin-sdk 0.1.0-rc.62 → 0.1.0-rc.64

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.
@@ -0,0 +1,17 @@
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;
@@ -0,0 +1,12 @@
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
+ }
package/dist/model.d.ts CHANGED
@@ -317,10 +317,10 @@ export declare class ModelError extends Error {
317
317
  /**
318
318
  * Options of a model call made for an organization.
319
319
  * `config` is the extension's effective deployment config for this org: the platform's deployment
320
- * config with the org's copy applied to the overridable fields (`orgAccess(…, "override")`), or the
321
- * platform's config (equal to `ctx.config`) while the org follows it. Use it, not `ctx.config`, for
322
- * work done for this org. Optional in the type so older providers compile; the kernel always passes
323
- * both.
320
+ * config with the org's copy applied to the overridable fields (every field not marked
321
+ * `platformOnly`), or the platform's config (equal to `ctx.config`) while the org follows it. Use
322
+ * it, not `ctx.config`, for work done for this org. Both are absent on a call not made for an org,
323
+ * such as a conformance run.
324
324
  */
325
325
  export interface ModelCallOptions {
326
326
  orgId?: string;
@@ -0,0 +1,26 @@
1
+ import type { z } from "zod";
2
+ /**
3
+ * Marks a deployment config field, or the whole deployment schema, as platform-only (Zod 4 meta
4
+ * `{ platformOnly: true }`), merging with existing meta (`secret`, `hot`, `ui`), also the meta of
5
+ * the nodes under `.optional()` / `.default()` and the other wrappers, so
6
+ * `platformOnly(secret(x))` and `secret(platformOnly(x))` are the same. `configJsonSchema`
7
+ * publishes it as `"x-platform-only": true`; it is allowed on the root and on its top-level
8
+ * properties (a nested field has the level of its top-level key).
9
+ *
10
+ * Every deployment field without the mark is overridable: an org follows the platform's value until
11
+ * it saves its own copy, and the extension reads it from the per-call `config` (the effective config
12
+ * for the org), not from `ctx.config`. A platform-only field is set only by the platform and is never
13
+ * shown to an org.
14
+ *
15
+ * The effective config of an org that has its own copy still contains the platform-only secrets,
16
+ * which an org cannot set; it never contains an overridable platform secret. Never send a
17
+ * platform-only secret to an endpoint taken from an overridable field: an org could point that
18
+ * endpoint at a server it controls.
19
+ */
20
+ export declare function platformOnly<T extends z.ZodTypeAny>(schema: T): T;
21
+ /**
22
+ * Whether a schema carries the {@link platformOnly} mark. It sees through `.optional()`,
23
+ * `.default()`, `.nullable()`, `.prefault()`, `.catch()` and `.readonly()` (the outermost meta
24
+ * wins), so it agrees with the `"x-platform-only"` that `configJsonSchema` publishes.
25
+ */
26
+ export declare function isPlatformOnly(schema: z.ZodTypeAny): boolean;
@@ -0,0 +1,35 @@
1
+ import { withMeta, wrapperChain } from "./field-meta.js";
2
+ /**
3
+ * Marks a deployment config field, or the whole deployment schema, as platform-only (Zod 4 meta
4
+ * `{ platformOnly: true }`), merging with existing meta (`secret`, `hot`, `ui`), also the meta of
5
+ * the nodes under `.optional()` / `.default()` and the other wrappers, so
6
+ * `platformOnly(secret(x))` and `secret(platformOnly(x))` are the same. `configJsonSchema`
7
+ * publishes it as `"x-platform-only": true`; it is allowed on the root and on its top-level
8
+ * properties (a nested field has the level of its top-level key).
9
+ *
10
+ * Every deployment field without the mark is overridable: an org follows the platform's value until
11
+ * it saves its own copy, and the extension reads it from the per-call `config` (the effective config
12
+ * for the org), not from `ctx.config`. A platform-only field is set only by the platform and is never
13
+ * shown to an org.
14
+ *
15
+ * The effective config of an org that has its own copy still contains the platform-only secrets,
16
+ * which an org cannot set; it never contains an overridable platform secret. Never send a
17
+ * platform-only secret to an endpoint taken from an overridable field: an org could point that
18
+ * endpoint at a server it controls.
19
+ */
20
+ export function platformOnly(schema) {
21
+ return withMeta(schema, "platformOnly", true);
22
+ }
23
+ /**
24
+ * Whether a schema carries the {@link platformOnly} mark. It sees through `.optional()`,
25
+ * `.default()`, `.nullable()`, `.prefault()`, `.catch()` and `.readonly()` (the outermost meta
26
+ * wins), so it agrees with the `"x-platform-only"` that `configJsonSchema` publishes.
27
+ */
28
+ export function isPlatformOnly(schema) {
29
+ for (const node of wrapperChain(schema)) {
30
+ const v = node.meta()?.platformOnly;
31
+ if (v !== undefined)
32
+ return v === true;
33
+ }
34
+ return false;
35
+ }
@@ -89,7 +89,6 @@ export interface PluginExtensionSection {
89
89
  */
90
90
  configSchemas?: {
91
91
  deployment?: JsonSchema;
92
- org?: JsonSchema;
93
92
  };
94
93
  /** Browser code, styles and assets (needs `permissions.client: true`); see {@link PluginClientSection}. */
95
94
  client?: PluginClientSection;
@@ -93,6 +93,30 @@ const baseId = (p) => (p.split("/").pop() ?? "").replace(/\.json$/, "");
93
93
  const configFields = z
94
94
  .array(z.strictObject({ path: z.string().max(1000), secret: z.boolean(), hot: z.boolean() }))
95
95
  .max(1000);
96
+ const configSchemaJson = z
97
+ .record(z.string(), z.unknown())
98
+ .refine((v) => new TextEncoder().encode(JSON.stringify(v)).length <= CONFIG_UI_LIMITS.configSchemaBytes, {
99
+ message: `must be at most ${CONFIG_UI_LIMITS.configSchemaBytes} bytes of JSON (${CONFIG_UI_LIMITS.configSchemaBytes / 1024} KiB)`,
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
+ };
96
120
  const staticExtensionManifest = z.strictObject({
97
121
  name: z.string(),
98
122
  version: z.string(),
@@ -102,12 +126,9 @@ const staticExtensionManifest = z.strictObject({
102
126
  optional: z.array(z.string()),
103
127
  permissions: z.record(z.string(), z.unknown()),
104
128
  ui: z.array(z.record(z.string(), z.unknown())).optional(),
105
- config: z.strictObject({ deployment: configFields, org: configFields }),
106
- });
107
- const configSchemaJson = z
108
- .record(z.string(), z.unknown())
109
- .refine((v) => new TextEncoder().encode(JSON.stringify(v)).length <= CONFIG_UI_LIMITS.configSchemaBytes, {
110
- message: `must be at most ${CONFIG_UI_LIMITS.configSchemaBytes} bytes of JSON (${CONFIG_UI_LIMITS.configSchemaBytes / 1024} KiB)`,
129
+ config: z
130
+ .strictObject({ deployment: configFields, org: legacyPackedBeforeCore720.configOrg })
131
+ .transform(({ org: _legacyOrg, ...config }) => config),
111
132
  });
112
133
  const setupGuide = z.strictObject({
113
134
  id: z.string().regex(CATALOG_ITEM_NAME_RE, {
@@ -149,7 +170,11 @@ const extensionSection = z.strictObject({
149
170
  migrations: dotPath("migrations").optional(),
150
171
  ui: dotPath("ui").optional(),
151
172
  configSchemas: z
152
- .strictObject({ deployment: configSchemaJson.optional(), org: configSchemaJson.optional() })
173
+ .strictObject({
174
+ deployment: configSchemaJson.optional(),
175
+ org: legacyPackedBeforeCore720.configSchemasOrg,
176
+ })
177
+ .transform(({ org: _legacyOrg, ...schemas }) => schemas)
153
178
  .optional(),
154
179
  client: clientSection.optional(),
155
180
  });
@@ -384,14 +409,12 @@ const schema = z
384
409
  if (semver.validRange(em.sdk) !== null && !hasUpperBound(em.sdk)) {
385
410
  issue(["extension", "manifest", "sdk"], `"${em.sdk}" has no upper bound: use a range such as ^0.1.0 so a future major SDK is not assumed compatible`);
386
411
  }
387
- for (const k of ["deployment", "org"]) {
388
- const seen = new Set();
389
- for (const f of em.config[k]) {
390
- if (seen.has(f.path)) {
391
- issue(["extension", "manifest", "config", k], `duplicate config path "${f.path}"`);
392
- }
393
- seen.add(f.path);
412
+ const seen = new Set();
413
+ for (const f of em.config.deployment) {
414
+ if (seen.has(f.path)) {
415
+ issue(["extension", "manifest", "config", "deployment"], `duplicate config path "${f.path}"`);
394
416
  }
417
+ seen.add(f.path);
395
418
  }
396
419
  // Name, version, sdk range, extension point refs, permissions, UI contributions: the same
397
420
  // rules as defineExtension (with a placeholder setup).
@@ -45,7 +45,6 @@ export interface StaticExtensionManifest {
45
45
  ui?: ExtensionManifest["ui"];
46
46
  config: {
47
47
  deployment: StaticConfigField[];
48
- org: StaticConfigField[];
49
48
  };
50
49
  }
51
50
  /**
@@ -1,6 +1,7 @@
1
1
  import semver from "semver";
2
2
  import { ConnectorAuthSchema } from "./connector-auth.js";
3
3
  import { EXTENSION_NAME_RE } from "./define-extension.js";
4
+ import { chainMeta, wrapperChain } from "./field-meta.js";
4
5
  import { validateGitSource } from "./git-hosts.js";
5
6
  /**
6
7
  * Plugin package (npm-pack tgz) rules shared by the SDK, the packer and the kernel (spec §4.1). Pure
@@ -83,28 +84,23 @@ export function checkEntryImports(specifiers) {
83
84
  }
84
85
  return out;
85
86
  }
86
- const WRAPPERS = new Set(["default", "prefault", "optional", "nullable", "readonly", "catch"]);
87
87
  const defOf = (s) => s._zod.def;
88
- const metaOf = (s) => s.meta();
89
88
  /**
90
89
  * The same traversal as the kernel's `configFields`: objects are expanded recursively, wrappers
91
- * such as default / optional are stripped, and a secret on an object is inherited downward.
90
+ * such as default / optional are stripped (their meta merged, `secret` from any of them), and a
91
+ * secret on an object is inherited downward.
92
92
  */
93
93
  function configFieldsOf(schema, prefix = "", inheritedSecret = false) {
94
94
  if (!schema)
95
95
  return [];
96
- let node = schema;
97
- let meta = metaOf(node);
98
- while (WRAPPERS.has(defOf(node).type) && defOf(node).innerType) {
99
- node = defOf(node).innerType;
100
- meta ??= metaOf(node);
101
- }
102
- const secret = inheritedSecret || meta?.secret === true;
103
- const def = defOf(node);
96
+ const chain = wrapperChain(schema);
97
+ const meta = chainMeta(schema);
98
+ const secret = inheritedSecret || meta.secret === true;
99
+ const def = defOf(chain[chain.length - 1]);
104
100
  if (def.type === "object" && def.shape) {
105
101
  return Object.entries(def.shape).flatMap(([k, v]) => configFieldsOf(v, prefix ? `${prefix}.${k}` : k, secret));
106
102
  }
107
- return [{ path: prefix, secret, hot: meta?.hot === true }];
103
+ return [{ path: prefix, secret, hot: meta.hot === true }];
108
104
  }
109
105
  const byPath = (a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0;
110
106
  const jsonClone = (v) => JSON.parse(JSON.stringify(v));
@@ -125,7 +121,6 @@ export function staticManifestOf(m) {
125
121
  permissions: jsonClone(m.permissions ?? {}),
126
122
  config: {
127
123
  deployment: configFieldsOf(m.config?.deployment).sort(byPath),
128
- org: configFieldsOf(m.config?.org).sort(byPath),
129
124
  },
130
125
  };
131
126
  if (m.ui !== undefined)
@@ -37,7 +37,7 @@ export interface SandboxRuntimeFile {
37
37
  *
38
38
  * A runtime change therefore lands in three steps (tools/checks/README.md, "Changing the SDK
39
39
  * runtime sources"): `current` first, then the provider restages, then core promotes `current` to
40
- * `files` with the pin.
40
+ * `files` with the pin. Between changes, as now, `current` is `files`.
41
41
  */
42
42
  export declare const SANDBOX_RUNTIME_SOURCE: {
43
43
  readonly version: number;
@@ -1,25 +1,29 @@
1
1
  import { LINUX_SANDBOX_SOURCE } from "./sandbox-linux-runtime-source.js";
2
- import { LINUX_SANDBOX_STAGED_SOURCE } from "./sandbox-linux-staged-runtime-source.js";
3
2
  import { NATIVE_FILES_SOURCE } from "./sandbox-native-runtime-source.js";
4
3
  const NATIVE_FILES = Object.freeze({
5
4
  name: "native-files.py",
6
5
  source: NATIVE_FILES_SOURCE,
7
6
  sha256: "c1712198af4ffedc0b48f789c28ed4233dc9008521b897300731c4f903168950",
8
7
  });
9
- /** The launcher every released image provider stages (`sandbox-linux-staged-runtime-source.ts`). */
10
- const LINUX_SANDBOX_STAGED = Object.freeze({
11
- name: "linux-sandbox.py",
12
- source: LINUX_SANDBOX_STAGED_SOURCE,
13
- sha256: "4e046df902dc644532ada9f2a3bef30a983daf7d1f238bd46dcd16524d96c66c",
14
- });
15
8
  const LINUX_SANDBOX = Object.freeze({
16
9
  name: "linux-sandbox.py",
17
10
  source: LINUX_SANDBOX_SOURCE,
18
11
  sha256: "ceb5bb0971437978a7695091792bfafcf3dbf2e7c74e8425d8aceb76e442f848",
19
12
  features: Object.freeze(["fileReadRoots"]),
20
13
  });
21
- const STAGED = Object.freeze([NATIVE_FILES, LINUX_SANDBOX_STAGED]);
22
- const CURRENT = Object.freeze([NATIVE_FILES, LINUX_SANDBOX]);
14
+ const STAGED = Object.freeze([NATIVE_FILES, LINUX_SANDBOX]);
15
+ const CURRENT = STAGED;
16
+ /**
17
+ * Digests of earlier revisions a staged copy may still have (one previous revision at most):
18
+ * device containers made from an earlier image keep their staged runtime until recreated. The
19
+ * launcher before exact file read roots (core#742); the next runtime change drops it.
20
+ */
21
+ const PREVIOUS = Object.freeze([
22
+ Object.freeze({
23
+ name: "linux-sandbox.py",
24
+ sha256: "4e046df902dc644532ada9f2a3bef30a983daf7d1f238bd46dcd16524d96c66c",
25
+ }),
26
+ ]);
23
27
  function acceptedDigests(...sets) {
24
28
  const out = {};
25
29
  for (const set of sets)
@@ -59,11 +63,11 @@ function acceptedDigests(...sets) {
59
63
  *
60
64
  * A runtime change therefore lands in three steps (tools/checks/README.md, "Changing the SDK
61
65
  * runtime sources"): `current` first, then the provider restages, then core promotes `current` to
62
- * `files` with the pin.
66
+ * `files` with the pin. Between changes, as now, `current` is `files`.
63
67
  */
64
68
  export const SANDBOX_RUNTIME_SOURCE = Object.freeze({
65
69
  version: 2,
66
70
  files: STAGED,
67
71
  current: CURRENT,
68
- accepted: acceptedDigests(STAGED, CURRENT),
72
+ accepted: acceptedDigests(STAGED, CURRENT, PREVIOUS),
69
73
  });
package/dist/secret.d.ts CHANGED
@@ -1,11 +1,14 @@
1
1
  import type { z } from "zod";
2
2
  /**
3
3
  * Marks a schema as a secret field (Zod 4 meta `{ secret: true }`), merging with existing meta
4
- * (`ui` hints, `hot`), so `secret(ui(x, …))` and `ui(secret(x), …)` are the same.
4
+ * (`ui` hints, `hot`, `platformOnly`), also the meta of the nodes under `.optional()` /
5
+ * `.default()` and the other wrappers, so `secret(ui(x, …))` and `ui(secret(x), …)` are the same.
5
6
  */
6
7
  export declare function secret<T extends z.ZodTypeAny>(schema: T): T;
7
8
  /**
8
- * Reads the schema's meta to tell whether it is sensitive; the kernel's `meta({secret:true})` is
9
- * recognized the same way.
9
+ * Whether a schema is sensitive: `secret: true` in its meta or in the meta of any node it wraps
10
+ * through `.optional()`, `.default()`, `.nullable()`, `.prefault()`, `.catch()` and `.readonly()`
11
+ * (fail-safe: an outer meta never hides the mark). The kernel's `meta({secret:true})` is recognized
12
+ * the same way.
10
13
  */
11
14
  export declare function isSecret(schema: z.ZodTypeAny): boolean;
package/dist/secret.js CHANGED
@@ -1,14 +1,18 @@
1
+ import { chainMeta, withMeta } from "./field-meta.js";
1
2
  /**
2
3
  * Marks a schema as a secret field (Zod 4 meta `{ secret: true }`), merging with existing meta
3
- * (`ui` hints, `hot`), so `secret(ui(x, …))` and `ui(secret(x), …)` are the same.
4
+ * (`ui` hints, `hot`, `platformOnly`), also the meta of the nodes under `.optional()` /
5
+ * `.default()` and the other wrappers, so `secret(ui(x, …))` and `ui(secret(x), …)` are the same.
4
6
  */
5
7
  export function secret(schema) {
6
- return schema.meta({ ...(schema.meta() ?? {}), secret: true });
8
+ return withMeta(schema, "secret", true);
7
9
  }
8
10
  /**
9
- * Reads the schema's meta to tell whether it is sensitive; the kernel's `meta({secret:true})` is
10
- * recognized the same way.
11
+ * Whether a schema is sensitive: `secret: true` in its meta or in the meta of any node it wraps
12
+ * through `.optional()`, `.default()`, `.nullable()`, `.prefault()`, `.catch()` and `.readonly()`
13
+ * (fail-safe: an outer meta never hides the mark). The kernel's `meta({secret:true})` is recognized
14
+ * the same way.
11
15
  */
12
16
  export function isSecret(schema) {
13
- return schema.meta()?.secret === true;
17
+ return chainMeta(schema).secret === true;
14
18
  }
package/dist/tool.d.ts CHANGED
@@ -178,8 +178,7 @@ export interface ToolCallContext {
178
178
  * The key of this logical call for idempotent side effects: 64 lowercase hex characters derived
179
179
  * from the conversation, the run and `callId`. The same for every invocation of the call
180
180
  * (each `InputRequired` round), different for every other call, including a later call the
181
- * model makes to retry it. Optional in the type so older extensions compile; the kernel always
182
- * passes it.
181
+ * model makes to retry it.
183
182
  */
184
183
  idempotencyKey?: string;
185
184
  signal: AbortSignal;
@@ -190,10 +189,9 @@ export interface ToolCallContext {
190
189
  };
191
190
  /**
192
191
  * The extension's effective deployment config for this org: the platform's deployment config
193
- * with the org's copy applied to the overridable fields (`orgAccess(…, "override")`), or the
194
- * platform's config (equal to `ctx.config`) while the org follows it. Use it, not `ctx.config`,
195
- * for work done for this org. Optional in the type so older extensions compile; the kernel
196
- * always passes it.
192
+ * with the org's copy applied to the overridable fields (every field not marked `platformOnly`),
193
+ * or the platform's config (equal to `ctx.config`) while the org follows it. Use it, not
194
+ * `ctx.config`, for work done for this org.
197
195
  */
198
196
  config?: unknown;
199
197
  /** Where the conversation comes from. The kernel always passes it. */
package/dist/ui.d.ts CHANGED
@@ -195,10 +195,9 @@ export interface UiRenderArgsBase {
195
195
  signal: AbortSignal;
196
196
  /**
197
197
  * The extension's effective deployment config: for an org, the platform's deployment config
198
- * with the org's copy applied to the overridable fields (`orgAccess(…, "override")`), or the
199
- * platform's config (equal to `ctx.config`) while the org follows it; for the platform scope,
200
- * the platform's config. Use it, not `ctx.config`, for work done for this org. Optional in the
201
- * type so older extensions compile; the kernel always passes it.
198
+ * with the org's copy applied to the overridable fields (every field not marked `platformOnly`),
199
+ * or the platform's config (equal to `ctx.config`) while the org follows it; for the platform
200
+ * scope, the platform's config. Use it, not `ctx.config`, for work done for this org.
202
201
  */
203
202
  config?: unknown;
204
203
  }
package/dist/web.d.ts CHANGED
@@ -13,30 +13,33 @@ export interface WebSearchResult {
13
13
  publishedAt?: string;
14
14
  }
15
15
  /**
16
- * A web search provider (`web-search@1`). The kernel passes the org's decrypted `orgConfig` and the
17
- * extension's effective deployment config for the org (`config`).
16
+ * A web search provider (`web-search@1`). The kernel passes the extension's effective config for
17
+ * the org (`config`).
18
18
  */
19
19
  export interface WebSearchProvider {
20
20
  /**
21
- * False when this org's config lacks what the provider needs. `config` is the effective
22
- * deployment config for the org (see `search`'s `config`).
21
+ * False when this org's effective config lacks what the provider needs (see `search`'s
22
+ * `config`).
23
23
  */
24
- configured?(orgConfig: unknown, config?: unknown): boolean;
24
+ configured?(config: unknown): boolean;
25
25
  search(args: {
26
26
  query: string;
27
27
  /** Hints only: the kernel filters the results again. */
28
28
  allowedDomains?: string[];
29
29
  blockedDomains?: string[];
30
30
  maxResults: number;
31
- orgConfig: unknown;
32
31
  /**
33
- * The extension's effective deployment config for this org: the platform's deployment config
34
- * with the org's copy applied to the overridable fields (`orgAccess(…, "override")`), or the
32
+ * The extension's effective config for this org: the platform's deployment config with the
33
+ * org's copy applied to the overridable fields (every field not marked `platformOnly`), or the
35
34
  * platform's config (equal to `ctx.config`) while the org follows it. Use it, not `ctx.config`,
36
- * for work done for this org. Optional in the type so older extensions compile; the kernel
37
- * always passes it.
35
+ * for work done for this org.
38
36
  */
39
- config?: unknown;
37
+ config: unknown;
38
+ /**
39
+ * The org the call is made for. Pass it to `configUrlFetch` (`orgId`) or `ctx.net.fetch`, so a
40
+ * URL an org set is checked against that org's network rules. The kernel always sets it.
41
+ */
42
+ orgId?: string;
40
43
  signal: AbortSignal;
41
44
  }): Promise<{
42
45
  results: WebSearchResult[];
@@ -63,22 +66,25 @@ export interface WebFetchPage {
63
66
  */
64
67
  export interface WebFetchProvider {
65
68
  /**
66
- * False when this org's config lacks what the provider needs. `config` is the effective
67
- * deployment config for the org (see `fetch`'s `config`).
69
+ * False when this org's effective config lacks what the provider needs (see `fetch`'s
70
+ * `config`).
68
71
  */
69
- configured?(orgConfig: unknown, config?: unknown): boolean;
72
+ configured?(config: unknown): boolean;
70
73
  fetch(args: {
71
74
  /** Already validated and upgraded by the kernel. */
72
75
  url: string;
73
- orgConfig: unknown;
74
76
  /**
75
- * The extension's effective deployment config for this org: the platform's deployment config
76
- * with the org's copy applied to the overridable fields (`orgAccess(…, "override")`), or the
77
+ * The extension's effective config for this org: the platform's deployment config with the
78
+ * org's copy applied to the overridable fields (every field not marked `platformOnly`), or the
77
79
  * platform's config (equal to `ctx.config`) while the org follows it. Use it, not `ctx.config`,
78
- * for work done for this org. Optional in the type so older extensions compile; the kernel
79
- * always passes it.
80
+ * for work done for this org.
81
+ */
82
+ config: unknown;
83
+ /**
84
+ * The org the call is made for. Pass it to `configUrlFetch` (`orgId`) or `ctx.net.fetch`, so a
85
+ * URL an org set is checked against that org's network rules. The kernel always sets it.
80
86
  */
81
- config?: unknown;
87
+ orgId?: string;
82
88
  signal: AbortSignal;
83
89
  }): Promise<WebFetchPage>;
84
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capybara-hq/plugin-sdk",
3
- "version": "0.1.0-rc.62",
3
+ "version": "0.1.0-rc.64",
4
4
  "description": "Capybara plugin SDK: the types and pure functions plugins are written against",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -353,6 +353,8 @@
353
353
  }
354
354
  },
355
355
  "org": {
356
+ "deprecated": true,
357
+ "description": "Ignored: written only by packers before core#720.",
356
358
  "maxItems": 1000,
357
359
  "type": "array",
358
360
  "items": {
@@ -379,8 +381,7 @@
379
381
  }
380
382
  },
381
383
  "required": [
382
- "deployment",
383
- "org"
384
+ "deployment"
384
385
  ],
385
386
  "additionalProperties": false
386
387
  }
@@ -420,6 +421,8 @@
420
421
  "additionalProperties": {}
421
422
  },
422
423
  "org": {
424
+ "deprecated": true,
425
+ "description": "Ignored: written only by packers before core#720.",
423
426
  "type": "object",
424
427
  "propertyNames": {
425
428
  "type": "string"
@@ -1,27 +0,0 @@
1
- import type { z } from "zod";
2
- /**
3
- * How an org may treat a deployment config field: `readonly` (the org sees it, never sets it) or
4
- * `override` (an org may set its own value). A field without a level is deployment-only.
5
- */
6
- export type OrgAccess = "readonly" | "override";
7
- /**
8
- * Marks a deployment config field with an org access level (Zod 4 meta `{ org: access }`), merging
9
- * with existing meta (`secret`, `hot`, `ui`), so `orgAccess(secret(x), …)` and
10
- * `secret(orgAccess(x, …))` are the same. `configJsonSchema` publishes it as `"x-org"`.
11
- *
12
- * The author's promise for `override`: the extension reads the field from the per-call `config`
13
- * the kernel passes with each request, not from `ctx.config`, and the field may be absent from
14
- * `ctx.config` (the deployment value is the default, which an org may replace per call).
15
- *
16
- * The per-call config of an org that has its own copy still contains the platform's hidden
17
- * (platform-only) secrets, which an org cannot set; it never contains an overridable platform
18
- * secret. Never send a hidden secret to an endpoint taken from an overridable field: an org could
19
- * point that endpoint at a server it controls.
20
- */
21
- export declare function orgAccess<T extends z.ZodTypeAny>(schema: T, access: OrgAccess): T;
22
- /**
23
- * The org access level of a schema's meta, or undefined when it has none. It sees through
24
- * `.optional()`, `.default()`, `.nullable()`, `.prefault()`, `.catch()` and `.readonly()` (the
25
- * outermost level wins), so it agrees with the `"x-org"` that `configJsonSchema` publishes.
26
- */
27
- export declare function orgAccessOf(schema: z.ZodTypeAny): OrgAccess | undefined;
@@ -1,35 +0,0 @@
1
- /**
2
- * Marks a deployment config field with an org access level (Zod 4 meta `{ org: access }`), merging
3
- * with existing meta (`secret`, `hot`, `ui`), so `orgAccess(secret(x), …)` and
4
- * `secret(orgAccess(x, …))` are the same. `configJsonSchema` publishes it as `"x-org"`.
5
- *
6
- * The author's promise for `override`: the extension reads the field from the per-call `config`
7
- * the kernel passes with each request, not from `ctx.config`, and the field may be absent from
8
- * `ctx.config` (the deployment value is the default, which an org may replace per call).
9
- *
10
- * The per-call config of an org that has its own copy still contains the platform's hidden
11
- * (platform-only) secrets, which an org cannot set; it never contains an overridable platform
12
- * secret. Never send a hidden secret to an endpoint taken from an overridable field: an org could
13
- * point that endpoint at a server it controls.
14
- */
15
- export function orgAccess(schema, access) {
16
- return schema.meta({ ...(schema.meta() ?? {}), org: access });
17
- }
18
- /** The wrappers a field's org level is read through, as `configJsonSchema` inherits meta. */
19
- const WRAPPERS = new Set(["default", "prefault", "optional", "nullable", "readonly", "catch"]);
20
- /**
21
- * The org access level of a schema's meta, or undefined when it has none. It sees through
22
- * `.optional()`, `.default()`, `.nullable()`, `.prefault()`, `.catch()` and `.readonly()` (the
23
- * outermost level wins), so it agrees with the `"x-org"` that `configJsonSchema` publishes.
24
- */
25
- export function orgAccessOf(schema) {
26
- let node = schema;
27
- while (node) {
28
- const v = node.meta()?.org;
29
- if (v === "readonly" || v === "override")
30
- return v;
31
- const def = node._zod.def;
32
- node = WRAPPERS.has(def.type) ? def.innerType : undefined;
33
- }
34
- return undefined;
35
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * The `linux-sandbox.py` that released image providers stage (device-docker's image), kept
3
- * byte for byte while the SDK's current launcher (`sandbox-linux-runtime-source.ts`) is ahead of
4
- * them: `SANDBOX_RUNTIME_SOURCE.files` lists these bytes, so a provider that checks its staged copy
5
- * against the host SDK keeps working until it restages and core moves its pin (see
6
- * `SANDBOX_RUNTIME_SOURCE` and tools/checks/README.md, "Changing the SDK runtime sources"). The
7
- * text is inlined, not composed, so nothing else in the SDK can change these bytes. Never edit it;
8
- * the promotion that makes the current launcher the staged one deletes this file.
9
- */
10
- export declare const LINUX_SANDBOX_STAGED_SOURCE: string;