@capybara-hq/plugin-sdk 0.1.0-rc.2 → 0.1.0-rc.20

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.
Files changed (104) hide show
  1. package/README.md +1 -1
  2. package/agent-docs/agent-templates.md +59 -0
  3. package/agent-docs/concepts.md +63 -0
  4. package/agent-docs/connector-templates.md +48 -0
  5. package/agent-docs/extension-points/channel.md +15 -0
  6. package/agent-docs/extension-points/config-source.md +15 -0
  7. package/agent-docs/extension-points/connector.md +15 -0
  8. package/agent-docs/extension-points/context.md +15 -0
  9. package/agent-docs/extension-points/counter.md +15 -0
  10. package/agent-docs/extension-points/directory.md +15 -0
  11. package/agent-docs/extension-points/file-preview.md +15 -0
  12. package/agent-docs/extension-points/identity-source.md +15 -0
  13. package/agent-docs/extension-points/model-provider.md +15 -0
  14. package/agent-docs/extension-points/object-store.md +15 -0
  15. package/agent-docs/extension-points/sandbox.md +15 -0
  16. package/agent-docs/extension-points/secret-store.md +15 -0
  17. package/agent-docs/extension-points/web-fetch.md +15 -0
  18. package/agent-docs/extension-points/web-search.md +15 -0
  19. package/agent-docs/extensions.md +88 -0
  20. package/agent-docs/plugin-format.md +100 -0
  21. package/agent-docs/setup.md +46 -0
  22. package/agent-docs/skills.md +44 -0
  23. package/agent-docs/tool-naming.md +21 -0
  24. package/dist/agent-template.d.ts +96 -2
  25. package/dist/agent-template.js +381 -3
  26. package/dist/bootstrap.d.ts +15 -1
  27. package/dist/bootstrap.js +17 -1
  28. package/dist/cards.d.ts +39 -5
  29. package/dist/cards.js +70 -11
  30. package/dist/channel.d.ts +20 -1
  31. package/dist/client-css.d.ts +36 -0
  32. package/dist/client-css.js +326 -0
  33. package/dist/client-section.d.ts +35 -0
  34. package/dist/client-section.js +133 -0
  35. package/dist/config-ui.d.ts +24 -1
  36. package/dist/config-ui.js +89 -11
  37. package/dist/connector-auth.d.ts +2 -0
  38. package/dist/connector-auth.js +15 -0
  39. package/dist/context.d.ts +40 -0
  40. package/dist/context.js +2 -0
  41. package/dist/ctx.d.ts +86 -4
  42. package/dist/define-extension.d.ts +5 -1
  43. package/dist/define-extension.js +1 -0
  44. package/dist/dev-hosts.d.ts +6 -0
  45. package/dist/dev-hosts.js +48 -0
  46. package/dist/device-protocol.d.ts +260 -0
  47. package/dist/device-protocol.js +496 -0
  48. package/dist/directory.d.ts +11 -2
  49. package/dist/extension-point.d.ts +6 -0
  50. package/dist/extension-point.js +19 -14
  51. package/dist/file-preview.d.ts +9 -1
  52. package/dist/hooks.d.ts +111 -15
  53. package/dist/hooks.js +5 -0
  54. package/dist/index.d.ts +18 -1
  55. package/dist/index.js +18 -1
  56. package/dist/marketplace.d.ts +55 -2
  57. package/dist/marketplace.js +73 -3
  58. package/dist/model.d.ts +60 -2
  59. package/dist/model.js +22 -0
  60. package/dist/org-access.d.ts +27 -0
  61. package/dist/org-access.js +35 -0
  62. package/dist/permissions.d.ts +33 -8
  63. package/dist/permissions.js +89 -22
  64. package/dist/plugin-manifest.d.ts +60 -7
  65. package/dist/plugin-manifest.js +178 -7
  66. package/dist/sandbox.d.ts +239 -62
  67. package/dist/sandbox.js +99 -14
  68. package/dist/setup-check.d.ts +115 -0
  69. package/dist/setup-check.js +142 -0
  70. package/dist/setup-guide-parse.d.ts +121 -0
  71. package/dist/setup-guide-parse.js +350 -0
  72. package/dist/setup-guide-render.d.ts +45 -0
  73. package/dist/setup-guide-render.js +351 -0
  74. package/dist/setup-guide.d.ts +94 -0
  75. package/dist/setup-guide.js +336 -0
  76. package/dist/skill-invocation.d.ts +9 -5
  77. package/dist/skill-invocation.js +18 -8
  78. package/dist/skill.d.ts +23 -3
  79. package/dist/skill.js +31 -6
  80. package/dist/theme-assets.d.ts +39 -0
  81. package/dist/theme-assets.js +449 -0
  82. package/dist/theme-readability.d.ts +37 -0
  83. package/dist/theme-readability.js +145 -0
  84. package/dist/theme-tokens.generated.d.ts +275 -0
  85. package/dist/theme-tokens.generated.js +172 -0
  86. package/dist/theme.d.ts +152 -0
  87. package/dist/theme.js +392 -0
  88. package/dist/tool.d.ts +26 -3
  89. package/dist/tool.js +8 -0
  90. package/dist/ui-parts.d.ts +23 -0
  91. package/dist/ui-parts.js +337 -0
  92. package/dist/ui-resolve.d.ts +40 -0
  93. package/dist/ui-resolve.js +54 -0
  94. package/dist/ui-slots.d.ts +55 -0
  95. package/dist/ui-slots.js +247 -0
  96. package/dist/ui.d.ts +143 -37
  97. package/dist/ui.js +65 -5
  98. package/dist/web.d.ts +30 -5
  99. package/package.json +10 -2
  100. package/schemas/bootstrap.v1.schema.json +6 -0
  101. package/schemas/connector-template.v1.schema.json +3 -0
  102. package/schemas/marketplace.v1.schema.json +50 -0
  103. package/schemas/plugin.v1.schema.json +144 -7
  104. package/schemas/theme.v1.schema.json +225 -0
package/dist/web.d.ts CHANGED
@@ -12,10 +12,16 @@ export interface WebSearchResult {
12
12
  /** ISO 8601 date or datetime, when known. */
13
13
  publishedAt?: string;
14
14
  }
15
- /** A web search provider (`web-search@1`). The kernel passes the org's decrypted `orgConfig`. */
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`).
18
+ */
16
19
  export interface WebSearchProvider {
17
- /** False when this org's config lacks what the provider needs. */
18
- configured?(orgConfig: unknown): boolean;
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`).
23
+ */
24
+ configured?(orgConfig: unknown, config?: unknown): boolean;
19
25
  search(args: {
20
26
  query: string;
21
27
  /** Hints only: the kernel filters the results again. */
@@ -23,6 +29,14 @@ export interface WebSearchProvider {
23
29
  blockedDomains?: string[];
24
30
  maxResults: number;
25
31
  orgConfig: unknown;
32
+ /**
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
35
+ * 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.
38
+ */
39
+ config?: unknown;
26
40
  signal: AbortSignal;
27
41
  }): Promise<{
28
42
  results: WebSearchResult[];
@@ -48,12 +62,23 @@ export interface WebFetchPage {
48
62
  * to (an IPv6 address in brackets, as in a URL).
49
63
  */
50
64
  export interface WebFetchProvider {
51
- /** False when this org's config lacks what the provider needs. */
52
- configured?(orgConfig: unknown): boolean;
65
+ /**
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`).
68
+ */
69
+ configured?(orgConfig: unknown, config?: unknown): boolean;
53
70
  fetch(args: {
54
71
  /** Already validated and upgraded by the kernel. */
55
72
  url: string;
56
73
  orgConfig: unknown;
74
+ /**
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
+ * 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
+ */
81
+ config?: unknown;
57
82
  signal: AbortSignal;
58
83
  }): Promise<WebFetchPage>;
59
84
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capybara-hq/plugin-sdk",
3
- "version": "0.1.0-rc.2",
3
+ "version": "0.1.0-rc.20",
4
4
  "description": "Capybara plugin SDK: the types and pure functions plugins are written against",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -17,16 +17,24 @@
17
17
  "types": "./dist/index.d.ts",
18
18
  "import": "./dist/index.js",
19
19
  "default": "./dist/index.js"
20
- }
20
+ },
21
+ "./package.json": "./package.json"
21
22
  },
22
23
  "files": [
23
24
  "dist",
24
25
  "schemas",
26
+ "agent-docs",
25
27
  "README.md",
26
28
  "NOTICE"
27
29
  ],
28
30
  "dependencies": {
31
+ "@types/mdast": "4.0.4",
29
32
  "kysely": "^0.29.6",
33
+ "mdast-util-from-markdown": "2.1.0",
34
+ "mdast-util-gfm": "3.1.0",
35
+ "mdast-util-to-markdown": "2.2.0",
36
+ "micromark-extension-gfm": "3.0.0",
37
+ "saxes": "6.0.0",
30
38
  "semver": "^7.8.5",
31
39
  "yaml": "^2.9.1",
32
40
  "zod": "^4.6.7"
@@ -55,6 +55,9 @@
55
55
  "required": {
56
56
  "type": "boolean"
57
57
  },
58
+ "builtin": {
59
+ "type": "boolean"
60
+ },
58
61
  "source": {
59
62
  "type": "string",
60
63
  "const": "npm"
@@ -94,6 +97,9 @@
94
97
  "required": {
95
98
  "type": "boolean"
96
99
  },
100
+ "builtin": {
101
+ "type": "boolean"
102
+ },
97
103
  "source": {
98
104
  "type": "string",
99
105
  "const": "workspace"
@@ -36,6 +36,9 @@
36
36
  "type": "string",
37
37
  "maxLength": 512
38
38
  },
39
+ "defaultEnabled": {
40
+ "type": "boolean"
41
+ },
39
42
  "template": {
40
43
  "type": "object",
41
44
  "properties": {
@@ -68,6 +68,25 @@
68
68
  "en"
69
69
  ]
70
70
  },
71
+ "displayName": {
72
+ "type": "object",
73
+ "properties": {
74
+ "zh": {
75
+ "type": "string",
76
+ "minLength": 1,
77
+ "maxLength": 100
78
+ },
79
+ "en": {
80
+ "type": "string",
81
+ "minLength": 1,
82
+ "maxLength": 100
83
+ }
84
+ },
85
+ "required": [
86
+ "zh",
87
+ "en"
88
+ ]
89
+ },
71
90
  "version": {
72
91
  "type": "string",
73
92
  "maxLength": 256,
@@ -110,6 +129,37 @@
110
129
  "maxLength": 2000,
111
130
  "pattern": "^https:\\/\\/\\S+$"
112
131
  },
132
+ "icon": {
133
+ "anyOf": [
134
+ {
135
+ "type": "string",
136
+ "maxLength": 2000,
137
+ "pattern": "^https:\\/\\/[^\\s?#]+\\.(?:[sS][vV][gG]|[pP][nN][gG])(?:\\?[^\\s#]*)?$"
138
+ },
139
+ {
140
+ "type": "string",
141
+ "maxLength": 512,
142
+ "pattern": "^\\.\\/[^\\s?#]+\\.(?:[sS][vV][gG]|[pP][nN][gG])$"
143
+ }
144
+ ]
145
+ },
146
+ "deprecated": {
147
+ "anyOf": [
148
+ {
149
+ "type": "boolean"
150
+ },
151
+ {
152
+ "type": "object",
153
+ "properties": {
154
+ "reason": {
155
+ "type": "string",
156
+ "minLength": 1,
157
+ "maxLength": 280
158
+ }
159
+ }
160
+ }
161
+ ]
162
+ },
113
163
  "source": {
114
164
  "anyOf": [
115
165
  {
@@ -28,10 +28,35 @@
28
28
  "pattern": "\\S"
29
29
  },
30
30
  "description": {
31
- "type": "string",
32
- "minLength": 1,
33
- "maxLength": 1024,
34
- "pattern": "\\S"
31
+ "anyOf": [
32
+ {
33
+ "type": "string",
34
+ "minLength": 1,
35
+ "maxLength": 1024,
36
+ "pattern": "\\S"
37
+ },
38
+ {
39
+ "type": "object",
40
+ "properties": {
41
+ "en": {
42
+ "type": "string",
43
+ "minLength": 1,
44
+ "maxLength": 1024,
45
+ "pattern": "\\S"
46
+ },
47
+ "zh": {
48
+ "type": "string",
49
+ "minLength": 1,
50
+ "maxLength": 1024,
51
+ "pattern": "\\S"
52
+ }
53
+ },
54
+ "required": [
55
+ "en"
56
+ ],
57
+ "additionalProperties": false
58
+ }
59
+ ]
35
60
  },
36
61
  "displayName": {
37
62
  "type": "object",
@@ -113,9 +138,6 @@
113
138
  "minLength": 3,
114
139
  "maxLength": 512,
115
140
  "pattern": "^\\.\\/"
116
- },
117
- "pinned": {
118
- "type": "boolean"
119
141
  }
120
142
  },
121
143
  "required": [
@@ -169,6 +191,75 @@
169
191
  "additionalProperties": false
170
192
  }
171
193
  },
194
+ "themes": {
195
+ "maxItems": 10,
196
+ "type": "array",
197
+ "items": {
198
+ "type": "object",
199
+ "properties": {
200
+ "path": {
201
+ "type": "string",
202
+ "minLength": 3,
203
+ "maxLength": 512,
204
+ "pattern": "^\\.\\/"
205
+ }
206
+ },
207
+ "required": [
208
+ "path"
209
+ ],
210
+ "additionalProperties": false
211
+ }
212
+ },
213
+ "setupGuides": {
214
+ "maxItems": 8,
215
+ "type": "array",
216
+ "items": {
217
+ "type": "object",
218
+ "properties": {
219
+ "id": {
220
+ "type": "string",
221
+ "pattern": "^[a-z0-9][a-z0-9-]{0,63}$"
222
+ },
223
+ "place": {
224
+ "type": "string",
225
+ "enum": [
226
+ "channel-connection",
227
+ "connector-template"
228
+ ]
229
+ },
230
+ "template": {
231
+ "type": "string",
232
+ "pattern": "^[a-z0-9][a-z0-9-]{0,63}$"
233
+ }
234
+ },
235
+ "required": [
236
+ "id",
237
+ "place"
238
+ ],
239
+ "additionalProperties": false
240
+ }
241
+ },
242
+ "suggestedAppearance": {
243
+ "type": "object",
244
+ "properties": {
245
+ "theme": {
246
+ "type": "string",
247
+ "pattern": "^[a-z0-9][a-z0-9-]{0,63}$"
248
+ },
249
+ "replacements": {
250
+ "type": "object",
251
+ "propertyNames": {
252
+ "type": "string",
253
+ "maxLength": 100
254
+ },
255
+ "additionalProperties": {
256
+ "type": "string",
257
+ "maxLength": 100
258
+ }
259
+ }
260
+ },
261
+ "additionalProperties": false
262
+ },
172
263
  "extension": {
173
264
  "type": "object",
174
265
  "properties": {
@@ -330,6 +421,52 @@
330
421
  }
331
422
  },
332
423
  "additionalProperties": false
424
+ },
425
+ "client": {
426
+ "type": "object",
427
+ "properties": {
428
+ "entry": {
429
+ "type": "string",
430
+ "maxLength": 512
431
+ },
432
+ "styles": {
433
+ "maxItems": 64,
434
+ "type": "array",
435
+ "items": {
436
+ "type": "string",
437
+ "maxLength": 512
438
+ }
439
+ },
440
+ "assets": {
441
+ "maxItems": 256,
442
+ "type": "array",
443
+ "items": {
444
+ "type": "string",
445
+ "maxLength": 512
446
+ }
447
+ },
448
+ "integrity": {
449
+ "type": "object",
450
+ "propertyNames": {
451
+ "type": "string",
452
+ "maxLength": 512
453
+ },
454
+ "additionalProperties": {
455
+ "type": "string",
456
+ "maxLength": 128
457
+ }
458
+ },
459
+ "apiVersion": {
460
+ "type": "integer",
461
+ "minimum": 1,
462
+ "maximum": 9007199254740991
463
+ }
464
+ },
465
+ "required": [
466
+ "integrity",
467
+ "apiVersion"
468
+ ],
469
+ "additionalProperties": false
333
470
  }
334
471
  },
335
472
  "required": [
@@ -0,0 +1,225 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://capybarahq.com/schemas/theme.v1.schema.json",
4
+ "title": "Capybara theme file themes/<id>.json",
5
+ "type": "object",
6
+ "properties": {
7
+ "$schema": {
8
+ "type": "string",
9
+ "maxLength": 512
10
+ },
11
+ "name": {
12
+ "type": "object",
13
+ "properties": {
14
+ "zh": {
15
+ "type": "string",
16
+ "minLength": 1,
17
+ "maxLength": 100,
18
+ "pattern": "\\S"
19
+ },
20
+ "en": {
21
+ "type": "string",
22
+ "minLength": 1,
23
+ "maxLength": 100,
24
+ "pattern": "\\S"
25
+ }
26
+ },
27
+ "required": [
28
+ "zh",
29
+ "en"
30
+ ],
31
+ "additionalProperties": false
32
+ },
33
+ "description": {
34
+ "type": "object",
35
+ "properties": {
36
+ "en": {
37
+ "type": "string",
38
+ "minLength": 1,
39
+ "maxLength": 1024,
40
+ "pattern": "\\S"
41
+ },
42
+ "zh": {
43
+ "type": "string",
44
+ "minLength": 1,
45
+ "maxLength": 1024,
46
+ "pattern": "\\S"
47
+ }
48
+ },
49
+ "required": [
50
+ "en"
51
+ ],
52
+ "additionalProperties": false
53
+ },
54
+ "schemes": {
55
+ "type": "object",
56
+ "properties": {
57
+ "dark": {
58
+ "type": "object",
59
+ "properties": {
60
+ "color": {
61
+ "type": "object",
62
+ "propertyNames": {
63
+ "type": "string",
64
+ "maxLength": 64
65
+ },
66
+ "additionalProperties": {
67
+ "type": "string",
68
+ "maxLength": 256
69
+ }
70
+ },
71
+ "shadow": {
72
+ "type": "object",
73
+ "propertyNames": {
74
+ "type": "string",
75
+ "maxLength": 64
76
+ },
77
+ "additionalProperties": {
78
+ "type": "string",
79
+ "maxLength": 256
80
+ }
81
+ },
82
+ "radius": {
83
+ "type": "object",
84
+ "properties": {
85
+ "sm": {
86
+ "type": "integer",
87
+ "minimum": 0,
88
+ "maximum": 16
89
+ },
90
+ "md": {
91
+ "type": "integer",
92
+ "minimum": 0,
93
+ "maximum": 16
94
+ },
95
+ "bubble": {
96
+ "type": "integer",
97
+ "minimum": 0,
98
+ "maximum": 16
99
+ }
100
+ },
101
+ "additionalProperties": false
102
+ }
103
+ },
104
+ "additionalProperties": false
105
+ },
106
+ "light": {
107
+ "type": "object",
108
+ "properties": {
109
+ "color": {
110
+ "type": "object",
111
+ "propertyNames": {
112
+ "type": "string",
113
+ "maxLength": 64
114
+ },
115
+ "additionalProperties": {
116
+ "type": "string",
117
+ "maxLength": 256
118
+ }
119
+ },
120
+ "shadow": {
121
+ "type": "object",
122
+ "propertyNames": {
123
+ "type": "string",
124
+ "maxLength": 64
125
+ },
126
+ "additionalProperties": {
127
+ "type": "string",
128
+ "maxLength": 256
129
+ }
130
+ },
131
+ "radius": {
132
+ "type": "object",
133
+ "properties": {
134
+ "sm": {
135
+ "type": "integer",
136
+ "minimum": 0,
137
+ "maximum": 16
138
+ },
139
+ "md": {
140
+ "type": "integer",
141
+ "minimum": 0,
142
+ "maximum": 16
143
+ },
144
+ "bubble": {
145
+ "type": "integer",
146
+ "minimum": 0,
147
+ "maximum": 16
148
+ }
149
+ },
150
+ "additionalProperties": false
151
+ }
152
+ },
153
+ "additionalProperties": false
154
+ }
155
+ },
156
+ "additionalProperties": false
157
+ },
158
+ "fonts": {
159
+ "maxItems": 8,
160
+ "type": "array",
161
+ "items": {
162
+ "type": "object",
163
+ "properties": {
164
+ "family": {
165
+ "type": "string",
166
+ "pattern": "^[A-Za-z0-9 -]{1,64}$"
167
+ },
168
+ "file": {
169
+ "type": "string",
170
+ "maxLength": 512
171
+ },
172
+ "weight": {
173
+ "type": "integer",
174
+ "minimum": 100,
175
+ "maximum": 900
176
+ },
177
+ "style": {
178
+ "type": "string",
179
+ "enum": [
180
+ "normal",
181
+ "italic"
182
+ ]
183
+ },
184
+ "role": {
185
+ "type": "string",
186
+ "enum": [
187
+ "prose",
188
+ "mono"
189
+ ]
190
+ }
191
+ },
192
+ "required": [
193
+ "family",
194
+ "file",
195
+ "weight",
196
+ "role"
197
+ ],
198
+ "additionalProperties": false
199
+ }
200
+ },
201
+ "logo": {
202
+ "type": "object",
203
+ "properties": {
204
+ "mark": {
205
+ "type": "string",
206
+ "maxLength": 512
207
+ },
208
+ "wordmark": {
209
+ "type": "string",
210
+ "pattern": "\\S"
211
+ },
212
+ "favicon": {
213
+ "type": "string",
214
+ "maxLength": 512
215
+ }
216
+ },
217
+ "additionalProperties": false
218
+ }
219
+ },
220
+ "required": [
221
+ "name",
222
+ "schemes"
223
+ ],
224
+ "additionalProperties": false
225
+ }