@openbrf/plugin-sdk 0.0.0-stage → 1.2.0

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 (134) hide show
  1. package/LICENSE +661 -0
  2. package/LICENSE-EXCEPTION.md +28 -0
  3. package/README.md +94 -2
  4. package/dist/abort-signal.d.ts +23 -0
  5. package/dist/abort-signal.d.ts.map +1 -0
  6. package/dist/abort-signal.js +2 -0
  7. package/dist/abort-signal.js.map +1 -0
  8. package/dist/action-refusal.d.ts +101 -0
  9. package/dist/action-refusal.d.ts.map +1 -0
  10. package/dist/action-refusal.js +96 -0
  11. package/dist/action-refusal.js.map +1 -0
  12. package/dist/action-schema.d.ts +42 -0
  13. package/dist/action-schema.d.ts.map +1 -0
  14. package/dist/action-schema.js +67 -0
  15. package/dist/action-schema.js.map +1 -0
  16. package/dist/actions.d.ts +287 -0
  17. package/dist/actions.d.ts.map +1 -0
  18. package/dist/actions.js +68 -0
  19. package/dist/actions.js.map +1 -0
  20. package/dist/api-version.d.ts +23 -0
  21. package/dist/api-version.d.ts.map +1 -0
  22. package/dist/api-version.js +27 -0
  23. package/dist/api-version.js.map +1 -0
  24. package/dist/blocks.d.ts +310 -0
  25. package/dist/blocks.d.ts.map +1 -0
  26. package/dist/blocks.js +185 -0
  27. package/dist/blocks.js.map +1 -0
  28. package/dist/catalog.d.ts +707 -0
  29. package/dist/catalog.d.ts.map +1 -0
  30. package/dist/catalog.js +567 -0
  31. package/dist/catalog.js.map +1 -0
  32. package/dist/define-plugin.d.ts +14 -0
  33. package/dist/define-plugin.d.ts.map +1 -0
  34. package/dist/define-plugin.js +15 -0
  35. package/dist/define-plugin.js.map +1 -0
  36. package/dist/entitlements.d.ts +117 -0
  37. package/dist/entitlements.d.ts.map +1 -0
  38. package/dist/entitlements.js +62 -0
  39. package/dist/entitlements.js.map +1 -0
  40. package/dist/extensions.d.ts +183 -0
  41. package/dist/extensions.d.ts.map +1 -0
  42. package/dist/extensions.js +67 -0
  43. package/dist/extensions.js.map +1 -0
  44. package/dist/finances.d.ts +294 -0
  45. package/dist/finances.d.ts.map +1 -0
  46. package/dist/finances.js +56 -0
  47. package/dist/finances.js.map +1 -0
  48. package/dist/findings.d.ts +156 -0
  49. package/dist/findings.d.ts.map +1 -0
  50. package/dist/findings.js +146 -0
  51. package/dist/findings.js.map +1 -0
  52. package/dist/host.d.ts +827 -0
  53. package/dist/host.d.ts.map +1 -0
  54. package/dist/host.js +80 -0
  55. package/dist/host.js.map +1 -0
  56. package/dist/imports.d.ts +104 -0
  57. package/dist/imports.d.ts.map +1 -0
  58. package/dist/imports.js +70 -0
  59. package/dist/imports.js.map +1 -0
  60. package/dist/index.d.ts +34 -0
  61. package/dist/index.d.ts.map +1 -0
  62. package/dist/index.js +31 -0
  63. package/dist/index.js.map +1 -0
  64. package/dist/integrity.d.ts +38 -0
  65. package/dist/integrity.d.ts.map +1 -0
  66. package/dist/integrity.js +105 -0
  67. package/dist/integrity.js.map +1 -0
  68. package/dist/localized-text.d.ts +18 -0
  69. package/dist/localized-text.d.ts.map +1 -0
  70. package/dist/localized-text.js +17 -0
  71. package/dist/localized-text.js.map +1 -0
  72. package/dist/manifest.d.ts +1122 -0
  73. package/dist/manifest.d.ts.map +1 -0
  74. package/dist/manifest.js +1118 -0
  75. package/dist/manifest.js.map +1 -0
  76. package/dist/module.d.ts +35 -0
  77. package/dist/module.d.ts.map +1 -0
  78. package/dist/module.js +2 -0
  79. package/dist/module.js.map +1 -0
  80. package/dist/package-check.d.ts +66 -0
  81. package/dist/package-check.d.ts.map +1 -0
  82. package/dist/package-check.js +755 -0
  83. package/dist/package-check.js.map +1 -0
  84. package/dist/permissions.d.ts +224 -0
  85. package/dist/permissions.d.ts.map +1 -0
  86. package/dist/permissions.js +277 -0
  87. package/dist/permissions.js.map +1 -0
  88. package/dist/recipients.d.ts +139 -0
  89. package/dist/recipients.d.ts.map +1 -0
  90. package/dist/recipients.js +223 -0
  91. package/dist/recipients.js.map +1 -0
  92. package/dist/records.d.ts +130 -0
  93. package/dist/records.d.ts.map +1 -0
  94. package/dist/records.js +85 -0
  95. package/dist/records.js.map +1 -0
  96. package/dist/require-capability.d.ts +37 -0
  97. package/dist/require-capability.d.ts.map +1 -0
  98. package/dist/require-capability.js +88 -0
  99. package/dist/require-capability.js.map +1 -0
  100. package/dist/settings-schema.d.ts +130 -0
  101. package/dist/settings-schema.d.ts.map +1 -0
  102. package/dist/settings-schema.js +272 -0
  103. package/dist/settings-schema.js.map +1 -0
  104. package/dist/standard-schema.d.ts +43 -0
  105. package/dist/standard-schema.d.ts.map +1 -0
  106. package/dist/standard-schema.js +2 -0
  107. package/dist/standard-schema.js.map +1 -0
  108. package/package.json +55 -3
  109. package/src/abort-signal.ts +22 -0
  110. package/src/action-refusal.ts +178 -0
  111. package/src/action-schema.ts +89 -0
  112. package/src/actions.ts +344 -0
  113. package/src/api-version.ts +28 -0
  114. package/src/blocks.ts +289 -0
  115. package/src/catalog.ts +679 -0
  116. package/src/define-plugin.ts +18 -0
  117. package/src/entitlements.ts +150 -0
  118. package/src/extensions.ts +212 -0
  119. package/src/finances.ts +317 -0
  120. package/src/findings.ts +163 -0
  121. package/src/host.ts +894 -0
  122. package/src/imports.ts +135 -0
  123. package/src/index.ts +316 -0
  124. package/src/integrity.ts +125 -0
  125. package/src/localized-text.ts +19 -0
  126. package/src/manifest.ts +1412 -0
  127. package/src/module.ts +38 -0
  128. package/src/package-check.ts +894 -0
  129. package/src/permissions.ts +295 -0
  130. package/src/recipients.ts +294 -0
  131. package/src/records.ts +172 -0
  132. package/src/require-capability.ts +106 -0
  133. package/src/settings-schema.ts +334 -0
  134. package/src/standard-schema.ts +39 -0
@@ -0,0 +1,287 @@
1
+ import type { StandardSchemaV1 } from "./standard-schema.ts";
2
+ /**
3
+ * What the platform can be asked to do, declared once and dispatched through
4
+ * one place: an action (atgard).
5
+ *
6
+ * An action is a name, an input schema, the single capability it needs, what it
7
+ * does to the records, which categories of personal data it can touch, and which
8
+ * surfaces it may be offered on. The registry checks the calling person's
9
+ * capability on every call rather than trusting the caller, so registering an
10
+ * action is never a permission of its own - it is a way of reaching something
11
+ * the caller could already do.
12
+ *
13
+ * A core feature registers its own. A plugin registers the ones its manifest
14
+ * declared and the board consented to, and they disappear with the plugin.
15
+ *
16
+ * Swedish domain terms follow GLOSSARY.md.
17
+ */
18
+ export declare const ACTION_EFFECTS: readonly ["read", "write", "delete"];
19
+ export type ActionEffect = (typeof ACTION_EFFECTS)[number];
20
+ /**
21
+ * Where an action may be offered.
22
+ *
23
+ * "ui" means in-process only: the platform's own screens and a plugin's own
24
+ * route. The other two are the ones a board switches on deliberately.
25
+ */
26
+ export declare const ACTION_SURFACES: readonly ["ui", "mcp", "ai"];
27
+ export type ActionSurface = (typeof ACTION_SURFACES)[number];
28
+ /**
29
+ * What an action can touch.
30
+ *
31
+ * The first thirteen are PERSONAL_DATA_CATEGORIES from @openbrf/shared, in
32
+ * order, which this package deliberately does not depend on; the API side
33
+ * asserts the prefix equality, because it is the only place that can import
34
+ * both. "protected" is this list's own and marks an action that can return a
35
+ * field of a person carrying protected personal data (skyddade
36
+ * personuppgifter): it is the value the registry refuses to expose to a
37
+ * connected app or to the AI package at all.
38
+ */
39
+ export declare const ACTION_PERSONAL_DATA: readonly ["name", "apartment", "residency", "email", "phone", "postalAddress", "personalIdentityNumber", "account", "financial", "health", "photograph", "freeText", "auditTrail", "protected"];
40
+ export type ActionPersonalData = (typeof ACTION_PERSONAL_DATA)[number];
41
+ /**
42
+ * What a public action name may look like.
43
+ *
44
+ * The intersection of three separate limits: what an MCP tools/list entry
45
+ * allows, what a model API allows (no dots), and what stays readable in a
46
+ * directory review (64 characters).
47
+ */
48
+ export declare const ACTION_NAME_PATTERN: RegExp;
49
+ /** Whether trying again could ever work, and after what. */
50
+ export type ActionRetry = "never" | "after-edit" | "after-backoff";
51
+ /** What a refusal means for a caller that is a model rather than a person. */
52
+ export interface ActionErrorSpec {
53
+ /** The machine-readable reason the handler raises. */
54
+ readonly reason: string;
55
+ /** Whether trying again could ever work, and after what. */
56
+ readonly retry: ActionRetry;
57
+ /** The sentence a person is shown, as an i18n key. */
58
+ readonly messageKey: string;
59
+ }
60
+ /**
61
+ * The request a plugin's own route received.
62
+ *
63
+ * Opaque on purpose: the host recognises the request it authenticated by its
64
+ * identity, which nothing on it can copy, so a plugin passes the request it was
65
+ * handed straight through and cannot construct one. That is what stops a plugin
66
+ * naming a person it was not given.
67
+ *
68
+ * It speaks for its person only while the route is serving it. Once the
69
+ * response is sent the host refuses it, so a request kept for later names
70
+ * nobody.
71
+ */
72
+ export type ActionRequest = object;
73
+ /** The lowercase channel vocabulary. The registry maps it to the audit channel. */
74
+ export declare const ACTION_CHANNELS: readonly ["web", "mcp", "ai", "system", "plugin"];
75
+ export type ActionChannel = (typeof ACTION_CHANNELS)[number];
76
+ /**
77
+ * Who is acting.
78
+ *
79
+ * The person, and the capabilities the registry re-derived for this call. No
80
+ * email, no name, no roles: a handler that needs to decide what an audience may
81
+ * see reads the capability list, and a handler that does not need it is not
82
+ * given a person's details to leak.
83
+ */
84
+ export interface ActionPrincipal {
85
+ readonly personId: string;
86
+ readonly capabilities: readonly string[];
87
+ }
88
+ /** The connected app that acted, when one did. Both hosts, never the token. */
89
+ export interface ActionClient {
90
+ readonly clientId: string;
91
+ readonly clientHost: string | null;
92
+ }
93
+ /** What a handler is told about the call. Built by the host, never by a caller. */
94
+ export interface ActionContext {
95
+ readonly principal: ActionPrincipal;
96
+ readonly channel: ActionChannel;
97
+ readonly client?: ActionClient;
98
+ /**
99
+ * The plugin whose route dispatched the call, when one did, by its manifest
100
+ * id. Set by the host from the plugin it serves, whatever the channel.
101
+ */
102
+ readonly pluginId?: string;
103
+ /**
104
+ * The pending change this call confirms, when it confirms one.
105
+ *
106
+ * A confirmed call is the confirming person's own, on `web`; this is what
107
+ * ties its audit entry back to the proposal, and to the channel and the app
108
+ * the proposal came through.
109
+ */
110
+ readonly pendingChangeId?: string;
111
+ readonly requestId: string;
112
+ readonly now: Date;
113
+ }
114
+ export interface ActionDefinition<Input = unknown, Output = unknown> {
115
+ readonly name: string;
116
+ readonly titleKey: string;
117
+ readonly descriptionKey: string;
118
+ readonly group: string;
119
+ readonly groupTitleKey: string;
120
+ /** Exactly one core capability, by name. */
121
+ readonly capability: string;
122
+ readonly effect: ActionEffect;
123
+ readonly idempotent: boolean;
124
+ /**
125
+ * True when the act adds and overwrites nothing a person wrote.
126
+ *
127
+ * It is what separates a create from an update, and the annotation mapping
128
+ * reads it: MCP's destructiveHint defaults to true, so a non-read action has
129
+ * to say for itself that it destroys nothing.
130
+ */
131
+ readonly additive: boolean;
132
+ readonly needsConfirmation: boolean;
133
+ /** True when the handler reaches a system outside this instance. */
134
+ readonly openWorld: boolean;
135
+ /** Never empty by convention: an action that touches none says []. */
136
+ readonly personalData: readonly ActionPersonalData[];
137
+ /** Opt-in allowlist. An empty array means the action is offered nowhere. */
138
+ readonly surfaces: readonly ActionSurface[];
139
+ /** Every domain refusal the handler can raise, for the caller to act on. */
140
+ readonly errors: readonly ActionErrorSpec[];
141
+ readonly deprecatedAliases?: readonly string[];
142
+ /** Every object in it, at every depth, must refuse unknown keys. */
143
+ readonly input: StandardSchemaV1<unknown, Input>;
144
+ readonly output: StandardSchemaV1<unknown, Output>;
145
+ readonly handler: (input: Input, context: ActionContext) => Promise<Output>;
146
+ }
147
+ /**
148
+ * What a plugin hands the host: the id its manifest declared, and the rest.
149
+ *
150
+ * The capability, the effect, the personal-data categories and the surfaces are
151
+ * manifest data and are not repeated here. The loader's rule is that nothing
152
+ * which can refuse a plugin may run after the code that executes it, and the
153
+ * install consent screen renders from the catalog before anything is
154
+ * downloaded - so what the board consents to cannot come from the bundle.
155
+ */
156
+ export interface PluginActionRegistration {
157
+ readonly id: string;
158
+ readonly definition: Omit<ActionDefinition, "capability" | "effect" | "personalData" | "surfaces">;
159
+ }
160
+ /** Narrows what a plugin's route offers the request it is serving. */
161
+ export interface PluginActionFilter {
162
+ readonly surface?: ActionSurface;
163
+ readonly group?: string;
164
+ }
165
+ /** One action as a caller sees it, with its text already in the right language. */
166
+ export interface ActionSummary {
167
+ readonly name: string;
168
+ readonly title: string;
169
+ readonly description: string;
170
+ readonly titleKey: string;
171
+ readonly descriptionKey: string;
172
+ readonly group: string;
173
+ readonly groupTitle: string;
174
+ /**
175
+ * The key behind `groupTitle`, alongside the two above.
176
+ *
177
+ * Both forms travel for the reason `titleKey` does: the resolved string is
178
+ * for a caller with no translations of its own - a connected app, a model -
179
+ * while a screen in this product translates the key itself. The interface's
180
+ * language and the language a request happens to declare are not the same
181
+ * thing, so a screen rendering the resolved string can show one heading in
182
+ * the browser's language above a page in the association's.
183
+ */
184
+ readonly groupTitleKey: string;
185
+ readonly capability: string;
186
+ readonly effect: ActionEffect;
187
+ readonly idempotent: boolean;
188
+ readonly additive: boolean;
189
+ readonly needsConfirmation: boolean;
190
+ readonly openWorld: boolean;
191
+ readonly personalData: readonly ActionPersonalData[];
192
+ readonly surfaces: readonly ActionSurface[];
193
+ readonly errors: readonly ActionErrorSpec[];
194
+ }
195
+ /**
196
+ * What proposing a change answers with.
197
+ *
198
+ * Nothing has run. The change waits, for a week at most, until the person whose
199
+ * request proposed it confirms or rejects it on the platform's own screen at
200
+ * `path`, which a plugin's view links to. A plugin cannot confirm one.
201
+ */
202
+ export interface PendingChangeReceipt {
203
+ readonly id: string;
204
+ readonly expiresAt: Date;
205
+ /** The preview, on the platform's own screen, relative to the origin. */
206
+ readonly path: string;
207
+ }
208
+ /**
209
+ * One action as a plugin is offered it: the summary, and the JSON Schema
210
+ * (draft 2020-12) of what it takes and what it returns.
211
+ *
212
+ * What an MCP connector puts in `tools/list` and what a model is told a tool
213
+ * accepts. The input schema is the one `invoke` validates against, converted
214
+ * as the HTTP catalogue converts it, so a tool is described by the rule it is
215
+ * held to. Each listing builds both afresh: changing one changes nothing the
216
+ * host holds or hands anybody else.
217
+ */
218
+ export interface ActionWithSchemas extends ActionSummary {
219
+ readonly inputSchema: Record<string, unknown>;
220
+ readonly outputSchema: Record<string, unknown>;
221
+ }
222
+ export interface PluginActions {
223
+ /**
224
+ * Registers an action the manifest declared.
225
+ *
226
+ * Callable from the module factory onwards: a call made that early is
227
+ * buffered until the application is built, because the host object is not
228
+ * bound yet.
229
+ *
230
+ * It does not throw for a registration the host will refuse. An id the
231
+ * manifest never declared, or a schema that cannot be published, is found
232
+ * when the buffer is flushed - long after this call returned - and reaches
233
+ * the board as an `action-refused` finding rather than as an error the
234
+ * factory could have caught. A plugin that wants to know sooner validates
235
+ * its own manifest in its own build.
236
+ */
237
+ register: (registration: PluginActionRegistration) => void;
238
+ /**
239
+ * What this plugin's route may offer the request it is serving, each with
240
+ * its schemas.
241
+ *
242
+ * Filtered by channel, surface, capability, liveness and arming, as `invoke`
243
+ * is, and the schemas are of the actions listed and no others. Token scope
244
+ * (`mcp:read`, `mcp:write`) and read-only mode are decided at `invoke`, which
245
+ * may still refuse a listed action.
246
+ */
247
+ list: (request: ActionRequest, filter?: PluginActionFilter) => Promise<ActionWithSchemas[]>;
248
+ /**
249
+ * Dispatch. The person, the channel and the connected app all come from the
250
+ * request the host authenticated, never from an argument.
251
+ *
252
+ * A refused call rejects with an `ActionRefusal`, whichever of the three
253
+ * ways it was refused - by the registry, over its input or by the service
254
+ * behind it - and `isActionRefusal` recognises one. Anything else it
255
+ * rejects with is a fault rather than an answer.
256
+ */
257
+ invoke: <Output>(request: ActionRequest, name: string, input: unknown) => Promise<Output>;
258
+ /**
259
+ * Holds a write as a pending change instead of running it (ADR 0039).
260
+ *
261
+ * The call is checked as `invoke` would check it before running anything -
262
+ * the action exists and is offered, the person holds its capability, the
263
+ * input fits its schema - and refused the same way. A read cannot be
264
+ * proposed, and nor can an action the platform's own screens are not offered.
265
+ * The person whose request this is then sees the change as a preview and
266
+ * confirms it, and it runs as them at that moment, with every check made
267
+ * again; or rejects it, and nothing runs.
268
+ *
269
+ * Added after `invoke`, so a plugin installed on an older host has to check
270
+ * that it is there before calling it, for the reason `host.actions` gives.
271
+ */
272
+ propose: (request: ActionRequest, name: string, input: unknown) => Promise<PendingChangeReceipt>;
273
+ /**
274
+ * The connected app the request was authenticated with, or null when it
275
+ * arrived on a signed-in session.
276
+ *
277
+ * The app a dispatch on this request is recorded as, read from what the host
278
+ * established when it authenticated the request rather than from the
279
+ * request's own properties, which the plugin can write. A connector asks it
280
+ * before answering on a route that serves connected apps only.
281
+ *
282
+ * Added after `list` and `invoke`, so a plugin must feature-detect it
283
+ * (`host.actions?.client === undefined`) before calling it.
284
+ */
285
+ client: (request: ActionRequest) => ActionClient | null;
286
+ }
287
+ //# sourceMappingURL=actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,cAAc,YAAI,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC;AACnE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,eAAe,YAAI,IAAI,EAAE,KAAK,EAAE,IAAI,CAAU,CAAC;AAC5D,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,YAC/B,MAAM,EACN,WAAW,EACX,WAAW,EACX,OAAO,EACP,OAAO,EACP,eAAe,EACf,wBAAwB,EACxB,SAAS,EACT,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,CACH,CAAC;AACX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvE;;;;;;GAMG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;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChD;AAED,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;;;;OAaG;IACH,QAAQ,EAAE,CAAC,YAAY,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAE3D;;;;;;;;OAQG;IACH,IAAI,EAAE,CACJ,OAAO,EAAE,aAAa,EACtB,MAAM,CAAC,EAAE,kBAAkB,KACxB,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAElC;;;;;;;;OAQG;IACH,MAAM,EAAE,CAAC,MAAM,EACb,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,KACX,OAAO,CAAC,MAAM,CAAC,CAAC;IAErB;;;;;;;;;;;;;OAaG;IACH,OAAO,EAAE,CACP,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,KACX,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEnC;;;;;;;;;;;OAWG;IACH,MAAM,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,YAAY,GAAG,IAAI,CAAC;CACzD"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * What the platform can be asked to do, declared once and dispatched through
3
+ * one place: an action (atgard).
4
+ *
5
+ * An action is a name, an input schema, the single capability it needs, what it
6
+ * does to the records, which categories of personal data it can touch, and which
7
+ * surfaces it may be offered on. The registry checks the calling person's
8
+ * capability on every call rather than trusting the caller, so registering an
9
+ * action is never a permission of its own - it is a way of reaching something
10
+ * the caller could already do.
11
+ *
12
+ * A core feature registers its own. A plugin registers the ones its manifest
13
+ * declared and the board consented to, and they disappear with the plugin.
14
+ *
15
+ * Swedish domain terms follow GLOSSARY.md.
16
+ */
17
+ export const ACTION_EFFECTS = ["read", "write", "delete"];
18
+ /**
19
+ * Where an action may be offered.
20
+ *
21
+ * "ui" means in-process only: the platform's own screens and a plugin's own
22
+ * route. The other two are the ones a board switches on deliberately.
23
+ */
24
+ export const ACTION_SURFACES = ["ui", "mcp", "ai"];
25
+ /**
26
+ * What an action can touch.
27
+ *
28
+ * The first thirteen are PERSONAL_DATA_CATEGORIES from @openbrf/shared, in
29
+ * order, which this package deliberately does not depend on; the API side
30
+ * asserts the prefix equality, because it is the only place that can import
31
+ * both. "protected" is this list's own and marks an action that can return a
32
+ * field of a person carrying protected personal data (skyddade
33
+ * personuppgifter): it is the value the registry refuses to expose to a
34
+ * connected app or to the AI package at all.
35
+ */
36
+ export const ACTION_PERSONAL_DATA = [
37
+ "name",
38
+ "apartment",
39
+ "residency",
40
+ "email",
41
+ "phone",
42
+ "postalAddress",
43
+ "personalIdentityNumber",
44
+ "account",
45
+ "financial",
46
+ "health",
47
+ "photograph",
48
+ "freeText",
49
+ "auditTrail",
50
+ "protected",
51
+ ];
52
+ /**
53
+ * What a public action name may look like.
54
+ *
55
+ * The intersection of three separate limits: what an MCP tools/list entry
56
+ * allows, what a model API allows (no dots), and what stays readable in a
57
+ * directory review (64 characters).
58
+ */
59
+ export const ACTION_NAME_PATTERN = /^[a-z][a-z0-9_]{2,63}$/;
60
+ /** The lowercase channel vocabulary. The registry maps it to the audit channel. */
61
+ export const ACTION_CHANNELS = [
62
+ "web",
63
+ "mcp",
64
+ "ai",
65
+ "system",
66
+ "plugin",
67
+ ];
68
+ //# sourceMappingURL=actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC;AAGnE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAU,CAAC;AAG5D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,MAAM;IACN,WAAW;IACX,WAAW;IACX,OAAO;IACP,OAAO;IACP,eAAe;IACf,wBAAwB;IACxB,SAAS;IACT,WAAW;IACX,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,YAAY;IACZ,WAAW;CACH,CAAC;AAGX;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,wBAAwB,CAAC;AA6B5D,mFAAmF;AACnF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,KAAK;IACL,KAAK;IACL,IAAI;IACJ,QAAQ;IACR,QAAQ;CACA,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The plugin API version.
3
+ *
4
+ * A single integer rather than a semver range, because the gate it guards is
5
+ * binary: a plugin either speaks the contract this host implements or it does
6
+ * not get loaded. A range would invite a plugin to claim ">=1" and then fail
7
+ * at the first call to a method version 2 removed, which is exactly the class
8
+ * of breakage the gate exists to prevent.
9
+ *
10
+ * Additive changes - a new optional manifest field, a new SDK method - keep
11
+ * the number. Anything a plugin built against the old contract could notice
12
+ * raises it, and the host may then support more than one version at a time by
13
+ * listing them in SUPPORTED_PLUGIN_API_VERSIONS.
14
+ */
15
+ export declare const PLUGIN_API_VERSION = 1;
16
+ /**
17
+ * Every version this contract can still load. Kept as a list so a host can
18
+ * carry an old version through a deprecation window without a plugin having
19
+ * to be republished on the day the new one lands.
20
+ */
21
+ export declare const SUPPORTED_PLUGIN_API_VERSIONS: readonly number[];
22
+ export declare function isSupportedApiVersion(apiVersion: number): boolean;
23
+ //# sourceMappingURL=api-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-version.d.ts","sourceRoot":"","sources":["../src/api-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,EAAE,SAAS,MAAM,EAE1D,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAEjE"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The plugin API version.
3
+ *
4
+ * A single integer rather than a semver range, because the gate it guards is
5
+ * binary: a plugin either speaks the contract this host implements or it does
6
+ * not get loaded. A range would invite a plugin to claim ">=1" and then fail
7
+ * at the first call to a method version 2 removed, which is exactly the class
8
+ * of breakage the gate exists to prevent.
9
+ *
10
+ * Additive changes - a new optional manifest field, a new SDK method - keep
11
+ * the number. Anything a plugin built against the old contract could notice
12
+ * raises it, and the host may then support more than one version at a time by
13
+ * listing them in SUPPORTED_PLUGIN_API_VERSIONS.
14
+ */
15
+ export const PLUGIN_API_VERSION = 1;
16
+ /**
17
+ * Every version this contract can still load. Kept as a list so a host can
18
+ * carry an old version through a deprecation window without a plugin having
19
+ * to be republished on the day the new one lands.
20
+ */
21
+ export const SUPPORTED_PLUGIN_API_VERSIONS = [
22
+ PLUGIN_API_VERSION,
23
+ ];
24
+ export function isSupportedApiVersion(apiVersion) {
25
+ return SUPPORTED_PLUGIN_API_VERSIONS.includes(apiVersion);
26
+ }
27
+ //# sourceMappingURL=api-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-version.js","sourceRoot":"","sources":["../src/api-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAEpC;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAsB;IAC9D,kBAAkB;CACnB,CAAC;AAEF,MAAM,UAAU,qBAAqB,CAAC,UAAkB;IACtD,OAAO,6BAA6B,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAC5D,CAAC"}