@brydio/manifest 0.1.0-alpha.4 → 0.1.0-alpha.5

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/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # @brydio/manifest
2
+
3
+ The schema and validation rules for `.brydio/app.json`. It covers app identity,
4
+ placements, screens, collections, generated and custom tools, grants, and
5
+ migrations.
6
+
7
+ ```ts
8
+ import { defineManifest } from '@brydio/manifest';
9
+
10
+ export const manifest = defineManifest({
11
+ name: 'checklist',
12
+ version: '0.1.0',
13
+ screens: { home: { entry: 'screens/home.js' } },
14
+ placements: [{ kind: 'project-tab', screen: 'home', label: 'Checklist' }],
15
+ });
16
+ ```
17
+
18
+ Read the [manifest reference](https://github.com/nakel-ola/brydio-sdk/blob/main/docs/manifest.md)
19
+ for every field, schema type, grant, migration operation, and limit. The
20
+ [publish checklist](https://github.com/nakel-ola/brydio-sdk/blob/main/docs/publish-checklist.md)
21
+ lists every validation code and its refusal message.
22
+
23
+ This package is MIT licensed. While the SDK is `0.x`, a minor version may
24
+ contain a breaking change. Read the repository changelog before upgrading.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brydio/manifest",
3
- "version": "0.1.0-alpha.4",
3
+ "version": "0.1.0-alpha.5",
4
4
  "description": "The shape of a Brydio app's manifest, its collections' schemas, and the checks that say what is wrong with one.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -10,7 +10,7 @@
10
10
  "url": "https://github.com/nakel-ola/brydio-sdk",
11
11
  "directory": "packages/manifest"
12
12
  },
13
- "gitHead": "3668aa5394f40d6e6e941b68eacf4e6140ff5367",
13
+ "gitHead": "f9e99418eb18cedd529d7a62fe6c037396c50e3f",
14
14
  "exports": {
15
15
  ".": {
16
16
  "types": "./src/index.d.ts",
package/src/grants.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * `apps/api/src/apps/publishing/app-publish.service.ts`.
8
8
  */
9
9
  /** The host grants with a name of their own. A connection's is `connection:<name>`. */
10
- export declare const HOST_CAPABILITIES: readonly ["navigate", "message", "members", "projects"];
10
+ export declare const HOST_CAPABILITIES: readonly ["navigate", "message", "members", "projects", "model"];
11
11
  /** The older name for `HOST_CAPABILITIES`, kept for what already imports it. */
12
12
  export declare const KNOWN_HOST_GRANTS: readonly string[];
13
13
  /** True for a host grant Brydio knows how to honour: a named capability, or one connection. */
package/src/grants.js CHANGED
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import { BUNDLE_MANIFEST } from "./bundle.js";
10
10
  /** The host grants with a name of their own. A connection's is `connection:<name>`. */
11
- export const HOST_CAPABILITIES = ['navigate', 'message', 'members', 'projects'];
11
+ export const HOST_CAPABILITIES = ['navigate', 'message', 'members', 'projects', 'model'];
12
12
  /** The older name for `HOST_CAPABILITIES`, kept for what already imports it. */
13
13
  export const KNOWN_HOST_GRANTS = HOST_CAPABILITIES;
14
14
  const CONNECTION = /^connection:[a-z0-9][a-z0-9_-]{0,59}$/;
package/src/schema.d.ts CHANGED
@@ -1,6 +1,31 @@
1
1
  import { z } from 'zod';
2
2
  import { FieldTypeInvalid, type FieldType } from './field-types.js';
3
3
  export { COLOUR_TOKENS, FIELD_LIMITS, parseFieldType, RESERVED_FIELDS, structuredFields, type FieldKind, type FieldType, } from './field-types.js';
4
+ /**
5
+ * What an app adds to `.brydio/app.json` to be more than a bundle of servers
6
+ * and skills: where it is shown, what it keeps, the tools that come from what
7
+ * it keeps, its screens, and what it asks the workspace for (contracts §4).
8
+ *
9
+ * Every key is optional, so every manifest E5 already imports still parses.
10
+ * A copy of Brydio's `apps/api/src/apps/manifest/manifest-ext.schema.ts`, the
11
+ * schema the server reads an installed app's manifest with. The two change
12
+ * together; `test/manifest.test.ts` parses the same manifests with both.
13
+ *
14
+ * Zod says what the additions *are*. The checks that are claims about one
15
+ * field against another — a search list naming a date, a placement naming a
16
+ * screen nobody declared — are `dataProblems` below, with a code each, so an
17
+ * import report can say which collection and which field, not just "invalid".
18
+ */
19
+ declare const placementSettingSchema: z.ZodObject<{
20
+ type: z.ZodEnum<{
21
+ string: "string";
22
+ url: "url";
23
+ }>;
24
+ label: z.ZodString;
25
+ required: z.ZodOptional<z.ZodBoolean>;
26
+ placeholder: z.ZodOptional<z.ZodString>;
27
+ }, z.core.$strip>;
28
+ export type PlacementSettingSpec = z.infer<typeof placementSettingSchema>;
4
29
  /** Most custom tools one app may declare (A3-F08). */
5
30
  export declare const MAX_CUSTOM_TOOLS = 20;
6
31
  /** A tool name the model and a policy row can both use as it is. */
@@ -28,6 +53,15 @@ declare const extensionShape: {
28
53
  screen: z.ZodString;
29
54
  label: z.ZodOptional<z.ZodString>;
30
55
  icon: z.ZodOptional<z.ZodString>;
56
+ settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
57
+ type: z.ZodEnum<{
58
+ string: "string";
59
+ url: "url";
60
+ }>;
61
+ label: z.ZodString;
62
+ required: z.ZodOptional<z.ZodBoolean>;
63
+ placeholder: z.ZodOptional<z.ZodString>;
64
+ }, z.core.$strip>>>;
31
65
  }, z.core.$strip>>>;
32
66
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
33
67
  schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
@@ -122,6 +156,15 @@ export declare const manifestExtensionsSchema: z.ZodObject<{
122
156
  screen: z.ZodString;
123
157
  label: z.ZodOptional<z.ZodString>;
124
158
  icon: z.ZodOptional<z.ZodString>;
159
+ settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
160
+ type: z.ZodEnum<{
161
+ string: "string";
162
+ url: "url";
163
+ }>;
164
+ label: z.ZodString;
165
+ required: z.ZodOptional<z.ZodBoolean>;
166
+ placeholder: z.ZodOptional<z.ZodString>;
167
+ }, z.core.$strip>>>;
125
168
  }, z.core.$strip>>>;
126
169
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
127
170
  schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
@@ -191,6 +234,15 @@ export declare const storedExtensionsSchema: z.ZodObject<{
191
234
  screen: z.ZodString;
192
235
  label: z.ZodOptional<z.ZodString>;
193
236
  icon: z.ZodOptional<z.ZodString>;
237
+ settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
238
+ type: z.ZodEnum<{
239
+ string: "string";
240
+ url: "url";
241
+ }>;
242
+ label: z.ZodString;
243
+ required: z.ZodOptional<z.ZodBoolean>;
244
+ placeholder: z.ZodOptional<z.ZodString>;
245
+ }, z.core.$strip>>>;
194
246
  }, z.core.$strip>>>;
195
247
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
196
248
  schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
@@ -288,6 +340,15 @@ export declare const appManifestSchema: z.ZodObject<{
288
340
  screen: z.ZodString;
289
341
  label: z.ZodOptional<z.ZodString>;
290
342
  icon: z.ZodOptional<z.ZodString>;
343
+ settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
344
+ type: z.ZodEnum<{
345
+ string: "string";
346
+ url: "url";
347
+ }>;
348
+ label: z.ZodString;
349
+ required: z.ZodOptional<z.ZodBoolean>;
350
+ placeholder: z.ZodOptional<z.ZodString>;
351
+ }, z.core.$strip>>>;
291
352
  }, z.core.$strip>>>;
292
353
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
293
354
  schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
package/src/schema.js CHANGED
@@ -18,11 +18,18 @@ export { COLOUR_TOKENS, FIELD_LIMITS, parseFieldType, RESERVED_FIELDS, structure
18
18
  * screen nobody declared — are `dataProblems` below, with a code each, so an
19
19
  * import report can say which collection and which field, not just "invalid".
20
20
  */
21
+ const placementSettingSchema = z.object({
22
+ type: z.enum(['string', 'url']),
23
+ label: z.string().min(1).max(60),
24
+ required: z.boolean().optional(),
25
+ placeholder: z.string().max(200).optional(),
26
+ });
21
27
  const placementSchema = z.object({
22
28
  kind: z.enum(['project-tab', 'project-sidebar', 'workspace-sidebar']),
23
29
  screen: z.string().min(1).max(FIELD_LIMITS.nameChars),
24
30
  label: z.string().min(1).max(60).optional(),
25
31
  icon: z.string().max(60).optional(),
32
+ settings: z.record(z.string().regex(FIELD_NAME), placementSettingSchema).optional(),
26
33
  });
27
34
  const collectionSchema = z.object({
28
35
  /** Field name to type, in the manifest's spelling (`"member?"`, `["todo","done"]`). */