@deliverd/sdk 0.25.1 → 0.27.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.
- package/README.md +104 -0
- package/dist/adapters/index.d.ts +4 -0
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +2 -0
- package/dist/adapters/mastra.d.ts +81 -0
- package/dist/adapters/mastra.d.ts.map +1 -0
- package/dist/adapters/mastra.js +54 -0
- package/dist/adapters/muse-spark.d.ts +79 -0
- package/dist/adapters/muse-spark.d.ts.map +1 -0
- package/dist/adapters/muse-spark.js +59 -0
- package/dist/adapters/shared.d.ts +2 -1
- package/dist/adapters/shared.d.ts.map +1 -1
- package/dist/data-screen.d.ts +233 -0
- package/dist/data-screen.d.ts.map +1 -0
- package/dist/data-screen.js +395 -0
- package/dist/decision-token.d.ts +102 -0
- package/dist/decision-token.d.ts.map +1 -0
- package/dist/decision-token.js +139 -0
- package/dist/dev.d.ts.map +1 -1
- package/dist/dev.js +57 -2
- package/dist/gates.d.ts +2 -0
- package/dist/gates.d.ts.map +1 -1
- package/dist/gates.js +3 -0
- package/dist/governance.d.ts +94 -0
- package/dist/governance.d.ts.map +1 -0
- package/dist/governance.js +166 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -0
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +4 -0
- package/dist/released.d.ts +1 -1
- package/dist/released.d.ts.map +1 -1
- package/dist/released.js +3803 -0
- package/dist/screen.d.ts +85 -0
- package/dist/screen.d.ts.map +1 -0
- package/dist/screen.js +69 -0
- package/dist/tasks.d.ts +38 -1
- package/dist/tasks.d.ts.map +1 -1
- package/dist/tasks.js +67 -0
- package/dist/types.d.ts +656 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/adapters/index.ts +11 -0
- package/src/adapters/mastra.ts +118 -0
- package/src/adapters/muse-spark.ts +147 -0
- package/src/adapters/shared.ts +2 -1
- package/src/data-screen.ts +536 -0
- package/src/decision-token.ts +184 -0
- package/src/dev.ts +63 -2
- package/src/gates.ts +3 -0
- package/src/governance.ts +204 -0
- package/src/index.ts +60 -0
- package/src/messages.ts +4 -0
- package/src/released.ts +3804 -0
- package/src/screen.ts +144 -0
- package/src/tasks.ts +88 -0
- package/src/types.ts +646 -4
|
@@ -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,11 @@ 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";
|
|
11
|
+
import { DecisionTokens } from "./decision-token.js";
|
|
10
12
|
import { WebhookEndpoints } from "./webhook-endpoints.js";
|
|
13
|
+
import { Screened, type ScreenOptions } from "./screen.js";
|
|
11
14
|
import { type DevelopmentOptions } from "./dev.js";
|
|
12
15
|
import { type Duration } from "./duration.js";
|
|
13
16
|
import type { CollectedAnswers, CreateApprovalInput, CreateCollectionInput, CreateReviewInput, Decision, GateDecision, PublishReportInput, PublishResult, ReviewOutcome } from "./types.js";
|
|
@@ -18,7 +21,11 @@ export { Review, Reviews, type ReviewWaitOptions } from "./reviews.js";
|
|
|
18
21
|
export { Collection, Collections, type CollectWaitOptions } from "./collections.js";
|
|
19
22
|
export { Flow, Flows, type FlowPrimitives } from "./flows.js";
|
|
20
23
|
export { Task, Tasks } from "./tasks.js";
|
|
24
|
+
export { AiGovernance, AiSystems, Incidents } from "./governance.js";
|
|
21
25
|
export { WebhookEndpoints } from "./webhook-endpoints.js";
|
|
26
|
+
export { canonicalJson, DECISION_TOKEN_CONTEXT, DECISION_TOKEN_PREFIX, decisionInputHash, DecisionTokens, EVIDENCE_KEY_PATH, verifyDecisionToken, type DecisionTokenClaims, type DecisionTokenExpectation, type DecisionTokenFailure, type DecisionTokenResult, } from "./decision-token.js";
|
|
27
|
+
export { Screened, type ScreenOptions } from "./screen.js";
|
|
28
|
+
export { DATA_KINDS, redact, restore, screenText, summarise, type DataKind, type DetectedSpan, type Redaction, type ScreenFinding, type ScreenTerm, type SpanDetector, } from "./data-screen.js";
|
|
22
29
|
export { constructCallback, constructEvent, DELIVERY_HEADER, EVENT_HEADER, SIGNATURE_HEADER, TOLERANCE_SECONDS, verifySignature, Webhooks, } from "./webhooks.js";
|
|
23
30
|
export { DeliverdError, DeliverdTimeoutError } from "./errors.js";
|
|
24
31
|
export { DEFAULT_BASE_URL, type ClientOptions } from "./http.js";
|
|
@@ -121,11 +128,15 @@ export declare class Deliverd {
|
|
|
121
128
|
readonly collections: Collections;
|
|
122
129
|
readonly flows: Flows;
|
|
123
130
|
readonly tasks: Tasks;
|
|
131
|
+
/** Compliance Mode across the organisation: AI systems, incidents, authority, frameworks, the ICT register. */
|
|
132
|
+
readonly governance: AiGovernance;
|
|
124
133
|
readonly reports: Reports;
|
|
125
134
|
readonly comments: Comments;
|
|
126
135
|
readonly schedules: Schedules;
|
|
127
136
|
readonly webhooks: Webhooks;
|
|
128
137
|
readonly webhookEndpoints: WebhookEndpoints;
|
|
138
|
+
/** Check a gate's signed yes where the action happens, before it happens. */
|
|
139
|
+
readonly decisionTokens: DecisionTokens;
|
|
129
140
|
readonly http: HttpClient;
|
|
130
141
|
/** Whether an imaginary approver is deciding these. */
|
|
131
142
|
readonly development: boolean;
|
|
@@ -229,6 +240,26 @@ export declare class Deliverd {
|
|
|
229
240
|
*/
|
|
230
241
|
collect(options: CollectOptions): Promise<CollectedAnswers>;
|
|
231
242
|
/** Publish HTML to a secure URL. The sixth primitive, one call in. */
|
|
243
|
+
/**
|
|
244
|
+
* Check text before it goes to an AI model, and wait if a person has to decide.
|
|
245
|
+
*
|
|
246
|
+
* The detectors run here, so the text never leaves your machine: Deliverd is
|
|
247
|
+
* told only what was found, by kind, and answers from what your AI register
|
|
248
|
+
* approves that model to receive.
|
|
249
|
+
*
|
|
250
|
+
* ```ts
|
|
251
|
+
* const screened = await deliverd.screen(prompt, { aiSystemId: CLAIMS_MODEL });
|
|
252
|
+
* if (!screened.allowed) return screened.reasons;
|
|
253
|
+
* const answer = await model.generate(screened.text!);
|
|
254
|
+
* return screened.restore(answer);
|
|
255
|
+
* ```
|
|
256
|
+
*
|
|
257
|
+
* `allow` sends it as it is; `redact` gives you `screened.text` with the
|
|
258
|
+
* findings replaced by placeholders, and `restore()` puts them back in the
|
|
259
|
+
* answer; `ask` puts it to a person and waits; `deny` sends nothing. A net,
|
|
260
|
+
* not a guarantee: names in particular are not reliably found.
|
|
261
|
+
*/
|
|
262
|
+
screen(text: string, options?: ScreenOptions): Promise<Screened>;
|
|
232
263
|
publish(input: PublishReportInput, signal?: AbortSignal): Promise<PublishResult>;
|
|
233
264
|
}
|
|
234
265
|
export declare const deliverd: Deliverd;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,QAAQ,EACR,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE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C,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAKxD;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAoC5D;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,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,11 @@ 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";
|
|
11
|
+
import { DecisionTokens } from "./decision-token.js";
|
|
10
12
|
import { WebhookEndpoints } from "./webhook-endpoints.js";
|
|
13
|
+
import { screen } from "./screen.js";
|
|
11
14
|
import { developmentFetch } from "./dev.js";
|
|
12
15
|
import { durationMs } from "./duration.js";
|
|
13
16
|
export { Approval, Approvals, DecisionSessions, POLL_SCHEDULE } from "./approvals.js";
|
|
@@ -17,7 +20,11 @@ export { Review, Reviews } from "./reviews.js";
|
|
|
17
20
|
export { Collection, Collections } from "./collections.js";
|
|
18
21
|
export { Flow, Flows } from "./flows.js";
|
|
19
22
|
export { Task, Tasks } from "./tasks.js";
|
|
23
|
+
export { AiGovernance, AiSystems, Incidents } from "./governance.js";
|
|
20
24
|
export { WebhookEndpoints } from "./webhook-endpoints.js";
|
|
25
|
+
export { canonicalJson, DECISION_TOKEN_CONTEXT, DECISION_TOKEN_PREFIX, decisionInputHash, DecisionTokens, EVIDENCE_KEY_PATH, verifyDecisionToken, } from "./decision-token.js";
|
|
26
|
+
export { Screened } from "./screen.js";
|
|
27
|
+
export { DATA_KINDS, redact, restore, screenText, summarise, } from "./data-screen.js";
|
|
21
28
|
export { constructCallback, constructEvent, DELIVERY_HEADER, EVENT_HEADER, SIGNATURE_HEADER, TOLERANCE_SECONDS, verifySignature, Webhooks, } from "./webhooks.js";
|
|
22
29
|
export { DeliverdError, DeliverdTimeoutError } from "./errors.js";
|
|
23
30
|
export { DEFAULT_BASE_URL } from "./http.js";
|
|
@@ -52,11 +59,15 @@ export class Deliverd {
|
|
|
52
59
|
collections;
|
|
53
60
|
flows;
|
|
54
61
|
tasks;
|
|
62
|
+
/** Compliance Mode across the organisation: AI systems, incidents, authority, frameworks, the ICT register. */
|
|
63
|
+
governance;
|
|
55
64
|
reports;
|
|
56
65
|
comments;
|
|
57
66
|
schedules;
|
|
58
67
|
webhooks;
|
|
59
68
|
webhookEndpoints;
|
|
69
|
+
/** Check a gate's signed yes where the action happens, before it happens. */
|
|
70
|
+
decisionTokens;
|
|
60
71
|
http;
|
|
61
72
|
/** Whether an imaginary approver is deciding these. */
|
|
62
73
|
development;
|
|
@@ -82,11 +93,13 @@ export class Deliverd {
|
|
|
82
93
|
*/
|
|
83
94
|
this.flows = new Flows(this.http, this);
|
|
84
95
|
this.tasks = new Tasks(this.http);
|
|
96
|
+
this.governance = new AiGovernance(this.http);
|
|
85
97
|
this.reports = new Reports(this.http);
|
|
86
98
|
this.comments = new Comments(this.http);
|
|
87
99
|
this.schedules = new Schedules(this.http);
|
|
88
100
|
this.webhooks = new Webhooks();
|
|
89
101
|
this.webhookEndpoints = new WebhookEndpoints(this.http);
|
|
102
|
+
this.decisionTokens = new DecisionTokens(this.http.baseUrl, options.fetch);
|
|
90
103
|
}
|
|
91
104
|
/**
|
|
92
105
|
* Ask a person, and wait for the answer.
|
|
@@ -298,6 +311,28 @@ export class Deliverd {
|
|
|
298
311
|
return settled.toCollected();
|
|
299
312
|
}
|
|
300
313
|
/** Publish HTML to a secure URL. The sixth primitive, one call in. */
|
|
314
|
+
/**
|
|
315
|
+
* Check text before it goes to an AI model, and wait if a person has to decide.
|
|
316
|
+
*
|
|
317
|
+
* The detectors run here, so the text never leaves your machine: Deliverd is
|
|
318
|
+
* told only what was found, by kind, and answers from what your AI register
|
|
319
|
+
* approves that model to receive.
|
|
320
|
+
*
|
|
321
|
+
* ```ts
|
|
322
|
+
* const screened = await deliverd.screen(prompt, { aiSystemId: CLAIMS_MODEL });
|
|
323
|
+
* if (!screened.allowed) return screened.reasons;
|
|
324
|
+
* const answer = await model.generate(screened.text!);
|
|
325
|
+
* return screened.restore(answer);
|
|
326
|
+
* ```
|
|
327
|
+
*
|
|
328
|
+
* `allow` sends it as it is; `redact` gives you `screened.text` with the
|
|
329
|
+
* findings replaced by placeholders, and `restore()` puts them back in the
|
|
330
|
+
* answer; `ask` puts it to a person and waits; `deny` sends nothing. A net,
|
|
331
|
+
* not a guarantee: names in particular are not reliably found.
|
|
332
|
+
*/
|
|
333
|
+
screen(text, options = {}) {
|
|
334
|
+
return screen(this.http, this.approvals, text, options, this.development);
|
|
335
|
+
}
|
|
301
336
|
publish(input, signal) {
|
|
302
337
|
return this.reports.publish(input, signal);
|
|
303
338
|
}
|
package/dist/messages.d.ts.map
CHANGED
|
@@ -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,iFAAiF;AACjF,eAAO,MAAM,WAAW,2GACkF,CAAC;AAE3G,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,
|
|
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,CA4MpD,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
|
@@ -171,6 +171,10 @@ export const EXPLANATIONS = {
|
|
|
171
171
|
message: "That permission was withdrawn after it was given.",
|
|
172
172
|
hint: "Do not act. Read the gate for who revoked it and why, and ask again if the work still needs doing.",
|
|
173
173
|
},
|
|
174
|
+
agents_stopped: {
|
|
175
|
+
message: "A person has stopped every agent in this organisation.",
|
|
176
|
+
hint: "Do not act, and do not retry. Tell the user; nothing proceeds until somebody resumes the agents.",
|
|
177
|
+
},
|
|
174
178
|
gate_cancelled: {
|
|
175
179
|
message: "That request was withdrawn.",
|
|
176
180
|
hint: "Ask again if the work still needs doing.",
|
package/dist/released.d.ts
CHANGED
|
@@ -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", "0.26.0"];
|
|
47
47
|
/**
|
|
48
48
|
* A fingerprint of what each *published* version recorded.
|
|
49
49
|
*
|
package/dist/released.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"released.d.ts","sourceRoot":"","sources":["../src/released.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"released.d.ts","sourceRoot":"","sources":["../src/released.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gBAAgB,iVAmCnB,CAAC;AAEX;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAmGzC,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CA8iqBtD,CAAC"}
|