@deliverd/sdk 0.25.0 → 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 (51) hide show
  1. package/README.md +82 -3
  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/messages.d.ts +2 -0
  25. package/dist/messages.d.ts.map +1 -1
  26. package/dist/messages.js +8 -1
  27. package/dist/released.d.ts +1 -1
  28. package/dist/released.d.ts.map +1 -1
  29. package/dist/released.js +2184 -0
  30. package/dist/screen.d.ts +85 -0
  31. package/dist/screen.d.ts.map +1 -0
  32. package/dist/screen.js +69 -0
  33. package/dist/tasks.d.ts +38 -1
  34. package/dist/tasks.d.ts.map +1 -1
  35. package/dist/tasks.js +67 -0
  36. package/dist/types.d.ts +589 -3
  37. package/dist/types.d.ts.map +1 -1
  38. package/package.json +5 -5
  39. package/src/adapters/index.ts +11 -0
  40. package/src/adapters/mastra.ts +118 -0
  41. package/src/adapters/muse-spark.ts +147 -0
  42. package/src/adapters/shared.ts +2 -1
  43. package/src/data-screen.ts +533 -0
  44. package/src/dev.ts +45 -2
  45. package/src/governance.ts +204 -0
  46. package/src/index.ts +43 -0
  47. package/src/messages.ts +10 -1
  48. package/src/released.ts +2184 -0
  49. package/src/screen.ts +144 -0
  50. package/src/tasks.ts +88 -0
  51. package/src/types.ts +577 -3
package/dist/dev.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { assessCounts, DEFAULT_SCREEN_POLICY, describeCounts } from "./data-screen.js";
1
2
  const DEFAULT_QUESTION = "Has this been through staging?";
2
3
  let counter = 0;
3
4
  /**
@@ -14,7 +15,7 @@ export function developmentFetch(options = {}) {
14
15
  const collectionStore = new Map();
15
16
  const flowStore = new Map();
16
17
  const tasks = developmentTasks(options);
17
- return (async (input, init) => {
18
+ const handle = (async (input, init) => {
18
19
  const url = new URL(String(input));
19
20
  const path = url.pathname.replace(/^\/api\/v1/, "");
20
21
  const method = (init?.method ?? "GET").toUpperCase();
@@ -540,6 +541,44 @@ export function developmentFetch(options = {}) {
540
541
  if (method === "GET" && path === "/tasks") {
541
542
  return json({ tasks: tasks.list(url.searchParams), nextCursor: null });
542
543
  }
544
+ /*
545
+ * Screening with no organisation behind it: no register record and no
546
+ * policy, so the defaults decide — internal data and no personal data
547
+ * approved — and an `ask` files an ordinary development approval, which
548
+ * the imaginary approver decides like any other.
549
+ */
550
+ if (method === "POST" && path === "/screen") {
551
+ const counts = (body.counts ?? {});
552
+ const termClassification = body.termClassification === "restricted" ? "restricted" : "confidential";
553
+ const assessment = assessCounts(counts, null, DEFAULT_SCREEN_POLICY, termClassification);
554
+ let approval = null;
555
+ if (assessment.verdict === "ask" && body.ask !== false) {
556
+ const created = (await (await handle(`${url.origin}/api/v1/approvals`, {
557
+ method: "POST",
558
+ body: JSON.stringify({
559
+ title: `Send ${describeCounts(counts)} to an AI model?`,
560
+ description: assessment.reasons.join("\n"),
561
+ risk: assessment.classification === "restricted" ? "high" : "medium",
562
+ externalId: body.externalId,
563
+ }),
564
+ })).json());
565
+ approval = { id: created.id, url: created.url, status: created.status };
566
+ }
567
+ return json({
568
+ verdict: assessment.verdict,
569
+ allowed: assessment.verdict === "allow" || assessment.verdict === "redact",
570
+ classification: assessment.classification,
571
+ personalData: assessment.personalData,
572
+ categories: assessment.categories,
573
+ counts,
574
+ offending: assessment.offending,
575
+ reasons: assessment.reasons,
576
+ target: null,
577
+ findings: null,
578
+ redactedText: null,
579
+ approval,
580
+ });
581
+ }
543
582
  const taskMatch = /^\/tasks\/([^/]+)(?:\/(context|graph|side-tasks|findings|complete|apply|reopen|cancel|links))?$/.exec(path);
544
583
  if (taskMatch) {
545
584
  const [status, payload] = tasks.act(method, taskMatch[1], taskMatch[2] ?? null, body);
@@ -548,10 +587,11 @@ export function developmentFetch(options = {}) {
548
587
  return json({
549
588
  error: {
550
589
  code: "not_in_development_mode",
551
- message: `Development mode simulates approvals, reviews, collections, flows and tasks only, and something called ${method} ${path}. Use a real API key for the rest of the API.`,
590
+ message: `Development mode simulates approvals, reviews, collections, flows, tasks and screening only, and something called ${method} ${path}. Use a real API key for the rest of the API.`,
552
591
  },
553
592
  }, 501);
554
593
  });
594
+ return handle;
555
595
  }
556
596
  function resolveOutcome(outcome, body) {
557
597
  const fromEnv = process.env.DELIVERD_DEV_OUTCOME;
@@ -0,0 +1,94 @@
1
+ import type { HttpClient } from "./http.js";
2
+ import { type PageOf } from "./paging.js";
3
+ import type { AiIncident, AiIncidentDetail, AiSystem, AiSystemDetail, AuthorityDecision, CheckAuthorityInput, CreateCustomFrameworkInput, CustomFramework, DraftedIncidentReport, DraftIncidentReportInput, FrameworkCatalogue, FrameworkMapping, FrameworkMappingInput, GovernanceSummary, GovernanceSummaryInput, IctRegister, ListIncidentsInput, ModelChangeInput, ModelChangeResult, RegisterAiSystemInput, ReportIncidentInput, UpdateAiSystemInput } from "./types.js";
4
+ /**
5
+ * The organisation's register of AI systems. A governed task names one by
6
+ * `aiSystemId` instead of describing it again, and a change of model is
7
+ * recorded here so every task using it is reassessed.
8
+ */
9
+ export declare class AiSystems {
10
+ private readonly http;
11
+ constructor(http: HttpClient);
12
+ /** The register, active and retired, or only one of them. */
13
+ list(input?: {
14
+ status?: AiSystem["status"];
15
+ }, signal?: AbortSignal): Promise<AiSystem[]>;
16
+ /** One system, and the governed tasks that name it. */
17
+ get(id: string, signal?: AbortSignal): Promise<AiSystemDetail>;
18
+ /** Add a system to the register. Digests of its prompt and guardrails, never the text. */
19
+ register(input: RegisterAiSystemInput, signal?: AbortSignal): Promise<AiSystem>;
20
+ /** Change a system's record. An agent may raise its risk but not lower it, and may not retire it. */
21
+ update(id: string, input: UpdateAiSystemInput, signal?: AbortSignal): Promise<AiSystem>;
22
+ /**
23
+ * Record a new provider, model, version, prompt or guardrails (Enterprise).
24
+ * Every governed task using the system is reassessed, and evidence of the
25
+ * old release stops counting.
26
+ */
27
+ recordModelChange(id: string, input: ModelChangeInput, signal?: AbortSignal): Promise<ModelChangeResult>;
28
+ }
29
+ /**
30
+ * AI incidents, and the DORA reports on the major ones. A high or critical
31
+ * incident closes its task's governance gate until a person resolves it in
32
+ * Deliverd; classifying it, and submitting a report, are a person's too.
33
+ */
34
+ export declare class Incidents {
35
+ private readonly http;
36
+ constructor(http: HttpClient);
37
+ /** Report an incident against a governed task, an AI system, or both. */
38
+ report(input: ReportIncidentInput, signal?: AbortSignal): Promise<AiIncident>;
39
+ /** One incident: its DORA classification, its reports and their sign-off, and which report is due next. */
40
+ get(id: string, signal?: AbortSignal): Promise<AiIncidentDetail>;
41
+ /**
42
+ * Newest first. With no `limit` this is every incident; with a `limit` it is
43
+ * one page of that size, and `listPage` hands back the cursor to continue from.
44
+ */
45
+ list(input?: ListIncidentsInput, signal?: AbortSignal): Promise<AiIncident[]>;
46
+ /** One page, and the cursor to continue from — null when it is the end. */
47
+ listPage(input?: ListIncidentsInput, signal?: AbortSignal): Promise<PageOf<AiIncident>>;
48
+ /**
49
+ * Draft a DORA report on a major incident and put it to a person to sign
50
+ * off. Reports follow in order: initial, intermediate, final. Needs
51
+ * `approvals:write` as well as `tasks:write`.
52
+ */
53
+ draftReport(id: string, input: DraftIncidentReportInput, signal?: AbortSignal): Promise<DraftedIncidentReport>;
54
+ }
55
+ /**
56
+ * Compliance Mode across the organisation (Business and Enterprise): the AI
57
+ * system register, incidents, what an agent may do, the frameworks and the
58
+ * ICT register. A governed task's own governance is on `deliverd.tasks`.
59
+ *
60
+ * ```ts
61
+ * const { mode } = await deliverd.governance.checkAuthority({ action: "send" });
62
+ * if (mode === "denied") return;
63
+ * ```
64
+ *
65
+ * Every answer records governance and certifies nothing.
66
+ */
67
+ export declare class AiGovernance {
68
+ private readonly http;
69
+ readonly aiSystems: AiSystems;
70
+ readonly incidents: Incidents;
71
+ constructor(http: HttpClient);
72
+ /**
73
+ * May this agent take this kind of action: on its own (`allowed`), only
74
+ * with a person's approval (`approval`), or not at all (`denied`)? By the
75
+ * organisation's policy and the agent's own, which can only be stricter
76
+ * (Enterprise). Reads; records nothing.
77
+ */
78
+ checkAuthority(input: CheckAuthorityInput, signal?: AbortSignal): Promise<AuthorityDecision>;
79
+ /** The frameworks the organisation can see: the built-in packs and its own, and which are applied. */
80
+ frameworks(signal?: AbortSignal): Promise<FrameworkCatalogue>;
81
+ /**
82
+ * How framework requirements map onto the common controls and, with
83
+ * `taskId`, how far that task's controls cover each one. A mapping, never
84
+ * a compliance verdict.
85
+ */
86
+ frameworkMapping(input?: FrameworkMappingInput, signal?: AbortSignal): Promise<FrameworkMapping>;
87
+ /** Draft the organisation's own framework (Enterprise). It adds nothing until a person publishes and applies it. */
88
+ createCustomFramework(input: CreateCustomFrameworkInput, signal?: AbortSignal): Promise<CustomFramework>;
89
+ /** The ICT third-party register: providers, contracts, the AI systems under each, gaps and concentration. */
90
+ ictRegister(signal?: AbortSignal): Promise<IctRegister>;
91
+ /** The organisation's AI governance in counts, optionally narrowed. Never a compliance percentage. */
92
+ summary(input?: GovernanceSummaryInput, signal?: AbortSignal): Promise<GovernanceSummary>;
93
+ }
94
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,CAAC,kBAAkB,CAAC;IAI7D;;;;OAIG;IACH,gBAAgB,CAAC,KAAK,GAAE,qBAA0B,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;IASpG,oHAAoH;IACpH,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC;IAIxG,6GAA6G;IAC7G,WAAW,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAIvD,sGAAsG;IACtG,OAAO,CAAC,KAAK,GAAE,sBAA2B,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAQ9F"}
@@ -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,cA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CAAC;IAkCjE,sEAAsE;IACtE;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIpE,OAAO,CAAC,KAAK,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;CAGjF;AAoBD,eAAO,MAAM,QAAQ,EAAE,QAMrB,CAAC;AAEH,eAAe,QAAQ,CAAC"}
package/dist/index.js CHANGED
@@ -6,8 +6,10 @@ import { Reviews } 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
  }
@@ -15,6 +15,8 @@ export interface Explanation {
15
15
  /** The line under it: what to do. */
16
16
  hint: string;
17
17
  }
18
+ /** Where somebody without an account makes one, counted against this package. */
19
+ export declare const SIGN_UP_URL = "https://deliverd.dev/sign-up?utm_source=npm&utm_medium=package&utm_campaign=sdk&utm_content=no-api-key";
18
20
  export declare const EXPLANATIONS: Record<string, Explanation>;
19
21
  /** The message as a developer should read it: what happened, then what to do. */
20
22
  export declare function explain(code: string, apiMessage: string): {
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,WAAW;IAC1B,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAmMpD,CAAC;AAEF,iFAAiF;AACjF,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAI5F"}
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,WAAW;IAC1B,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,iFAAiF;AACjF,eAAO,MAAM,WAAW,2GACkF,CAAC;AAE3G,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAwMpD,CAAC;AAEF,iFAAiF;AACjF,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAI5F"}
package/dist/messages.js CHANGED
@@ -9,10 +9,17 @@
9
9
  * Keyed on the codes the API actually returns. Anything unlisted keeps the
10
10
  * API's own message, which is written for a person too.
11
11
  */
12
+ /** Where somebody without an account makes one, counted against this package. */
13
+ export const SIGN_UP_URL = "https://deliverd.dev/sign-up?utm_source=npm&utm_medium=package&utm_campaign=sdk&utm_content=no-api-key";
12
14
  export const EXPLANATIONS = {
13
15
  no_api_key: {
14
16
  message: "No API key.",
15
- hint: "Set DELIVERD_API_KEY in your environment, or pass { apiKey } — or use { mode: \"development\" } to run without one.",
17
+ /*
18
+ * The one moment somebody has installed the package and has no account:
19
+ * the link is the way to get one, tagged so a sign-up from here is
20
+ * counted against this package (`SIGN_UP_URL`, `packaging.test.ts`).
21
+ */
22
+ hint: `Set DELIVERD_API_KEY in your environment, or pass { apiKey } — or use { mode: "development" } to run without one. No account yet? Setting up a free one hands you a key: ${SIGN_UP_URL}`,
16
23
  },
17
24
  auth_error: {
18
25
  message: "That credential was not accepted.",
@@ -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"];
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,mTAgCnB,CAAC;AAEX;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA6FzC,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAo8gBtD,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"}