@deliverd/sdk 0.28.0 → 0.30.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/dist/context.d.ts +7 -3
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +11 -3
- package/dist/data-screen.d.ts.map +1 -1
- package/dist/data-screen.js +33 -2
- package/dist/dev.d.ts.map +1 -1
- package/dist/dev.js +4 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/purview-rules.d.ts +63 -0
- package/dist/purview-rules.d.ts.map +1 -0
- package/dist/purview-rules.js +98 -0
- package/dist/purview.d.ts +114 -0
- package/dist/purview.d.ts.map +1 -0
- package/dist/purview.js +124 -0
- package/dist/released.d.ts +1 -1
- package/dist/released.d.ts.map +1 -1
- package/dist/released.js +2917 -0
- package/dist/screen.d.ts +8 -0
- package/dist/screen.d.ts.map +1 -1
- package/dist/screen.js +2 -0
- package/dist/types.d.ts +74 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/context.ts +15 -3
- package/src/data-screen.ts +33 -2
- package/src/dev.ts +4 -2
- package/src/index.ts +1 -0
- package/src/purview-rules.ts +117 -0
- package/src/purview.ts +182 -0
- package/src/released.ts +2919 -0
- package/src/screen.ts +10 -0
- package/src/types.ts +74 -2
package/src/screen.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from "./data-screen.js";
|
|
13
13
|
import { durationMs, type Duration } from "./duration.js";
|
|
14
14
|
import type { HttpClient } from "./http.js";
|
|
15
|
+
import type { PurviewCheck } from "./purview.js";
|
|
15
16
|
import type { ScreenData, ScreenVerdict } from "./types.js";
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -65,6 +66,13 @@ export interface ScreenOptions {
|
|
|
65
66
|
detectors?: readonly SpanDetector[];
|
|
66
67
|
/** Spans another detector already found in this text. */
|
|
67
68
|
spans?: readonly DetectedSpan[];
|
|
69
|
+
/**
|
|
70
|
+
* Your organisation's Microsoft Purview, asked about the text before
|
|
71
|
+
* Deliverd: build one with `purviewCheck()`. The text goes from here to
|
|
72
|
+
* Microsoft, never to Deliverd, and only Purview's answer is sent on. A
|
|
73
|
+
* Purview block stops the text; a warn puts it to a person.
|
|
74
|
+
*/
|
|
75
|
+
purview?: PurviewCheck;
|
|
68
76
|
/** Whether to wait for a person on an `ask`. Default true. */
|
|
69
77
|
wait?: boolean;
|
|
70
78
|
timeout?: Duration;
|
|
@@ -113,6 +121,7 @@ export async function screen(
|
|
|
113
121
|
const spans = [...(options.spans ?? [])];
|
|
114
122
|
for (const detect of options.detectors ?? []) spans.push(...(await detect(text)));
|
|
115
123
|
const findings = screenText(text, options.terms ?? [], spans);
|
|
124
|
+
const purview = options.purview ? await options.purview(text) : null;
|
|
116
125
|
const data = await http.request<ScreenData>({
|
|
117
126
|
method: "POST",
|
|
118
127
|
path: "/screen",
|
|
@@ -122,6 +131,7 @@ export async function screen(
|
|
|
122
131
|
...(options.aiSystemId ? { aiSystemId: options.aiSystemId } : {}),
|
|
123
132
|
...(options.purpose ? { purpose: options.purpose } : {}),
|
|
124
133
|
...(options.externalId ? { externalId: options.externalId } : {}),
|
|
134
|
+
...(purview ? { purview } : {}),
|
|
125
135
|
},
|
|
126
136
|
signal: options.signal,
|
|
127
137
|
});
|
package/src/types.ts
CHANGED
|
@@ -810,6 +810,8 @@ export type WebhookEventName =
|
|
|
810
810
|
| "side_task.completed"
|
|
811
811
|
/** An AI risk indicator went red for a month: its figure, limits and owner. */
|
|
812
812
|
| "risk_indicator.breached"
|
|
813
|
+
/** Opt-in: a person confirmed or retired knowledge, or a playbook or prompt went into force or was retired. For a sync. */
|
|
814
|
+
| "context.changed"
|
|
813
815
|
/** Opt-in: one audit log entry, with its chain position and hashes. For a SIEM. */
|
|
814
816
|
| "audit.event";
|
|
815
817
|
|
|
@@ -2621,6 +2623,16 @@ export interface ScreenApprovalRef {
|
|
|
2621
2623
|
status: string;
|
|
2622
2624
|
}
|
|
2623
2625
|
|
|
2626
|
+
/** Microsoft Purview's answer, as the caller sent it. Never the text. */
|
|
2627
|
+
export interface ScreenPurviewData {
|
|
2628
|
+
/** `null` when Purview returned no restriction. */
|
|
2629
|
+
restriction: "audit" | "warn" | "block" | null;
|
|
2630
|
+
actions: number;
|
|
2631
|
+
scopeModified: boolean;
|
|
2632
|
+
/** Purview could not be reached; `restriction` is what the caller chose for that case. */
|
|
2633
|
+
unavailable: boolean;
|
|
2634
|
+
}
|
|
2635
|
+
|
|
2624
2636
|
/** What `POST /screen` answers: the verdict, and why. */
|
|
2625
2637
|
export interface ScreenData {
|
|
2626
2638
|
verdict: ScreenVerdict;
|
|
@@ -2640,6 +2652,8 @@ export interface ScreenData {
|
|
|
2640
2652
|
redactedText: string | null;
|
|
2641
2653
|
/** The approval a person decides, for an `ask` verdict. */
|
|
2642
2654
|
approval: ScreenApprovalRef | null;
|
|
2655
|
+
/** Microsoft Purview's answer, when `screen()` was given a `purview` check. */
|
|
2656
|
+
purview?: ScreenPurviewData | null;
|
|
2643
2657
|
}
|
|
2644
2658
|
|
|
2645
2659
|
// ── Context: knowledge and playbooks ────────────────────────────────────────
|
|
@@ -2843,6 +2857,30 @@ export interface PlaybookData {
|
|
|
2843
2857
|
createdBy: string;
|
|
2844
2858
|
createdAt: string;
|
|
2845
2859
|
updatedAt: string;
|
|
2860
|
+
/** `procedure`: steps an agent runs. `prompt`: approved words people and agents use. */
|
|
2861
|
+
kind: PlaybookKind;
|
|
2862
|
+
/** An approved prompt's own fields; null on a procedure. */
|
|
2863
|
+
prompt: PromptFields | null;
|
|
2864
|
+
}
|
|
2865
|
+
|
|
2866
|
+
export type PlaybookKind = "procedure" | "prompt";
|
|
2867
|
+
|
|
2868
|
+
export interface PromptFields {
|
|
2869
|
+
/** The approved words, with `{input}` placeholders. */
|
|
2870
|
+
text: string;
|
|
2871
|
+
/** What it is not for, and how to check what it produces. */
|
|
2872
|
+
limitations: string | null;
|
|
2873
|
+
department: string | null;
|
|
2874
|
+
taskType: string | null;
|
|
2875
|
+
language: string | null;
|
|
2876
|
+
owner: string | null;
|
|
2877
|
+
ownerUserId: string | null;
|
|
2878
|
+
/** YYYY-MM-DD. */
|
|
2879
|
+
reviewDueOn: string | null;
|
|
2880
|
+
/** In force, and its review date has passed. */
|
|
2881
|
+
reviewOverdue: boolean;
|
|
2882
|
+
reviewedAt: string | null;
|
|
2883
|
+
reviewedBy: string | null;
|
|
2846
2884
|
}
|
|
2847
2885
|
|
|
2848
2886
|
/** A playbook's newest version, and which one is in force. */
|
|
@@ -2859,9 +2897,10 @@ export interface PlaybookDetail extends PlaybookData {
|
|
|
2859
2897
|
export interface DraftPlaybookInput {
|
|
2860
2898
|
/** The job, as people name it. */
|
|
2861
2899
|
title: string;
|
|
2862
|
-
/** The outcome. Becomes the objective of every run. */
|
|
2900
|
+
/** The outcome. Becomes the objective of every run; for a prompt, the one line people see. */
|
|
2863
2901
|
purpose: string;
|
|
2864
|
-
|
|
2902
|
+
/** Required for a playbook; left out for a prompt, which has one step of its own. */
|
|
2903
|
+
steps?: {
|
|
2865
2904
|
key?: string;
|
|
2866
2905
|
title: string;
|
|
2867
2906
|
instruction: string;
|
|
@@ -2873,6 +2912,39 @@ export interface DraftPlaybookInput {
|
|
|
2873
2912
|
knowledgeIds?: string[];
|
|
2874
2913
|
workspaceId?: string;
|
|
2875
2914
|
note?: string;
|
|
2915
|
+
/** Send instead of `steps` to draft an approved prompt. */
|
|
2916
|
+
prompt?: {
|
|
2917
|
+
/** The words, with each input as `{input name}`. */
|
|
2918
|
+
text: string;
|
|
2919
|
+
limitations?: string;
|
|
2920
|
+
department?: string;
|
|
2921
|
+
/** Such as Analyze, Create or Edit. */
|
|
2922
|
+
taskType?: string;
|
|
2923
|
+
/** Such as en-GB. */
|
|
2924
|
+
language?: string;
|
|
2925
|
+
/** The member who owns it; whoever drafts it when omitted. */
|
|
2926
|
+
ownerEmail?: string;
|
|
2927
|
+
/** YYYY-MM-DD; six months on when omitted. */
|
|
2928
|
+
reviewDueOn?: string;
|
|
2929
|
+
/** Run as a playbook, a person reviews the output before it is used. */
|
|
2930
|
+
checkOutput?: boolean;
|
|
2931
|
+
};
|
|
2932
|
+
}
|
|
2933
|
+
|
|
2934
|
+
export interface UsePromptInput {
|
|
2935
|
+
/** The prompt's inputs, by name. A placeholder not given stays in the words. */
|
|
2936
|
+
inputs?: Record<string, string>;
|
|
2937
|
+
}
|
|
2938
|
+
|
|
2939
|
+
export interface UsedPrompt {
|
|
2940
|
+
prompt: { id: string; title: string; version: number; url: string };
|
|
2941
|
+
/** The approved words with the inputs put in. */
|
|
2942
|
+
text: string;
|
|
2943
|
+
/** Required inputs not given; their placeholders are still in `text`. */
|
|
2944
|
+
missingInputs: string[];
|
|
2945
|
+
limitations: string | null;
|
|
2946
|
+
/** True when you named an older version and the one in force was handed out instead. */
|
|
2947
|
+
ranOlderVersion: boolean;
|
|
2876
2948
|
}
|
|
2877
2949
|
|
|
2878
2950
|
export interface StartPlaybookInput {
|