@anybio/govern 0.2.1 → 0.3.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/CHANGELOG.md +45 -0
- package/README.md +115 -30
- package/dist/adapters-DBLr_Frn.d.cts +39 -0
- package/dist/adapters-DBLr_Frn.d.ts +39 -0
- package/dist/chunk-3JV2R5IW.js +64 -0
- package/dist/chunk-CPNPQMEU.js +1860 -0
- package/dist/chunk-I5XIXB5M.cjs +1910 -0
- package/dist/chunk-XZHZBIZA.cjs +72 -0
- package/dist/cli.js +465 -115
- package/dist/{client-CU46a__g.d.cts → client-BeyMec7E.d.cts} +870 -152
- package/dist/{client-CU46a__g.d.ts → client-BeyMec7E.d.ts} +870 -152
- package/dist/index.cjs +165 -1536
- package/dist/index.d.cts +49 -7
- package/dist/index.d.ts +49 -7
- package/dist/index.js +1 -1503
- package/dist/langchain.cjs +65 -1501
- package/dist/langchain.d.cts +154 -17
- package/dist/langchain.d.ts +154 -17
- package/dist/langchain.js +59 -1495
- package/dist/vercel-ai.cjs +106 -1526
- package/dist/vercel-ai.d.cts +129 -8
- package/dist/vercel-ai.d.ts +129 -8
- package/dist/vercel-ai.js +100 -1520
- package/package.json +22 -21
- package/spec/README.md +17 -0
- package/spec/openapi.json +752 -158
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { R as ReportedOutcomeKind } from './client-BeyMec7E.cjs';
|
|
2
|
+
export { A as AUDIENCES, a as Audience, C as CHANNELS, b as Channel, D as DEFAULT_BASE_URL, c as DEFAULT_HOLD_MESSAGE, d as DEFAULT_MAX_RETRIES, e as DEFAULT_TIMEOUT_MS, f as Decision, g as DecisionStatus, h as DecisionVerdict, i as DecisionWebhookEvent, j as Disclosure, k as DisclosureAttachment, l as Draft, E as EvaluateInput, G as Govern, m as GovernEvent, n as GovernHandoffs, o as GovernOptions, p as GuardContext, q as GuardResult, H as Handoff, r as HandoffActionInput, s as HandoffContactInput, t as HandoffDetail, u as HandoffList, v as HandoffListQuery, w as HandoffRef, x as HandoffResolveInput, y as HandoffResumeInput, z as HandoffWebhookEvent, B as HeadersLike, I as IN_SESSION_CHANNELS, F as InboundFlag, J as InboundMessage, M as MAX_CONVERSATION_ID_CHARS, K as MAX_SUPERSEDES, L as MAX_TURN_ID_CHARS, N as MAX_TURN_REF_CHARS, O as Mode, P as OUTCOME_REASONS, Q as Outcome, S as OutcomeEvent, T as OutcomeKind, U as OutcomeSource, V as PatientConsentInput, W as PatientOptOutInput, X as PolicyRef, Y as REASONS, Z as RESERVED_TURN_ID_PREFIX, _ as RecordDisclosureInput, $ as ReleaseResult, a0 as ReportOutcomeInput, a1 as ReviewState, a2 as Schemas, a3 as StopClass, a4 as SubmitTranscriptsInput, a5 as TRANSIENT_HTTP_STATUSES, a6 as TranscriptJob, a7 as TranscriptTurnInput, a8 as UnknownWebhookEvent, a9 as VerifiedWebhook, aa as WEBHOOK_EVENTS, ab as WEBHOOK_HEADERS, ac as WaitForReleaseOptions, ad as WebhookDeliveryQuery, ae as WebhookEvent, af as WebhookOptions, ag as WireCareHandoff, ah as WireConsentRequest, ai as WireDecision, aj as WireDisclosure, ak as WireDisclosureRequest, al as WireEvaluateRequest, am as WireHandoffDetail, an as WireHandoffList, ao as WireHandoffRef, ap as WireInboundFlag, aq as WireOptOutRequest, ar as WireOutcome, as as WireOutcomeEvent, at as WireOutcomeRequest, au as WirePatientState, av as WirePolicyRef, aw as WireTranscriptBatch, ax as WireTranscriptJob, ay as WireTranscriptTurn, az as WireTranscriptTurnView, aA as WireWebhookDelivery, aB as createGovern, aC as handleWebhook, aD as isAutomationPaused, aE as isClientMisconfiguration, aF as isInSessionChannel, aG as parseEvent, aH as signWebhookPayload, aI as verifyWebhookSignature } from './client-BeyMec7E.cjs';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Error classes. No error message ever carries message content: they are built
|
|
@@ -10,9 +11,10 @@ export { A as AUDIENCES, a as AckOptions, b as Audience, C as CHANNELS, c as Cha
|
|
|
10
11
|
* schema for the body, so what is in it is the server's business and may
|
|
11
12
|
* change without this package moving. It is kept off `.message` and out of
|
|
12
13
|
* every event, and parked on `GovernApiError.serverMessage`, where reading it
|
|
13
|
-
* is a decision the caller makes for one error
|
|
14
|
+
* is a decision the caller makes for one error, not a property of every
|
|
14
15
|
* string the SDK hands to a log.
|
|
15
16
|
*/
|
|
17
|
+
|
|
16
18
|
declare class GovernError extends Error {
|
|
17
19
|
readonly name: string;
|
|
18
20
|
constructor(message: string, options?: {
|
|
@@ -53,13 +55,53 @@ declare class GovernApiError extends GovernError {
|
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
55
57
|
* 409: the resource changed under you (a stale `expectedVersion` on a
|
|
56
|
-
* hand-off action
|
|
57
|
-
*
|
|
58
|
-
* retry it.
|
|
58
|
+
* hand-off action, a `retryOf` or `supersedes` naming a decision that moved
|
|
59
|
+
* on) or a different outcome event of the same kind is already recorded.
|
|
60
|
+
* Refresh and decide again; the SDK does not retry it.
|
|
59
61
|
*/
|
|
60
62
|
declare class GovernConflictError extends GovernApiError {
|
|
61
63
|
readonly name = "GovernConflictError";
|
|
62
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* An outcome report an adapter made failed: the error the adapters pass to
|
|
67
|
+
* `onError` for a report that did not land. It carries the event exactly as
|
|
68
|
+
* it was sent, so the caller can send the identical event again with
|
|
69
|
+
* `reportOutcome`:
|
|
70
|
+
*
|
|
71
|
+
* govern.reportOutcome(error.decisionId, { kind: error.kind, at: error.at, contentHash: error.contentHash, deliveryRef: error.deliveryRef, reason: error.reason }).catch(log)
|
|
72
|
+
*
|
|
73
|
+
* The same `at` makes it the same event: the API answers a resend of an event
|
|
74
|
+
* that did land with 200 and records nothing, where a resend with a new `at`
|
|
75
|
+
* would be a different event (a 409, or a second row for `failed`). The
|
|
76
|
+
* failure itself is `cause`: a `GovernConflictError` when a different event
|
|
77
|
+
* of that kind is already on record (resending changes nothing), a
|
|
78
|
+
* `GovernApiError`, `GovernNetworkError` or `GovernTimeoutError` when the
|
|
79
|
+
* transport gave up, a `GovernConfigError` when a field was refused before
|
|
80
|
+
* anything was sent. Never message text: the hash, not the content.
|
|
81
|
+
*/
|
|
82
|
+
declare class GovernReportError extends GovernError {
|
|
83
|
+
readonly name = "GovernReportError";
|
|
84
|
+
readonly decisionId: string;
|
|
85
|
+
/** The kind the event had: from an adapter, `released` or `discarded`. */
|
|
86
|
+
readonly kind: ReportedOutcomeKind;
|
|
87
|
+
/** The event's `at`, as it was sent. */
|
|
88
|
+
readonly at: string;
|
|
89
|
+
/** The SHA-256 hex the event carried, on `released` and `delivered`; null otherwise, and when nothing was sent. */
|
|
90
|
+
readonly contentHash: string | null;
|
|
91
|
+
/** The reference as sent, or as given when nothing was sent; trimmed as the API trims it either way. Null when there was none. */
|
|
92
|
+
readonly deliveryRef: string | null;
|
|
93
|
+
/** The reason code, as `deliveryRef` is. Null when there was none. */
|
|
94
|
+
readonly reason: string | null;
|
|
95
|
+
constructor(input: {
|
|
96
|
+
decisionId: string;
|
|
97
|
+
kind: ReportedOutcomeKind;
|
|
98
|
+
at: string;
|
|
99
|
+
contentHash: string | null;
|
|
100
|
+
deliveryRef: string | null;
|
|
101
|
+
reason: string | null;
|
|
102
|
+
cause: unknown;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
63
105
|
/** The request could not be sent or no response arrived. */
|
|
64
106
|
declare class GovernNetworkError extends GovernError {
|
|
65
107
|
readonly name = "GovernNetworkError";
|
|
@@ -91,7 +133,7 @@ declare function isGovernError(error: unknown): error is GovernError;
|
|
|
91
133
|
/** SHA-256 over the UTF-8 bytes of `text`, lowercase hex. The outcome hash the API expects. */
|
|
92
134
|
declare function sha256Hex(text: string): Promise<string>;
|
|
93
135
|
|
|
94
|
-
declare const SDK_VERSION = "0.
|
|
136
|
+
declare const SDK_VERSION = "0.3.0";
|
|
95
137
|
declare const SDK_NAME = "@anybio/govern";
|
|
96
138
|
|
|
97
|
-
export { GovernAbortError, GovernApiError, GovernConfigError, GovernConflictError, GovernError, GovernNetworkError, GovernNotAvailableError, GovernTimeoutError, GovernWebhookError, SDK_NAME, SDK_VERSION, isGovernError, sha256Hex };
|
|
139
|
+
export { GovernAbortError, GovernApiError, GovernConfigError, GovernConflictError, GovernError, GovernNetworkError, GovernNotAvailableError, GovernReportError, GovernTimeoutError, GovernWebhookError, ReportedOutcomeKind, SDK_NAME, SDK_VERSION, isGovernError, sha256Hex };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { R as ReportedOutcomeKind } from './client-BeyMec7E.js';
|
|
2
|
+
export { A as AUDIENCES, a as Audience, C as CHANNELS, b as Channel, D as DEFAULT_BASE_URL, c as DEFAULT_HOLD_MESSAGE, d as DEFAULT_MAX_RETRIES, e as DEFAULT_TIMEOUT_MS, f as Decision, g as DecisionStatus, h as DecisionVerdict, i as DecisionWebhookEvent, j as Disclosure, k as DisclosureAttachment, l as Draft, E as EvaluateInput, G as Govern, m as GovernEvent, n as GovernHandoffs, o as GovernOptions, p as GuardContext, q as GuardResult, H as Handoff, r as HandoffActionInput, s as HandoffContactInput, t as HandoffDetail, u as HandoffList, v as HandoffListQuery, w as HandoffRef, x as HandoffResolveInput, y as HandoffResumeInput, z as HandoffWebhookEvent, B as HeadersLike, I as IN_SESSION_CHANNELS, F as InboundFlag, J as InboundMessage, M as MAX_CONVERSATION_ID_CHARS, K as MAX_SUPERSEDES, L as MAX_TURN_ID_CHARS, N as MAX_TURN_REF_CHARS, O as Mode, P as OUTCOME_REASONS, Q as Outcome, S as OutcomeEvent, T as OutcomeKind, U as OutcomeSource, V as PatientConsentInput, W as PatientOptOutInput, X as PolicyRef, Y as REASONS, Z as RESERVED_TURN_ID_PREFIX, _ as RecordDisclosureInput, $ as ReleaseResult, a0 as ReportOutcomeInput, a1 as ReviewState, a2 as Schemas, a3 as StopClass, a4 as SubmitTranscriptsInput, a5 as TRANSIENT_HTTP_STATUSES, a6 as TranscriptJob, a7 as TranscriptTurnInput, a8 as UnknownWebhookEvent, a9 as VerifiedWebhook, aa as WEBHOOK_EVENTS, ab as WEBHOOK_HEADERS, ac as WaitForReleaseOptions, ad as WebhookDeliveryQuery, ae as WebhookEvent, af as WebhookOptions, ag as WireCareHandoff, ah as WireConsentRequest, ai as WireDecision, aj as WireDisclosure, ak as WireDisclosureRequest, al as WireEvaluateRequest, am as WireHandoffDetail, an as WireHandoffList, ao as WireHandoffRef, ap as WireInboundFlag, aq as WireOptOutRequest, ar as WireOutcome, as as WireOutcomeEvent, at as WireOutcomeRequest, au as WirePatientState, av as WirePolicyRef, aw as WireTranscriptBatch, ax as WireTranscriptJob, ay as WireTranscriptTurn, az as WireTranscriptTurnView, aA as WireWebhookDelivery, aB as createGovern, aC as handleWebhook, aD as isAutomationPaused, aE as isClientMisconfiguration, aF as isInSessionChannel, aG as parseEvent, aH as signWebhookPayload, aI as verifyWebhookSignature } from './client-BeyMec7E.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Error classes. No error message ever carries message content: they are built
|
|
@@ -10,9 +11,10 @@ export { A as AUDIENCES, a as AckOptions, b as Audience, C as CHANNELS, c as Cha
|
|
|
10
11
|
* schema for the body, so what is in it is the server's business and may
|
|
11
12
|
* change without this package moving. It is kept off `.message` and out of
|
|
12
13
|
* every event, and parked on `GovernApiError.serverMessage`, where reading it
|
|
13
|
-
* is a decision the caller makes for one error
|
|
14
|
+
* is a decision the caller makes for one error, not a property of every
|
|
14
15
|
* string the SDK hands to a log.
|
|
15
16
|
*/
|
|
17
|
+
|
|
16
18
|
declare class GovernError extends Error {
|
|
17
19
|
readonly name: string;
|
|
18
20
|
constructor(message: string, options?: {
|
|
@@ -53,13 +55,53 @@ declare class GovernApiError extends GovernError {
|
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
55
57
|
* 409: the resource changed under you (a stale `expectedVersion` on a
|
|
56
|
-
* hand-off action
|
|
57
|
-
*
|
|
58
|
-
* retry it.
|
|
58
|
+
* hand-off action, a `retryOf` or `supersedes` naming a decision that moved
|
|
59
|
+
* on) or a different outcome event of the same kind is already recorded.
|
|
60
|
+
* Refresh and decide again; the SDK does not retry it.
|
|
59
61
|
*/
|
|
60
62
|
declare class GovernConflictError extends GovernApiError {
|
|
61
63
|
readonly name = "GovernConflictError";
|
|
62
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* An outcome report an adapter made failed: the error the adapters pass to
|
|
67
|
+
* `onError` for a report that did not land. It carries the event exactly as
|
|
68
|
+
* it was sent, so the caller can send the identical event again with
|
|
69
|
+
* `reportOutcome`:
|
|
70
|
+
*
|
|
71
|
+
* govern.reportOutcome(error.decisionId, { kind: error.kind, at: error.at, contentHash: error.contentHash, deliveryRef: error.deliveryRef, reason: error.reason }).catch(log)
|
|
72
|
+
*
|
|
73
|
+
* The same `at` makes it the same event: the API answers a resend of an event
|
|
74
|
+
* that did land with 200 and records nothing, where a resend with a new `at`
|
|
75
|
+
* would be a different event (a 409, or a second row for `failed`). The
|
|
76
|
+
* failure itself is `cause`: a `GovernConflictError` when a different event
|
|
77
|
+
* of that kind is already on record (resending changes nothing), a
|
|
78
|
+
* `GovernApiError`, `GovernNetworkError` or `GovernTimeoutError` when the
|
|
79
|
+
* transport gave up, a `GovernConfigError` when a field was refused before
|
|
80
|
+
* anything was sent. Never message text: the hash, not the content.
|
|
81
|
+
*/
|
|
82
|
+
declare class GovernReportError extends GovernError {
|
|
83
|
+
readonly name = "GovernReportError";
|
|
84
|
+
readonly decisionId: string;
|
|
85
|
+
/** The kind the event had: from an adapter, `released` or `discarded`. */
|
|
86
|
+
readonly kind: ReportedOutcomeKind;
|
|
87
|
+
/** The event's `at`, as it was sent. */
|
|
88
|
+
readonly at: string;
|
|
89
|
+
/** The SHA-256 hex the event carried, on `released` and `delivered`; null otherwise, and when nothing was sent. */
|
|
90
|
+
readonly contentHash: string | null;
|
|
91
|
+
/** The reference as sent, or as given when nothing was sent; trimmed as the API trims it either way. Null when there was none. */
|
|
92
|
+
readonly deliveryRef: string | null;
|
|
93
|
+
/** The reason code, as `deliveryRef` is. Null when there was none. */
|
|
94
|
+
readonly reason: string | null;
|
|
95
|
+
constructor(input: {
|
|
96
|
+
decisionId: string;
|
|
97
|
+
kind: ReportedOutcomeKind;
|
|
98
|
+
at: string;
|
|
99
|
+
contentHash: string | null;
|
|
100
|
+
deliveryRef: string | null;
|
|
101
|
+
reason: string | null;
|
|
102
|
+
cause: unknown;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
63
105
|
/** The request could not be sent or no response arrived. */
|
|
64
106
|
declare class GovernNetworkError extends GovernError {
|
|
65
107
|
readonly name = "GovernNetworkError";
|
|
@@ -91,7 +133,7 @@ declare function isGovernError(error: unknown): error is GovernError;
|
|
|
91
133
|
/** SHA-256 over the UTF-8 bytes of `text`, lowercase hex. The outcome hash the API expects. */
|
|
92
134
|
declare function sha256Hex(text: string): Promise<string>;
|
|
93
135
|
|
|
94
|
-
declare const SDK_VERSION = "0.
|
|
136
|
+
declare const SDK_VERSION = "0.3.0";
|
|
95
137
|
declare const SDK_NAME = "@anybio/govern";
|
|
96
138
|
|
|
97
|
-
export { GovernAbortError, GovernApiError, GovernConfigError, GovernConflictError, GovernError, GovernNetworkError, GovernNotAvailableError, GovernTimeoutError, GovernWebhookError, SDK_NAME, SDK_VERSION, isGovernError, sha256Hex };
|
|
139
|
+
export { GovernAbortError, GovernApiError, GovernConfigError, GovernConflictError, GovernError, GovernNetworkError, GovernNotAvailableError, GovernReportError, GovernTimeoutError, GovernWebhookError, ReportedOutcomeKind, SDK_NAME, SDK_VERSION, isGovernError, sha256Hex };
|