@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.
Files changed (58) hide show
  1. package/README.md +104 -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 +395 -0
  16. package/dist/decision-token.d.ts +102 -0
  17. package/dist/decision-token.d.ts.map +1 -0
  18. package/dist/decision-token.js +139 -0
  19. package/dist/dev.d.ts.map +1 -1
  20. package/dist/dev.js +57 -2
  21. package/dist/gates.d.ts +2 -0
  22. package/dist/gates.d.ts.map +1 -1
  23. package/dist/gates.js +3 -0
  24. package/dist/governance.d.ts +94 -0
  25. package/dist/governance.d.ts.map +1 -0
  26. package/dist/governance.js +166 -0
  27. package/dist/index.d.ts +31 -0
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +35 -0
  30. package/dist/messages.d.ts.map +1 -1
  31. package/dist/messages.js +4 -0
  32. package/dist/released.d.ts +1 -1
  33. package/dist/released.d.ts.map +1 -1
  34. package/dist/released.js +3803 -0
  35. package/dist/screen.d.ts +85 -0
  36. package/dist/screen.d.ts.map +1 -0
  37. package/dist/screen.js +69 -0
  38. package/dist/tasks.d.ts +38 -1
  39. package/dist/tasks.d.ts.map +1 -1
  40. package/dist/tasks.js +67 -0
  41. package/dist/types.d.ts +656 -4
  42. package/dist/types.d.ts.map +1 -1
  43. package/package.json +2 -2
  44. package/src/adapters/index.ts +11 -0
  45. package/src/adapters/mastra.ts +118 -0
  46. package/src/adapters/muse-spark.ts +147 -0
  47. package/src/adapters/shared.ts +2 -1
  48. package/src/data-screen.ts +536 -0
  49. package/src/decision-token.ts +184 -0
  50. package/src/dev.ts +63 -2
  51. package/src/gates.ts +3 -0
  52. package/src/governance.ts +204 -0
  53. package/src/index.ts +60 -0
  54. package/src/messages.ts +4 -0
  55. package/src/released.ts +3804 -0
  56. package/src/screen.ts +144 -0
  57. package/src/tasks.ts +88 -0
  58. package/src/types.ts +646 -4
package/dist/types.d.ts CHANGED
@@ -227,6 +227,12 @@ export interface GateData {
227
227
  description: string | null;
228
228
  requestedBy: string;
229
229
  createdAt: string | null;
230
+ /**
231
+ * The yes, signed, while `canExecute` is true and the deployment signs:
232
+ * pass it to the code that performs the action, which checks it with
233
+ * `deliverd.decisionTokens.verify` before it acts. Null otherwise.
234
+ */
235
+ decisionToken?: string | null;
230
236
  /** Returned once, by the call that made the gate and named a callbackUrl. */
231
237
  callbackSecret?: string;
232
238
  /** On a single read: what has been reported against it. */
@@ -250,6 +256,8 @@ export interface GateDecision {
250
256
  changes: FieldChange[];
251
257
  id: string;
252
258
  approvalUrl: string | null;
259
+ /** The signed yes, for the code that performs the action to verify. Null unless it may be acted on now. */
260
+ decisionToken: string | null;
253
261
  gate: unknown;
254
262
  }
255
263
  /** One field an approver corrected before approving. */
@@ -275,6 +283,24 @@ export interface ApprovalQuestion {
275
283
  askedAt: string;
276
284
  answeredAt: string | null;
277
285
  }
286
+ /**
287
+ * Which agent is asking, as you describe it on a request. Every field is
288
+ * optional; name the ones you know.
289
+ */
290
+ export interface RequestAgent {
291
+ /** What the agent is called, as people know it. */
292
+ name?: string;
293
+ /** Who makes or runs it: anthropic, openai, cursor, your own company. */
294
+ provider?: string;
295
+ /** Your own id for this agent. */
296
+ externalId?: string;
297
+ }
298
+ /** The agent a request declared, as the API returns it. */
299
+ export interface DeclaredAgent {
300
+ name: string | null;
301
+ provider: string | null;
302
+ externalId: string | null;
303
+ }
278
304
  export interface ApprovalData {
279
305
  id: string;
280
306
  status: ApprovalStatus;
@@ -325,6 +351,10 @@ export interface ApprovalData {
325
351
  note: string | null;
326
352
  expiresAt: string | null;
327
353
  questions: ApprovalQuestion[];
354
+ /** Which agent asked, as the request declared it. Null when it said nothing. Not verified. */
355
+ agent: DeclaredAgent | null;
356
+ /** The model the request said the agent was running on. Not verified. */
357
+ model: string | null;
328
358
  createdAt: string;
329
359
  }
330
360
  export interface CreateApprovalInput {
@@ -363,6 +393,14 @@ export interface CreateApprovalInput {
363
393
  * siblings set this for you.
364
394
  */
365
395
  flowId?: string;
396
+ /**
397
+ * Which agent is asking, in your words. One key is often shared by
398
+ * several agents; this says which one was holding it. Recorded, returned
399
+ * and shown as declared — nothing is decided on it.
400
+ */
401
+ agent?: RequestAgent;
402
+ /** The model the agent is running on, such as `claude-opus-5`. Recorded as declared. */
403
+ model?: string;
366
404
  /**
367
405
  * Where to POST the outcome when a person answers, instead of polling:
368
406
  * HTTPS, and a public address. The call that makes the request returns the
@@ -695,7 +733,11 @@ export type WebhookEventName = "report.published" | "report.updated" | "report.s
695
733
  | "task.completed"
696
734
  /** Opt-in: a task moved into blocked, or a side task finished and its
697
735
  * result waits to be applied, kept or discarded. */
698
- | "task.blocked" | "side_task.completed";
736
+ | "task.blocked" | "side_task.completed"
737
+ /** An AI risk indicator went red for a month: its figure, limits and owner. */
738
+ | "risk_indicator.breached"
739
+ /** Opt-in: one audit log entry, with its chain position and hashes. For a SIEM. */
740
+ | "audit.event";
699
741
  export interface WebhookEvent {
700
742
  event: WebhookEventName;
701
743
  sentAt: string;
@@ -705,10 +747,11 @@ export interface WebhookEvent {
705
747
  }
706
748
  /**
707
749
  * How an endpoint's body is shaped: the signed JSON envelope, a Slack Block
708
- * Kit message for an Incoming Webhook, or a Teams Adaptive Card for a
709
- * Workflows webhook. The signature headers are sent with all three.
750
+ * Kit message for an Incoming Webhook, a Teams Adaptive Card for a Workflows
751
+ * webhook, or a Discord embed with a link button for a channel webhook. The
752
+ * signature headers are sent with all four.
710
753
  */
711
- export type WebhookEndpointFormat = "json" | "slack" | "teams";
754
+ export type WebhookEndpointFormat = "json" | "slack" | "teams" | "discord";
712
755
  /** An organisation's webhook endpoint, as `deliverd.webhookEndpoints` reads it. Never its secret. */
713
756
  export interface WebhookEndpoint {
714
757
  id: string;
@@ -815,6 +858,14 @@ export interface CreateReviewInput {
815
858
  * siblings set this for you.
816
859
  */
817
860
  flowId?: string;
861
+ /**
862
+ * Which agent is asking, in your words. One key is often shared by
863
+ * several agents; this says which one was holding it. Recorded, returned
864
+ * and shown as declared — nothing is decided on it.
865
+ */
866
+ agent?: RequestAgent;
867
+ /** The model the agent is running on, such as `claude-opus-5`. Recorded as declared. */
868
+ model?: string;
818
869
  /**
819
870
  * Where to POST the outcome when a person answers, instead of polling:
820
871
  * HTTPS, and a public address. The call that makes the request returns the
@@ -854,6 +905,10 @@ export interface ReviewData {
854
905
  threadCount: number;
855
906
  settledAt: string | null;
856
907
  expiresAt: string | null;
908
+ /** Which agent asked, as the request declared it. Null when it said nothing. Not verified. */
909
+ agent: DeclaredAgent | null;
910
+ /** The model the request said the agent was running on. Not verified. */
911
+ model: string | null;
857
912
  createdAt: string;
858
913
  }
859
914
  /** The answer, flattened — what `review()` hands back. */
@@ -919,6 +974,14 @@ export interface CreateCollectionInput {
919
974
  * siblings set this for you.
920
975
  */
921
976
  flowId?: string;
977
+ /**
978
+ * Which agent is asking, in your words. One key is often shared by
979
+ * several agents; this says which one was holding it. Recorded, returned
980
+ * and shown as declared — nothing is decided on it.
981
+ */
982
+ agent?: RequestAgent;
983
+ /** The model the agent is running on, such as `claude-opus-5`. Recorded as declared. */
984
+ model?: string;
922
985
  /**
923
986
  * Where to POST the outcome when a person answers, instead of polling:
924
987
  * HTTPS, and a public address. The call that makes the request returns the
@@ -966,6 +1029,10 @@ export interface CollectionData {
966
1029
  settledAt: string | null;
967
1030
  dueAt: string | null;
968
1031
  expiresAt: string | null;
1032
+ /** Which agent asked, as the request declared it. Null when it said nothing. Not verified. */
1033
+ agent: DeclaredAgent | null;
1034
+ /** The model the request said the agent was running on. Not verified. */
1035
+ model: string | null;
969
1036
  createdAt: string;
970
1037
  }
971
1038
  /** The answers, flattened — what `collect()` hands back. */
@@ -1555,6 +1622,549 @@ export interface GovernanceGate {
1555
1622
  missingControls: string[];
1556
1623
  blockers: GovernanceBlocker[];
1557
1624
  }
1625
+ export type GovernanceRisk = "low" | "medium" | "high" | "critical";
1626
+ export type GovernanceOversight = NonNullable<GovernanceProfileInput["oversight"]>;
1627
+ export type DataClassification = NonNullable<GovernanceProfileInput["dataClassification"]>;
1628
+ /** Something governed work does, for the authority check. */
1629
+ export type AuthorityAction = "read" | "analyse" | "recommend" | "draft" | "modify" | "execute" | "publish" | "deploy" | "send" | "delete" | "financial_action" | "customer_decision";
1630
+ /** One entry in the organisation's register of AI systems. */
1631
+ export interface AiSystem {
1632
+ id: string;
1633
+ orgId: string;
1634
+ name: string;
1635
+ provider: string | null;
1636
+ model: string | null;
1637
+ modelVersion: string | null;
1638
+ /** A digest of the prompt it runs with, never the prompt. */
1639
+ promptHash: string | null;
1640
+ /** A digest of its guardrail configuration. */
1641
+ guardrailsHash: string | null;
1642
+ purpose: string | null;
1643
+ businessOwner: string | null;
1644
+ technicalOwner: string | null;
1645
+ environment: "development" | "pilot" | "production";
1646
+ risk: GovernanceRisk;
1647
+ oversight: GovernanceOversight | null;
1648
+ dataClassification: DataClassification | null;
1649
+ personalData: boolean;
1650
+ customerFacing: boolean;
1651
+ status: "active" | "retired";
1652
+ /** The contract in the ICT third-party register it runs under. */
1653
+ ictArrangementId: string | null;
1654
+ createdByLabel: string;
1655
+ createdAt: string;
1656
+ updatedAt: string;
1657
+ }
1658
+ export interface RegisterAiSystemInput {
1659
+ name: string;
1660
+ /** OpenAI, Anthropic, an internal team… */
1661
+ provider?: string | null;
1662
+ model?: string | null;
1663
+ modelVersion?: string | null;
1664
+ /** A digest of the prompt (`sha256:…`, a commit, a version tag), never the prompt. */
1665
+ promptHash?: string | null;
1666
+ /** A digest of the guardrail configuration, never the configuration. */
1667
+ guardrailsHash?: string | null;
1668
+ purpose?: string | null;
1669
+ businessOwner?: string | null;
1670
+ technicalOwner?: string | null;
1671
+ environment?: AiSystem["environment"];
1672
+ risk?: GovernanceRisk;
1673
+ oversight?: GovernanceOversight | null;
1674
+ dataClassification?: DataClassification | null;
1675
+ personalData?: boolean;
1676
+ customerFacing?: boolean;
1677
+ /** The contract in the ICT third-party register it runs under. */
1678
+ ictArrangementId?: string | null;
1679
+ }
1680
+ /** An agent may raise a system's risk but not lower it, and may not retire it. */
1681
+ export interface UpdateAiSystemInput extends Partial<RegisterAiSystemInput> {
1682
+ status?: AiSystem["status"];
1683
+ }
1684
+ /** One AI system, and the governed tasks that name it. */
1685
+ export interface AiSystemDetail {
1686
+ system: AiSystem;
1687
+ governedTaskIds: string[];
1688
+ }
1689
+ /** A new provider, model, version, prompt or guardrails for a system. Name at least one. */
1690
+ export interface ModelChangeInput {
1691
+ provider?: string | null;
1692
+ model?: string | null;
1693
+ modelVersion?: string | null;
1694
+ promptHash?: string | null;
1695
+ guardrailsHash?: string | null;
1696
+ /** What changed and why, for the record. */
1697
+ note?: string;
1698
+ }
1699
+ export interface ModelChangeResult {
1700
+ system: AiSystem;
1701
+ /** The reassessment opened on each governed task that uses it. */
1702
+ reassessments: Reassessment[];
1703
+ /** Which of provider, model, modelVersion, promptHash and guardrailsHash changed. */
1704
+ changed: string[];
1705
+ }
1706
+ /** A governed task's reassessment. Its governance gate stays closed until a person completes it. */
1707
+ export interface Reassessment {
1708
+ id: string;
1709
+ taskId: string;
1710
+ trigger: "profile_change" | "model_change" | "framework_version" | "policy_version" | "incident" | "manual";
1711
+ changes: {
1712
+ field: string;
1713
+ before: unknown;
1714
+ after: unknown;
1715
+ label: string;
1716
+ }[];
1717
+ /** Controls to look at again. */
1718
+ recheck: string[];
1719
+ reason: string;
1720
+ status: "open" | "completed";
1721
+ openedByLabel: string;
1722
+ openedByAgentId: string | null;
1723
+ openedAt: string;
1724
+ completedByLabel: string | null;
1725
+ completedAt: string | null;
1726
+ completionNote: string | null;
1727
+ }
1728
+ export interface ReassessmentResult {
1729
+ reassessment: Reassessment;
1730
+ governance: Governance;
1731
+ }
1732
+ /** What an agent may do: on its own, only with a person's approval, or not at all. */
1733
+ export interface AuthorityDecision {
1734
+ action: AuthorityAction;
1735
+ mode: "allowed" | "approval" | "denied";
1736
+ /** Which setting decided it: the organisation's, the agent's own, or the default. */
1737
+ source: "organisation" | "agent" | "default";
1738
+ reason: string;
1739
+ agentId: string | null;
1740
+ agentName: string | null;
1741
+ }
1742
+ export interface CheckAuthorityInput {
1743
+ action: AuthorityAction;
1744
+ /** An agent of this organisation; the agent whose key this is when omitted. */
1745
+ agentId?: string;
1746
+ }
1747
+ export interface ReportIncidentInput {
1748
+ /** The governed task it concerns. Give this, `aiSystemId`, or both. */
1749
+ taskId?: string;
1750
+ /** The AI system it concerns; the task's own when only `taskId` is given. */
1751
+ aiSystemId?: string;
1752
+ title: string;
1753
+ description?: string;
1754
+ /** `high` or `critical` closes the task's governance gate until a person resolves it. */
1755
+ severity: GovernanceRisk;
1756
+ /** When the organisation became aware of it, if earlier than now. DORA's clocks start here. */
1757
+ detectedAt?: string;
1758
+ }
1759
+ /** A DORA classification a person recorded. */
1760
+ export interface DoraClassification {
1761
+ facts: Record<string, unknown>;
1762
+ major: boolean;
1763
+ criteria: {
1764
+ criterion: string;
1765
+ met: boolean;
1766
+ detail: string;
1767
+ }[];
1768
+ /** The verdict in a sentence. */
1769
+ reason: string;
1770
+ /** Which version of the rules worked it out. */
1771
+ rules: string;
1772
+ }
1773
+ export interface AiIncident {
1774
+ id: string;
1775
+ taskId: string | null;
1776
+ aiSystemId: string | null;
1777
+ title: string;
1778
+ description: string;
1779
+ severity: GovernanceRisk;
1780
+ status: "open" | "resolved";
1781
+ reportedByLabel: string;
1782
+ reportedByAgentId: string | null;
1783
+ reportedAt: string;
1784
+ resolution: string | null;
1785
+ resolvedByLabel: string | null;
1786
+ resolvedAt: string | null;
1787
+ detectedAt: string;
1788
+ /** Null until a person classifies it. */
1789
+ dora: DoraClassification | null;
1790
+ /** When it was first classified major; the reporting clock runs from here. */
1791
+ doraMajorAt: string | null;
1792
+ doraClassifiedAt: string | null;
1793
+ doraClassifiedBy: string | null;
1794
+ }
1795
+ export type DoraReportKind = "initial" | "intermediate" | "final" | "reclassification";
1796
+ export interface IncidentReport {
1797
+ id: string;
1798
+ incidentId: string;
1799
+ kind: DoraReportKind;
1800
+ content: string;
1801
+ fields: Record<string, unknown>;
1802
+ approvalId: string | null;
1803
+ /** The sign-off approval's state; null when none was asked for. */
1804
+ approvalStatus: string | null;
1805
+ submittedAt: string | null;
1806
+ submittedByLabel: string | null;
1807
+ authorityReference: string | null;
1808
+ createdByLabel: string;
1809
+ createdByAgentId: string | null;
1810
+ createdAt: string;
1811
+ }
1812
+ export interface ReportingStep {
1813
+ kind: DoraReportKind;
1814
+ /** Null until the step before it is done. */
1815
+ dueAt: string | null;
1816
+ submittedAt: string | null;
1817
+ overdue: boolean;
1818
+ late: boolean;
1819
+ }
1820
+ /** Which DORA report is due next and by when. Nothing is due unless the incident is classified major. */
1821
+ export interface ReportingSchedule {
1822
+ required: boolean;
1823
+ steps: ReportingStep[];
1824
+ next: ReportingStep | null;
1825
+ }
1826
+ /** One incident with its reports and reporting schedule. */
1827
+ export interface AiIncidentDetail {
1828
+ id: string;
1829
+ taskId: string | null;
1830
+ aiSystemId: string | null;
1831
+ title: string;
1832
+ description: string;
1833
+ severity: GovernanceRisk;
1834
+ status: "open" | "resolved";
1835
+ reportedByLabel: string;
1836
+ reportedByAgentId: string | null;
1837
+ reportedAt: string;
1838
+ resolution: string | null;
1839
+ resolvedByLabel: string | null;
1840
+ resolvedAt: string | null;
1841
+ detectedAt: string;
1842
+ /** Null until a person classifies it. */
1843
+ dora: DoraClassification | null;
1844
+ /** When it was first classified major; the reporting clock runs from here. */
1845
+ doraMajorAt: string | null;
1846
+ doraClassifiedAt: string | null;
1847
+ doraClassifiedBy: string | null;
1848
+ url: string;
1849
+ reports: IncidentReport[];
1850
+ schedule: ReportingSchedule;
1851
+ /** Notified as major, now classified as not, and the authority not yet told. */
1852
+ reclassificationOwed: boolean;
1853
+ }
1854
+ export interface ListIncidentsInput {
1855
+ status?: "open" | "resolved";
1856
+ aiSystemId?: string;
1857
+ /** One page of this size. Leave it unset to get every row. */
1858
+ limit?: number;
1859
+ cursor?: string;
1860
+ }
1861
+ export interface DraftIncidentReportInput {
1862
+ kind: DoraReportKind;
1863
+ /** What the report says, for the person who signs it off and for the authority. */
1864
+ content: string;
1865
+ /**
1866
+ * The report's structured fields. initial: discoveredBy, memberStates,
1867
+ * originatedAtThirdParty, businessContinuityActivated; intermediate:
1868
+ * incidentType, occurredAt, recoveredAt, authorityReference, clientsAffected,
1869
+ * figuresAreEstimates, temporaryMeasures; final: rootCause,
1870
+ * rootCauseAddressedAt, resolvedAt, grossCostsEur, financialRecoveriesEur;
1871
+ * reclassification: reason.
1872
+ */
1873
+ fields?: Record<string, unknown>;
1874
+ /** Who signs it off; the organisation's administrators when omitted. */
1875
+ approvers?: string[];
1876
+ }
1877
+ export interface DraftedIncidentReport {
1878
+ incident: AiIncidentDetail;
1879
+ reportId: string;
1880
+ approvalId: string;
1881
+ approvalUrl: string;
1882
+ }
1883
+ /** Conditions on a governance profile under which a requirement applies. Every one given must hold. */
1884
+ export interface RequirementAppliesWhen {
1885
+ minRisk?: GovernanceRisk;
1886
+ personalData?: boolean;
1887
+ customerFacing?: boolean;
1888
+ productionUse?: boolean;
1889
+ decisionImpact?: NonNullable<GovernanceProfileInput["decisionImpact"]>[];
1890
+ }
1891
+ export interface FrameworkRequirement {
1892
+ /** The framework's own reference: an article, a clause. */
1893
+ ref: string;
1894
+ title: string;
1895
+ /** Controls that evidence it: common ones, or the organisation's own `custom_` controls. */
1896
+ controls: string[];
1897
+ appliesWhen?: RequirementAppliesWhen;
1898
+ }
1899
+ export interface FrameworkSummary {
1900
+ key: string;
1901
+ name: string;
1902
+ version: string;
1903
+ versions: string[];
1904
+ source: string;
1905
+ summary: string;
1906
+ jurisdictions: string[];
1907
+ builtIn: boolean;
1908
+ status: "published" | "draft" | "retired";
1909
+ requirements: FrameworkRequirement[];
1910
+ /** Whether and at which version the organisation applies it. */
1911
+ adoption: {
1912
+ frameworkKey: string;
1913
+ version: string;
1914
+ active: boolean;
1915
+ adoptedByLabel: string;
1916
+ adoptedAt: string;
1917
+ updatedAt: string;
1918
+ } | null;
1919
+ }
1920
+ export interface CustomFramework {
1921
+ id: string;
1922
+ key: string;
1923
+ version: string;
1924
+ name: string;
1925
+ summary: string;
1926
+ jurisdictions: string[];
1927
+ requirements: FrameworkRequirement[];
1928
+ status: "draft" | "published" | "retired";
1929
+ effectiveFrom: string | null;
1930
+ publishedAt: string | null;
1931
+ publishedByLabel: string | null;
1932
+ createdByLabel: string;
1933
+ createdByAgentId: string | null;
1934
+ createdAt: string;
1935
+ }
1936
+ export interface CustomControl {
1937
+ id: string;
1938
+ key: string;
1939
+ title: string;
1940
+ description: string;
1941
+ family: string;
1942
+ satisfiedBy: "evidence" | "approval";
1943
+ status: "active" | "retired";
1944
+ createdByLabel: string;
1945
+ createdAt: string;
1946
+ }
1947
+ /** Every framework the organisation can see: the built-in packs and its own. */
1948
+ export interface FrameworkCatalogue {
1949
+ frameworks: FrameworkSummary[];
1950
+ /** The organisation's own frameworks, every version (Enterprise). */
1951
+ custom: CustomFramework[];
1952
+ customControls: CustomControl[];
1953
+ canAdopt: boolean;
1954
+ canWriteCustom: boolean;
1955
+ statement: string;
1956
+ }
1957
+ /** An organisation's own framework (Enterprise). A draft adds nothing until a person publishes and applies it. */
1958
+ export interface CreateCustomFrameworkInput {
1959
+ /** `custom_` followed by lower case letters, digits and underscores. */
1960
+ key: string;
1961
+ /** e.g. `1.0` or `2026.10`. A change to a published framework is a new version. */
1962
+ version: string;
1963
+ name: string;
1964
+ summary?: string;
1965
+ jurisdictions?: string[];
1966
+ /** An ISO date. */
1967
+ effectiveFrom?: string;
1968
+ requirements: FrameworkRequirement[];
1969
+ }
1970
+ export interface RequirementCoverage {
1971
+ ref: string;
1972
+ title: string;
1973
+ applies: boolean;
1974
+ controls: {
1975
+ key: string;
1976
+ status: "outstanding" | "satisfied" | "waived" | "missing";
1977
+ }[];
1978
+ /** Every mapped control satisfied or waived. Not "compliant": covered by controls that are done. */
1979
+ covered: boolean;
1980
+ }
1981
+ /** How requirements map onto controls and, for a task, how far its controls cover each. Never a compliance verdict. */
1982
+ export interface FrameworkMapping {
1983
+ taskId: string | null;
1984
+ frameworks: {
1985
+ key: string;
1986
+ name: string;
1987
+ version: string;
1988
+ source: string;
1989
+ /** Adopted by the organisation and so adding controls to the task. */
1990
+ applied: boolean;
1991
+ applies: boolean;
1992
+ covered: number;
1993
+ applicable: number;
1994
+ requirements: RequirementCoverage[];
1995
+ }[];
1996
+ statement: string;
1997
+ }
1998
+ export interface FrameworkMappingInput {
1999
+ /** A governed task, to see how far its controls cover each requirement. */
2000
+ taskId?: string;
2001
+ /** One framework's key. */
2002
+ framework?: string;
2003
+ }
2004
+ /** An entry in the ICT third-party register, with what it still lacks. Its other fields follow the DORA register templates. */
2005
+ export interface IctRegisterEntry {
2006
+ id: string;
2007
+ gaps: unknown[];
2008
+ [field: string]: unknown;
2009
+ }
2010
+ /** The ICT third-party register, kept by a person in the app. Read-only here. */
2011
+ export interface IctRegister {
2012
+ entity: Record<string, unknown> | null;
2013
+ providers: (IctRegisterEntry & {
2014
+ name: string;
2015
+ })[];
2016
+ arrangements: (IctRegisterEntry & {
2017
+ providerId: string;
2018
+ providerName: string;
2019
+ aiSystems: {
2020
+ id: string;
2021
+ name: string;
2022
+ environment: AiSystem["environment"];
2023
+ }[];
2024
+ })[];
2025
+ /** How many AI systems, and which critical or important functions, depend on each provider. */
2026
+ concentration: Record<string, unknown>[];
2027
+ /** Active AI systems not yet linked to an arrangement. */
2028
+ unregisteredSystems: {
2029
+ id: string;
2030
+ name: string;
2031
+ environment: AiSystem["environment"];
2032
+ }[];
2033
+ /** Which version of the regulation's lists this follows. */
2034
+ rules: string;
2035
+ }
2036
+ export interface GovernanceSummaryInput {
2037
+ aiSystemId?: string;
2038
+ risk?: GovernanceRisk;
2039
+ owner?: string;
2040
+ provider?: string;
2041
+ dataClassification?: string;
2042
+ /** Enterprise. */
2043
+ jurisdiction?: string;
2044
+ /** Enterprise: tasks held to this framework. */
2045
+ framework?: string;
2046
+ }
2047
+ /** The organisation's AI governance in counts. Never a compliance percentage. */
2048
+ export interface GovernanceSummary {
2049
+ aiSystems: number;
2050
+ production: number;
2051
+ elevatedOrHighRisk: number;
2052
+ governedTasks: number;
2053
+ outstandingControls: number;
2054
+ approvalsPending: number;
2055
+ expiredExceptions: number;
2056
+ openIncidents: number;
2057
+ tasksRequiringReview: number;
2058
+ systemsRequiringReview: number;
2059
+ tasks: {
2060
+ taskId: string;
2061
+ title: string;
2062
+ risk: GovernanceRisk;
2063
+ aiSystem: string | null;
2064
+ controls: {
2065
+ required: number;
2066
+ outstanding: number;
2067
+ };
2068
+ reassessmentOpen: boolean;
2069
+ reviewOverdue: boolean;
2070
+ }[];
2071
+ filters: GovernanceSummaryInput;
2072
+ advancedFilters: boolean;
2073
+ }
2074
+ /**
2075
+ * A governed task's evidence pack: profile, controls, evidence, task graph,
2076
+ * decisions, approvals and the audit timeline, with a digest. It assists
2077
+ * audit; it does not certify compliance. Every export is audited.
2078
+ */
2079
+ export interface GovernancePack {
2080
+ packKind: "ai_governance";
2081
+ packVersion: number;
2082
+ generatedAt: string;
2083
+ generatedBy: string;
2084
+ organisation: {
2085
+ id: string;
2086
+ name: string;
2087
+ };
2088
+ statement: string;
2089
+ subject: {
2090
+ taskId: string;
2091
+ title: string;
2092
+ objective: string;
2093
+ url: string;
2094
+ };
2095
+ aiSystem: AiSystem | null;
2096
+ profile: GovernanceProfileInput & {
2097
+ requiredByPolicy: boolean;
2098
+ };
2099
+ readiness: GovernanceReadiness;
2100
+ gate: GovernanceGate;
2101
+ controls: GovernanceControl[];
2102
+ evidence: GovernanceEvidence[];
2103
+ frameworks: (GovernanceFramework & {
2104
+ requirements: RequirementCoverage[];
2105
+ })[];
2106
+ frameworkStatement: string | null;
2107
+ policies: Record<string, unknown>[];
2108
+ exceptions: Record<string, unknown>[];
2109
+ review: Record<string, unknown>;
2110
+ reassessments: Reassessment[];
2111
+ incidents: AiIncident[];
2112
+ thirdParty: Record<string, unknown> | null;
2113
+ doraReporting: Record<string, unknown>[];
2114
+ taskGraph: {
2115
+ id: string;
2116
+ parentTaskId: string | null;
2117
+ kind: string;
2118
+ title: string;
2119
+ status: string;
2120
+ outcome: string | null;
2121
+ result: string | null;
2122
+ }[];
2123
+ findings: {
2124
+ taskId: string;
2125
+ kind: string;
2126
+ title: string;
2127
+ body: string;
2128
+ decisionStatus: string | null;
2129
+ decidedBy: string | null;
2130
+ recordedBy: string;
2131
+ at: string;
2132
+ }[];
2133
+ approvals: {
2134
+ id: string;
2135
+ status: string;
2136
+ for: string;
2137
+ }[];
2138
+ timeline: {
2139
+ at: string;
2140
+ event: string;
2141
+ actor: string;
2142
+ actorType: string;
2143
+ metadata: Record<string, unknown>;
2144
+ }[];
2145
+ integrity: {
2146
+ algorithm: "sha256";
2147
+ digest: string;
2148
+ covers: string;
2149
+ doesNotCover: string;
2150
+ };
2151
+ }
2152
+ export interface UpdateGovernanceProfileInput extends GovernanceProfileInput {
2153
+ /** The version you read; refused if somebody wrote in between. */
2154
+ expectedVersion?: number;
2155
+ }
2156
+ export interface ControlApprovalInput {
2157
+ /** Emails, names or groups; the organisation's administrators when omitted. */
2158
+ approvers?: string[];
2159
+ note?: string;
2160
+ /** An ISO time. */
2161
+ expiresAt?: string;
2162
+ }
2163
+ export interface ControlApprovalResult {
2164
+ governance: Governance;
2165
+ approvalId: string;
2166
+ approvalUrl: string;
2167
+ }
1558
2168
  export interface ListTasksInput {
1559
2169
  /** A status, or `active` for anything not completed or cancelled. */
1560
2170
  status?: TaskStatus | "active";
@@ -1720,4 +2330,46 @@ export interface CallbackEnvelope {
1720
2330
  requestId: string;
1721
2331
  data: Record<string, unknown>;
1722
2332
  }
2333
+ /** `allow` | `redact` | `ask` | `deny`: what may happen to text bound for a model. */
2334
+ export type ScreenVerdict = "allow" | "redact" | "ask" | "deny";
2335
+ /** The AI register's record for the model the text is going to. */
2336
+ export interface ScreenTargetData {
2337
+ aiSystemId: string;
2338
+ name: string;
2339
+ /** The highest classification it is approved to receive; null when the record does not say. */
2340
+ approvedClassification: string | null;
2341
+ personalData: boolean;
2342
+ }
2343
+ /** Where one finding is in the text you screened. Never its value. */
2344
+ export interface ScreenFindingData {
2345
+ kind: string;
2346
+ label: string;
2347
+ start: number;
2348
+ end: number;
2349
+ }
2350
+ export interface ScreenApprovalRef {
2351
+ id: string;
2352
+ url: string;
2353
+ status: string;
2354
+ }
2355
+ /** What `POST /screen` answers: the verdict, and why. */
2356
+ export interface ScreenData {
2357
+ verdict: ScreenVerdict;
2358
+ /** Whether the text may be sent now: as it is for `allow`, redacted for `redact`. */
2359
+ allowed: boolean;
2360
+ classification: "public" | "internal" | "confidential" | "restricted";
2361
+ personalData: boolean;
2362
+ categories: string[];
2363
+ /** What was found, by kind. */
2364
+ counts: Record<string, number>;
2365
+ /** The kinds behind the verdict: what redaction replaces. */
2366
+ offending: string[];
2367
+ reasons: string[];
2368
+ target: ScreenTargetData | null;
2369
+ /** Only when the server read the text. The SDK screens locally, so this is null from `screen()`. */
2370
+ findings: ScreenFindingData[] | null;
2371
+ redactedText: string | null;
2372
+ /** The approval a person decides, for an `ask` verdict. */
2373
+ approval: ScreenApprovalRef | null;
2374
+ }
1723
2375
  //# sourceMappingURL=types.d.ts.map