@deliverd/sdk 0.25.1 → 0.26.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 (47) hide show
  1. package/README.md +65 -0
  2. package/dist/adapters/index.d.ts +4 -0
  3. package/dist/adapters/index.d.ts.map +1 -1
  4. package/dist/adapters/index.js +2 -0
  5. package/dist/adapters/mastra.d.ts +81 -0
  6. package/dist/adapters/mastra.d.ts.map +1 -0
  7. package/dist/adapters/mastra.js +54 -0
  8. package/dist/adapters/muse-spark.d.ts +79 -0
  9. package/dist/adapters/muse-spark.d.ts.map +1 -0
  10. package/dist/adapters/muse-spark.js +59 -0
  11. package/dist/adapters/shared.d.ts +2 -1
  12. package/dist/adapters/shared.d.ts.map +1 -1
  13. package/dist/data-screen.d.ts +233 -0
  14. package/dist/data-screen.d.ts.map +1 -0
  15. package/dist/data-screen.js +389 -0
  16. package/dist/dev.d.ts.map +1 -1
  17. package/dist/dev.js +42 -2
  18. package/dist/governance.d.ts +94 -0
  19. package/dist/governance.d.ts.map +1 -0
  20. package/dist/governance.js +166 -0
  21. package/dist/index.d.ts +27 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +30 -0
  24. package/dist/released.d.ts +1 -1
  25. package/dist/released.d.ts.map +1 -1
  26. package/dist/released.js +1265 -0
  27. package/dist/screen.d.ts +85 -0
  28. package/dist/screen.d.ts.map +1 -0
  29. package/dist/screen.js +69 -0
  30. package/dist/tasks.d.ts +38 -1
  31. package/dist/tasks.d.ts.map +1 -1
  32. package/dist/tasks.js +67 -0
  33. package/dist/types.d.ts +589 -3
  34. package/dist/types.d.ts.map +1 -1
  35. package/package.json +2 -2
  36. package/src/adapters/index.ts +11 -0
  37. package/src/adapters/mastra.ts +118 -0
  38. package/src/adapters/muse-spark.ts +147 -0
  39. package/src/adapters/shared.ts +2 -1
  40. package/src/data-screen.ts +533 -0
  41. package/src/dev.ts +45 -2
  42. package/src/governance.ts +204 -0
  43. package/src/index.ts +43 -0
  44. package/src/released.ts +1265 -0
  45. package/src/screen.ts +144 -0
  46. package/src/tasks.ts +88 -0
  47. package/src/types.ts +577 -3
@@ -0,0 +1,166 @@
1
+ import { listOrCollect } from "./paging.js";
2
+ const enc = encodeURIComponent;
3
+ /**
4
+ * The organisation's register of AI systems. A governed task names one by
5
+ * `aiSystemId` instead of describing it again, and a change of model is
6
+ * recorded here so every task using it is reassessed.
7
+ */
8
+ export class AiSystems {
9
+ http;
10
+ constructor(http) {
11
+ this.http = http;
12
+ }
13
+ /** The register, active and retired, or only one of them. */
14
+ async list(input = {}, signal) {
15
+ const { aiSystems } = await this.http.request({
16
+ method: "GET",
17
+ path: "/ai-systems",
18
+ query: { status: input.status },
19
+ signal,
20
+ });
21
+ return aiSystems;
22
+ }
23
+ /** One system, and the governed tasks that name it. */
24
+ get(id, signal) {
25
+ return this.http.request({ method: "GET", path: `/ai-systems/${enc(id)}`, signal });
26
+ }
27
+ /** Add a system to the register. Digests of its prompt and guardrails, never the text. */
28
+ register(input, signal) {
29
+ return this.http.request({ method: "POST", path: "/ai-systems", body: input, signal });
30
+ }
31
+ /** Change a system's record. An agent may raise its risk but not lower it, and may not retire it. */
32
+ update(id, input, signal) {
33
+ return this.http.request({ method: "PATCH", path: `/ai-systems/${enc(id)}`, body: input, signal });
34
+ }
35
+ /**
36
+ * Record a new provider, model, version, prompt or guardrails (Enterprise).
37
+ * Every governed task using the system is reassessed, and evidence of the
38
+ * old release stops counting.
39
+ */
40
+ recordModelChange(id, input, signal) {
41
+ return this.http.request({
42
+ method: "POST",
43
+ path: `/ai-systems/${enc(id)}/model-change`,
44
+ body: input,
45
+ signal,
46
+ });
47
+ }
48
+ }
49
+ /**
50
+ * AI incidents, and the DORA reports on the major ones. A high or critical
51
+ * incident closes its task's governance gate until a person resolves it in
52
+ * Deliverd; classifying it, and submitting a report, are a person's too.
53
+ */
54
+ export class Incidents {
55
+ http;
56
+ constructor(http) {
57
+ this.http = http;
58
+ }
59
+ /** Report an incident against a governed task, an AI system, or both. */
60
+ report(input, signal) {
61
+ return this.http.request({ method: "POST", path: "/governance/incidents", body: input, signal });
62
+ }
63
+ /** One incident: its DORA classification, its reports and their sign-off, and which report is due next. */
64
+ get(id, signal) {
65
+ return this.http.request({ method: "GET", path: `/governance/incidents/${enc(id)}`, signal });
66
+ }
67
+ /**
68
+ * Newest first. With no `limit` this is every incident; with a `limit` it is
69
+ * one page of that size, and `listPage` hands back the cursor to continue from.
70
+ */
71
+ async list(input = {}, signal) {
72
+ return listOrCollect(input, (q) => this.listPage({ ...input, ...q }, signal));
73
+ }
74
+ /** One page, and the cursor to continue from — null when it is the end. */
75
+ listPage(input = {}, signal) {
76
+ return this.http.request({
77
+ method: "GET",
78
+ path: "/governance/incidents",
79
+ query: { status: input.status, aiSystemId: input.aiSystemId, limit: input.limit, cursor: input.cursor },
80
+ signal,
81
+ });
82
+ }
83
+ /**
84
+ * Draft a DORA report on a major incident and put it to a person to sign
85
+ * off. Reports follow in order: initial, intermediate, final. Needs
86
+ * `approvals:write` as well as `tasks:write`.
87
+ */
88
+ draftReport(id, input, signal) {
89
+ return this.http.request({
90
+ method: "POST",
91
+ path: `/governance/incidents/${enc(id)}/reports`,
92
+ body: input,
93
+ signal,
94
+ });
95
+ }
96
+ }
97
+ /**
98
+ * Compliance Mode across the organisation (Business and Enterprise): the AI
99
+ * system register, incidents, what an agent may do, the frameworks and the
100
+ * ICT register. A governed task's own governance is on `deliverd.tasks`.
101
+ *
102
+ * ```ts
103
+ * const { mode } = await deliverd.governance.checkAuthority({ action: "send" });
104
+ * if (mode === "denied") return;
105
+ * ```
106
+ *
107
+ * Every answer records governance and certifies nothing.
108
+ */
109
+ export class AiGovernance {
110
+ http;
111
+ aiSystems;
112
+ incidents;
113
+ constructor(http) {
114
+ this.http = http;
115
+ this.aiSystems = new AiSystems(http);
116
+ this.incidents = new Incidents(http);
117
+ }
118
+ /**
119
+ * May this agent take this kind of action: on its own (`allowed`), only
120
+ * with a person's approval (`approval`), or not at all (`denied`)? By the
121
+ * organisation's policy and the agent's own, which can only be stricter
122
+ * (Enterprise). Reads; records nothing.
123
+ */
124
+ checkAuthority(input, signal) {
125
+ return this.http.request({
126
+ method: "POST",
127
+ path: "/governance/authority/evaluate",
128
+ body: input,
129
+ signal,
130
+ });
131
+ }
132
+ /** The frameworks the organisation can see: the built-in packs and its own, and which are applied. */
133
+ frameworks(signal) {
134
+ return this.http.request({ method: "GET", path: "/governance/frameworks", signal });
135
+ }
136
+ /**
137
+ * How framework requirements map onto the common controls and, with
138
+ * `taskId`, how far that task's controls cover each one. A mapping, never
139
+ * a compliance verdict.
140
+ */
141
+ frameworkMapping(input = {}, signal) {
142
+ return this.http.request({
143
+ method: "GET",
144
+ path: "/governance/frameworks/mapping",
145
+ query: { taskId: input.taskId, framework: input.framework },
146
+ signal,
147
+ });
148
+ }
149
+ /** Draft the organisation's own framework (Enterprise). It adds nothing until a person publishes and applies it. */
150
+ createCustomFramework(input, signal) {
151
+ return this.http.request({ method: "POST", path: "/governance/frameworks", body: input, signal });
152
+ }
153
+ /** The ICT third-party register: providers, contracts, the AI systems under each, gaps and concentration. */
154
+ ictRegister(signal) {
155
+ return this.http.request({ method: "GET", path: "/governance/ict-register", signal });
156
+ }
157
+ /** The organisation's AI governance in counts, optionally narrowed. Never a compliance percentage. */
158
+ summary(input = {}, signal) {
159
+ return this.http.request({
160
+ method: "GET",
161
+ path: "/governance/summary",
162
+ query: { ...input },
163
+ signal,
164
+ });
165
+ }
166
+ }
package/dist/index.d.ts CHANGED
@@ -6,8 +6,10 @@ import { Reviews, type ReviewWaitOptions } from "./reviews.js";
6
6
  import { Collections, type CollectWaitOptions } from "./collections.js";
7
7
  import { Flows } from "./flows.js";
8
8
  import { Tasks } from "./tasks.js";
9
+ import { AiGovernance } from "./governance.js";
9
10
  import { Webhooks } from "./webhooks.js";
10
11
  import { WebhookEndpoints } from "./webhook-endpoints.js";
12
+ import { Screened, type ScreenOptions } from "./screen.js";
11
13
  import { type DevelopmentOptions } from "./dev.js";
12
14
  import { type Duration } from "./duration.js";
13
15
  import type { CollectedAnswers, CreateApprovalInput, CreateCollectionInput, CreateReviewInput, Decision, GateDecision, PublishReportInput, PublishResult, ReviewOutcome } from "./types.js";
@@ -18,7 +20,10 @@ export { Review, Reviews, type ReviewWaitOptions } from "./reviews.js";
18
20
  export { Collection, Collections, type CollectWaitOptions } from "./collections.js";
19
21
  export { Flow, Flows, type FlowPrimitives } from "./flows.js";
20
22
  export { Task, Tasks } from "./tasks.js";
23
+ export { AiGovernance, AiSystems, Incidents } from "./governance.js";
21
24
  export { WebhookEndpoints } from "./webhook-endpoints.js";
25
+ export { Screened, type ScreenOptions } from "./screen.js";
26
+ export { DATA_KINDS, redact, restore, screenText, summarise, type DataKind, type DetectedSpan, type Redaction, type ScreenFinding, type ScreenTerm, type SpanDetector, } from "./data-screen.js";
22
27
  export { constructCallback, constructEvent, DELIVERY_HEADER, EVENT_HEADER, SIGNATURE_HEADER, TOLERANCE_SECONDS, verifySignature, Webhooks, } from "./webhooks.js";
23
28
  export { DeliverdError, DeliverdTimeoutError } from "./errors.js";
24
29
  export { DEFAULT_BASE_URL, type ClientOptions } from "./http.js";
@@ -121,6 +126,8 @@ export declare class Deliverd {
121
126
  readonly collections: Collections;
122
127
  readonly flows: Flows;
123
128
  readonly tasks: Tasks;
129
+ /** Compliance Mode across the organisation: AI systems, incidents, authority, frameworks, the ICT register. */
130
+ readonly governance: AiGovernance;
124
131
  readonly reports: Reports;
125
132
  readonly comments: Comments;
126
133
  readonly schedules: Schedules;
@@ -229,6 +236,26 @@ export declare class Deliverd {
229
236
  */
230
237
  collect(options: CollectOptions): Promise<CollectedAnswers>;
231
238
  /** Publish HTML to a secure URL. The sixth primitive, one call in. */
239
+ /**
240
+ * Check text before it goes to an AI model, and wait if a person has to decide.
241
+ *
242
+ * The detectors run here, so the text never leaves your machine: Deliverd is
243
+ * told only what was found, by kind, and answers from what your AI register
244
+ * approves that model to receive.
245
+ *
246
+ * ```ts
247
+ * const screened = await deliverd.screen(prompt, { aiSystemId: CLAIMS_MODEL });
248
+ * if (!screened.allowed) return screened.reasons;
249
+ * const answer = await model.generate(screened.text!);
250
+ * return screened.restore(answer);
251
+ * ```
252
+ *
253
+ * `allow` sends it as it is; `redact` gives you `screened.text` with the
254
+ * findings replaced by placeholders, and `restore()` puts them back in the
255
+ * answer; `ask` puts it to a person and waits; `deny` sends nothing. A net,
256
+ * not a guarantee: names in particular are not reliably found.
257
+ */
258
+ screen(text: string, options?: ScreenOptions): Promise<Screened>;
232
259
  publish(input: PublishReportInput, signal?: AbortSignal): Promise<PublishResult>;
233
260
  }
234
261
  export declare const deliverd: Deliverd;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAsB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACnG,OAAO,EAAE,KAAK,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,EAAc,KAAK,QAAQ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views } from "./reviews.js";
6
6
  import { Collections } from "./collections.js";
7
7
  import { Flows } from "./flows.js";
8
8
  import { Tasks } from "./tasks.js";
9
+ import { AiGovernance } from "./governance.js";
9
10
  import { Webhooks } from "./webhooks.js";
10
11
  import { WebhookEndpoints } from "./webhook-endpoints.js";
12
+ import { screen } from "./screen.js";
11
13
  import { developmentFetch } from "./dev.js";
12
14
  import { durationMs } from "./duration.js";
13
15
  export { Approval, Approvals, DecisionSessions, POLL_SCHEDULE } from "./approvals.js";
@@ -17,7 +19,10 @@ export { Review, Reviews } from "./reviews.js";
17
19
  export { Collection, Collections } from "./collections.js";
18
20
  export { Flow, Flows } from "./flows.js";
19
21
  export { Task, Tasks } from "./tasks.js";
22
+ export { AiGovernance, AiSystems, Incidents } from "./governance.js";
20
23
  export { WebhookEndpoints } from "./webhook-endpoints.js";
24
+ export { Screened } from "./screen.js";
25
+ export { DATA_KINDS, redact, restore, screenText, summarise, } from "./data-screen.js";
21
26
  export { constructCallback, constructEvent, DELIVERY_HEADER, EVENT_HEADER, SIGNATURE_HEADER, TOLERANCE_SECONDS, verifySignature, Webhooks, } from "./webhooks.js";
22
27
  export { DeliverdError, DeliverdTimeoutError } from "./errors.js";
23
28
  export { DEFAULT_BASE_URL } from "./http.js";
@@ -52,6 +57,8 @@ export class Deliverd {
52
57
  collections;
53
58
  flows;
54
59
  tasks;
60
+ /** Compliance Mode across the organisation: AI systems, incidents, authority, frameworks, the ICT register. */
61
+ governance;
55
62
  reports;
56
63
  comments;
57
64
  schedules;
@@ -82,6 +89,7 @@ export class Deliverd {
82
89
  */
83
90
  this.flows = new Flows(this.http, this);
84
91
  this.tasks = new Tasks(this.http);
92
+ this.governance = new AiGovernance(this.http);
85
93
  this.reports = new Reports(this.http);
86
94
  this.comments = new Comments(this.http);
87
95
  this.schedules = new Schedules(this.http);
@@ -298,6 +306,28 @@ export class Deliverd {
298
306
  return settled.toCollected();
299
307
  }
300
308
  /** Publish HTML to a secure URL. The sixth primitive, one call in. */
309
+ /**
310
+ * Check text before it goes to an AI model, and wait if a person has to decide.
311
+ *
312
+ * The detectors run here, so the text never leaves your machine: Deliverd is
313
+ * told only what was found, by kind, and answers from what your AI register
314
+ * approves that model to receive.
315
+ *
316
+ * ```ts
317
+ * const screened = await deliverd.screen(prompt, { aiSystemId: CLAIMS_MODEL });
318
+ * if (!screened.allowed) return screened.reasons;
319
+ * const answer = await model.generate(screened.text!);
320
+ * return screened.restore(answer);
321
+ * ```
322
+ *
323
+ * `allow` sends it as it is; `redact` gives you `screened.text` with the
324
+ * findings replaced by placeholders, and `restore()` puts them back in the
325
+ * answer; `ask` puts it to a person and waits; `deny` sends nothing. A net,
326
+ * not a guarantee: names in particular are not reliably found.
327
+ */
328
+ screen(text, options = {}) {
329
+ return screen(this.http, this.approvals, text, options, this.development);
330
+ }
301
331
  publish(input, signal) {
302
332
  return this.reports.publish(input, signal);
303
333
  }
@@ -43,7 +43,7 @@
43
43
  * **Add the version here when you publish it, not before.** An entry is a
44
44
  * claim that `npm install @deliverd/sdk@x` works today.
45
45
  */
46
- export declare const PUBLISHED_TO_NPM: readonly ["0.1.0", "0.2.0", "0.3.0", "0.4.0", "0.5.0", "0.6.0", "0.6.1", "0.6.2", "0.7.0", "0.7.1", "0.8.0", "0.8.1", "0.8.2", "0.9.0", "0.10.0", "0.11.0", "0.11.1", "0.12.0", "0.13.0", "0.14.0", "0.15.0", "0.16.0", "0.17.0", "0.18.0", "0.19.0", "0.20.0", "0.21.0", "0.22.0", "0.23.0", "0.24.0", "0.24.1", "0.25.0"];
46
+ export declare const PUBLISHED_TO_NPM: readonly ["0.1.0", "0.2.0", "0.3.0", "0.4.0", "0.5.0", "0.6.0", "0.6.1", "0.6.2", "0.7.0", "0.7.1", "0.8.0", "0.8.1", "0.8.2", "0.9.0", "0.10.0", "0.11.0", "0.11.1", "0.12.0", "0.13.0", "0.14.0", "0.15.0", "0.16.0", "0.17.0", "0.18.0", "0.19.0", "0.20.0", "0.21.0", "0.22.0", "0.23.0", "0.24.0", "0.24.1", "0.25.0", "0.25.1"];
47
47
  /**
48
48
  * A fingerprint of what each *published* version recorded.
49
49
  *
@@ -1 +1 @@
1
- {"version":3,"file":"released.d.ts","sourceRoot":"","sources":["../src/released.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gBAAgB,6TAiCnB,CAAC;AAEX;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA+FzC,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAw1iBtD,CAAC"}
1
+ {"version":3,"file":"released.d.ts","sourceRoot":"","sources":["../src/released.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gBAAgB,uUAkCnB,CAAC;AAEX;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAiGzC,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAsklBtD,CAAC"}