witnora 0.14.0 → 0.15.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.
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { type BrowserWorkflowOutcomeEvaluatorOptions, type DatabaseReadOnlyEvaluatorOptions, type HttpProductionEvaluatorOptions, type ProductionOutcomeEvaluator, type ProductionEvaluatorTemplate } from "./production-evaluator-kit.js";
|
|
2
|
+
export declare const PROVIDER_INTEGRATION_PACK_SCHEMA_VERSION: "witnora.provider_integration_pack.v0.1";
|
|
3
|
+
export type ProviderIntegrationPackId = "STRIPE_REFUND" | "SALESFORCE_RECORD" | "HUBSPOT_CRM_RECORD" | "ZENDESK_TICKET" | "INTERCOM_TICKET" | "POSTGRES_RECORD" | "MYSQL_RECORD" | "WEBHOOK_DELIVERY" | "QUEUE_JOB" | "EMAIL_DELIVERY" | "BROWSER_WORKFLOW";
|
|
4
|
+
export interface ProviderIntegrationPack {
|
|
5
|
+
schemaVersion: typeof PROVIDER_INTEGRATION_PACK_SCHEMA_VERSION;
|
|
6
|
+
id: ProviderIntegrationPackId;
|
|
7
|
+
provider: string;
|
|
8
|
+
title: string;
|
|
9
|
+
template: ProductionEvaluatorTemplate;
|
|
10
|
+
environments: Array<"sandbox" | "staging" | "production">;
|
|
11
|
+
credential: {
|
|
12
|
+
access: "READ_ONLY";
|
|
13
|
+
scopes: string[];
|
|
14
|
+
suggestedHandle: string;
|
|
15
|
+
healthCheck: "RESOURCE_GET" | "PREPARED_SELECT" | "OBSERVER_READ";
|
|
16
|
+
};
|
|
17
|
+
fieldAllowlist: string[];
|
|
18
|
+
commonCriteria: Array<{
|
|
19
|
+
id: string;
|
|
20
|
+
question: string;
|
|
21
|
+
field: string;
|
|
22
|
+
suggestedValues: Array<string | number | boolean>;
|
|
23
|
+
}>;
|
|
24
|
+
endpoint: {
|
|
25
|
+
origin?: string;
|
|
26
|
+
configurableOrigin: boolean;
|
|
27
|
+
resourcePattern: string;
|
|
28
|
+
};
|
|
29
|
+
boundaries: {
|
|
30
|
+
writes: false;
|
|
31
|
+
redirects: false;
|
|
32
|
+
rawPayloadUpload: false;
|
|
33
|
+
rawCredentialUpload: false;
|
|
34
|
+
};
|
|
35
|
+
contractDigestSha256: string;
|
|
36
|
+
}
|
|
37
|
+
type HttpPackOptions = {
|
|
38
|
+
packId: Exclude<ProviderIntegrationPackId, "POSTGRES_RECORD" | "MYSQL_RECORD" | "BROWSER_WORKFLOW">;
|
|
39
|
+
environment: "sandbox" | "staging" | "production";
|
|
40
|
+
credentialHandle: string;
|
|
41
|
+
resolveCredential: HttpProductionEvaluatorOptions["resolveCredential"];
|
|
42
|
+
allowedOrigin?: string;
|
|
43
|
+
fetch?: typeof fetch;
|
|
44
|
+
timeoutMs?: number;
|
|
45
|
+
now?: () => Date;
|
|
46
|
+
};
|
|
47
|
+
type DatabasePackOptions = {
|
|
48
|
+
packId: "POSTGRES_RECORD" | "MYSQL_RECORD";
|
|
49
|
+
environment: "sandbox" | "staging" | "production";
|
|
50
|
+
credentialHandle: string;
|
|
51
|
+
resolveCredential: DatabaseReadOnlyEvaluatorOptions["resolveCredential"];
|
|
52
|
+
statementId: string;
|
|
53
|
+
executePrepared: DatabaseReadOnlyEvaluatorOptions["executePrepared"];
|
|
54
|
+
timeoutMs?: number;
|
|
55
|
+
now?: () => Date;
|
|
56
|
+
};
|
|
57
|
+
type BrowserPackOptions = {
|
|
58
|
+
packId: "BROWSER_WORKFLOW";
|
|
59
|
+
environment: "sandbox" | "staging" | "production";
|
|
60
|
+
credentialHandle: string;
|
|
61
|
+
resolveCredential: BrowserWorkflowOutcomeEvaluatorOptions["resolveCredential"];
|
|
62
|
+
observerIdentity: BrowserWorkflowOutcomeEvaluatorOptions["observerIdentity"];
|
|
63
|
+
observe: BrowserWorkflowOutcomeEvaluatorOptions["observe"];
|
|
64
|
+
timeoutMs?: number;
|
|
65
|
+
now?: () => Date;
|
|
66
|
+
};
|
|
67
|
+
export type CreateProviderPackEvaluatorOptions = HttpPackOptions | DatabasePackOptions | BrowserPackOptions;
|
|
68
|
+
export interface ProviderPackPreflightResult {
|
|
69
|
+
schemaVersion: "witnora.provider_pack_preflight.v0.1";
|
|
70
|
+
packId: ProviderIntegrationPackId;
|
|
71
|
+
state: "READY" | "FIELD_NOT_OBSERVED";
|
|
72
|
+
productionWrites: 0;
|
|
73
|
+
credentialResolvedLocally: true;
|
|
74
|
+
observedFieldNames: string[];
|
|
75
|
+
observationDigestSha256: string;
|
|
76
|
+
limitations: string[];
|
|
77
|
+
}
|
|
78
|
+
export declare function listProviderIntegrationPacks(): ProviderIntegrationPack[];
|
|
79
|
+
export declare function getProviderIntegrationPack(id: ProviderIntegrationPackId): ProviderIntegrationPack;
|
|
80
|
+
export declare function createProviderPackEvaluator(options: CreateProviderPackEvaluatorOptions): ProductionOutcomeEvaluator;
|
|
81
|
+
export declare function preflightProviderIntegration(input: {
|
|
82
|
+
evaluator: ProductionOutcomeEvaluator;
|
|
83
|
+
packId: ProviderIntegrationPackId;
|
|
84
|
+
resourceId: string;
|
|
85
|
+
criterion: {
|
|
86
|
+
id: string;
|
|
87
|
+
field: string;
|
|
88
|
+
expected: string | number | boolean | null;
|
|
89
|
+
};
|
|
90
|
+
}): Promise<ProviderPackPreflightResult>;
|
|
91
|
+
export {};
|
|
92
|
+
//# sourceMappingURL=provider-integration-packs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-integration-packs.d.ts","sourceRoot":"","sources":["../../../../onegent-runtime/src/provider-integration-packs.ts"],"names":[],"mappings":"AAEA,OAAO,EASL,KAAK,sCAAsC,EAC3C,KAAK,gCAAgC,EACrC,KAAK,8BAA8B,EACnC,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EACjC,MAAM,+BAA+B,CAAC;AAGvC,eAAO,MAAM,wCAAwC,EAAG,wCAAiD,CAAC;AAE1G,MAAM,MAAM,yBAAyB,GACjC,eAAe,GAAG,m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BAA2B;IAC1C,aAAa,EAAE,sCAAsC,CAAC;IACtD,MAAM,EAAE,yBAAyB,CAAC;IAClC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CAAC;IACtC,gBAAgB,EAAE,CAAC,CAAC;IACpB,yBAAyB,EAAE,IAAI,CAAC;IAChC,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,uBAAuB,EAAE,MAAM,CAAC;IAChC,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAgBD,wBAAgB,4BAA4B,IAAI,uBAAuB,EAAE,CAAsD;AAC/H,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,yBAAyB,GAAG,uBAAuB,CAEjG;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,kCAAkC,GAAG,0BAA0B,CAoBnH;AAED,wBAAsB,4BAA4B,CAAC,KAAK,EAAE;IACxD,SAAS,EAAE,0BAA0B,CAAC;IACtC,MAAM,EAAE,yBAAyB,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;KAAE,CAAC;CACtF,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAYvC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { createBrowserWorkflowOutcomeEvaluator, createCrmRecordStateEvaluator, createDatabaseReadOnlyEvaluator, createEmailDeliveryEvaluator, createPaymentRefundResultEvaluator, createQueueJobCompletionEvaluator, createTicketStatusEvaluator, createWebhookDeliveryEvaluator, } from "./production-evaluator-kit.js";
|
|
3
|
+
import { canonicalJson } from "./trust-crypto.js";
|
|
4
|
+
export const PROVIDER_INTEGRATION_PACK_SCHEMA_VERSION = "witnora.provider_integration_pack.v0.1";
|
|
5
|
+
const BASE = [
|
|
6
|
+
pack("STRIPE_REFUND", "stripe", "Stripe refund result", "PAYMENT_REFUND_RESULT", ["sandbox", "production"], ["refunds:read"], "env://STRIPE_SECRET_KEY", ["status", "amount", "currency", "failure_reason"], "/v1/refunds/{resourceId}", "https://api.stripe.com", [criterion("refund-complete", "Which Stripe status means the refund completed?", "status", ["succeeded"])]),
|
|
7
|
+
pack("SALESFORCE_RECORD", "salesforce", "Salesforce record state", "CRM_RECORD_STATE", ["sandbox", "production"], ["API enabled with object and field read-only permission set"], "env://SALESFORCE_ACCESS_TOKEN", ["Status__c", "Refund_Status__c", "IsClosed", "StageName"], "/services/data/v61.0/sobjects/{object}/{resourceId}", undefined, [criterion("crm-state", "Which Salesforce field and value establish success?", "Status__c", ["Completed", "Approved"])]),
|
|
8
|
+
pack("HUBSPOT_CRM_RECORD", "hubspot", "HubSpot CRM record", "CRM_RECORD_STATE", ["sandbox", "production"], ["crm.objects.read"], "env://HUBSPOT_ACCESS_TOKEN", ["hs_pipeline_stage", "hs_status", "closedate", "amount"], "/crm/v3/objects/{object}/{resourceId}", "https://api.hubapi.com", [criterion("crm-state", "Which HubSpot property means the business task completed?", "hs_status", ["closed", "completed"])]),
|
|
9
|
+
pack("ZENDESK_TICKET", "zendesk", "Zendesk ticket status", "TICKET_STATUS", ["sandbox", "production"], ["tickets:read"], "env://ZENDESK_API_TOKEN", ["status", "priority", "type", "via.channel"], "/api/v2/tickets/{resourceId}.json", undefined, [criterion("ticket-complete", "Which Zendesk status means the ticket is complete?", "status", ["solved", "closed"])]),
|
|
10
|
+
pack("INTERCOM_TICKET", "intercom", "Intercom ticket status", "TICKET_STATUS", ["sandbox", "production"], ["tickets:read"], "env://INTERCOM_ACCESS_TOKEN", ["state", "priority", "ticket_type", "open"], "/tickets/{resourceId}", "https://api.intercom.io", [criterion("ticket-complete", "Which Intercom state means the ticket is complete?", "state", ["closed"])]),
|
|
11
|
+
pack("POSTGRES_RECORD", "postgresql", "PostgreSQL prepared read", "DATABASE_READ_ONLY", ["sandbox", "staging", "production"], ["SELECT on approved view"], "env://WITNORA_POSTGRES_READ_URL", ["status", "state", "result", "completed", "version"], "prepared://{statementId}", undefined, [criterion("record-state", "Which allowlisted result field proves success?", "status", ["completed", "succeeded"])]),
|
|
12
|
+
pack("MYSQL_RECORD", "mysql", "MySQL prepared read", "DATABASE_READ_ONLY", ["sandbox", "staging", "production"], ["SELECT on approved view"], "env://WITNORA_MYSQL_READ_URL", ["status", "state", "result", "completed", "version"], "prepared://{statementId}", undefined, [criterion("record-state", "Which allowlisted result field proves success?", "status", ["completed", "succeeded"])]),
|
|
13
|
+
pack("WEBHOOK_DELIVERY", "webhook", "Webhook delivery status", "WEBHOOK_DELIVERY", ["sandbox", "staging", "production"], ["delivery:read"], "env://WITNORA_WEBHOOK_READ_TOKEN", ["status", "delivered", "attempts", "response_code"], "/deliveries/{resourceId}", undefined, [criterion("webhook-delivered", "What delivery state counts as received?", "delivered", [true])]),
|
|
14
|
+
pack("QUEUE_JOB", "queue", "Queue or job completion", "QUEUE_JOB_COMPLETION", ["sandbox", "staging", "production"], ["jobs:read"], "env://WITNORA_QUEUE_READ_TOKEN", ["status", "completed", "attempts", "result_code"], "/jobs/{resourceId}", undefined, [criterion("job-complete", "What job state means processing completed?", "status", ["completed", "succeeded"])]),
|
|
15
|
+
pack("EMAIL_DELIVERY", "email", "Email delivery result", "EMAIL_DELIVERY", ["sandbox", "staging", "production"], ["messages:read"], "env://WITNORA_EMAIL_READ_TOKEN", ["status", "delivered", "bounce_type", "response_code"], "/messages/{resourceId}", undefined, [criterion("email-delivered", "What provider state means the message was delivered?", "delivered", [true])]),
|
|
16
|
+
pack("BROWSER_WORKFLOW", "browser", "Browser workflow outcome", "BROWSER_WORKFLOW_OUTCOME", ["sandbox", "staging", "production"], ["read-only observer"], "file://.witnora/secrets/browser-probe", ["status", "completed", "state", "result"], "observer://{resourceId}", undefined, [criterion("workflow-complete", "Which observable page state means the workflow completed?", "completed", [true])]),
|
|
17
|
+
];
|
|
18
|
+
export function listProviderIntegrationPacks() { return BASE.map((item) => structuredClone(item)); }
|
|
19
|
+
export function getProviderIntegrationPack(id) {
|
|
20
|
+
const found = BASE.find((item) => item.id === id);
|
|
21
|
+
if (!found)
|
|
22
|
+
throw new Error("Provider integration pack is not supported.");
|
|
23
|
+
return structuredClone(found);
|
|
24
|
+
}
|
|
25
|
+
export function createProviderPackEvaluator(options) {
|
|
26
|
+
const spec = getProviderIntegrationPack(options.packId);
|
|
27
|
+
if (!spec.environments.includes(options.environment))
|
|
28
|
+
throw new Error("Provider pack does not support this environment.");
|
|
29
|
+
const select = selector(spec.fieldAllowlist);
|
|
30
|
+
const common = { provider: spec.provider, environment: options.environment, credentialHandle: options.credentialHandle, resolveCredential: options.resolveCredential, select, timeoutMs: options.timeoutMs, now: options.now };
|
|
31
|
+
if (options.packId === "POSTGRES_RECORD" || options.packId === "MYSQL_RECORD")
|
|
32
|
+
return createDatabaseReadOnlyEvaluator({ ...common, statementId: options.statementId, executePrepared: options.executePrepared });
|
|
33
|
+
if (options.packId === "BROWSER_WORKFLOW")
|
|
34
|
+
return createBrowserWorkflowOutcomeEvaluator({ ...common, observerIdentity: options.observerIdentity, observe: options.observe });
|
|
35
|
+
const http = options;
|
|
36
|
+
const origin = http.allowedOrigin ?? spec.endpoint.origin;
|
|
37
|
+
if (!origin)
|
|
38
|
+
throw new Error("Provider pack requires the customer-specific HTTPS origin discovered during local setup.");
|
|
39
|
+
const resourcePath = resourcePathBuilder(spec.endpoint.resourcePattern);
|
|
40
|
+
const input = { ...common, allowedOrigin: origin, resourcePath, fetch: http.fetch };
|
|
41
|
+
switch (spec.template) {
|
|
42
|
+
case "CRM_RECORD_STATE": return createCrmRecordStateEvaluator(input);
|
|
43
|
+
case "TICKET_STATUS": return createTicketStatusEvaluator(input);
|
|
44
|
+
case "EMAIL_DELIVERY": return createEmailDeliveryEvaluator(input);
|
|
45
|
+
case "WEBHOOK_DELIVERY": return createWebhookDeliveryEvaluator(input);
|
|
46
|
+
case "QUEUE_JOB_COMPLETION": return createQueueJobCompletionEvaluator(input);
|
|
47
|
+
case "PAYMENT_REFUND_RESULT": return createPaymentRefundResultEvaluator(input);
|
|
48
|
+
default: throw new Error("Provider pack evaluator template is unsupported.");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export async function preflightProviderIntegration(input) {
|
|
52
|
+
const pack = getProviderIntegrationPack(input.packId);
|
|
53
|
+
if (!pack.fieldAllowlist.includes(input.criterion.field))
|
|
54
|
+
throw new Error("Preflight criterion is outside the provider field allowlist.");
|
|
55
|
+
const observation = await input.evaluator.evaluate({ resourceId: input.resourceId, criterionId: input.criterion.id, expected: { [input.criterion.field]: input.criterion.expected } });
|
|
56
|
+
const observedFieldNames = Object.keys(observation.observation.fields).sort();
|
|
57
|
+
return {
|
|
58
|
+
schemaVersion: "witnora.provider_pack_preflight.v0.1", packId: input.packId,
|
|
59
|
+
state: observedFieldNames.includes(input.criterion.field) ? "READY" : "FIELD_NOT_OBSERVED",
|
|
60
|
+
productionWrites: 0, credentialResolvedLocally: true, observedFieldNames,
|
|
61
|
+
observationDigestSha256: observation.observation.digestSha256,
|
|
62
|
+
limitations: [...observation.limitations, "Preflight validates one read-only provider observation; it does not approve a production action or establish a release decision."],
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function pack(id, provider, title, template, environments, scopes, suggestedHandle, fields, resourcePattern, origin, criteria) {
|
|
66
|
+
const value = { schemaVersion: PROVIDER_INTEGRATION_PACK_SCHEMA_VERSION, id, provider, title, template, environments, credential: { access: "READ_ONLY", scopes, suggestedHandle, healthCheck: template === "DATABASE_READ_ONLY" ? "PREPARED_SELECT" : template === "BROWSER_WORKFLOW_OUTCOME" ? "OBSERVER_READ" : "RESOURCE_GET" }, fieldAllowlist: fields, commonCriteria: criteria, endpoint: { ...(origin ? { origin } : {}), configurableOrigin: !origin, resourcePattern }, boundaries: { writes: false, redirects: false, rawPayloadUpload: false, rawCredentialUpload: false } };
|
|
67
|
+
const material = { id, fields: [...fields], scopes: [...scopes], environments: [...environments], criteria: criteria.map((item) => ({ id: item.id, field: item.field, values: [...item.suggestedValues] })) };
|
|
68
|
+
return { ...value, contractDigestSha256: createHash("sha256").update(canonicalJson(material)).digest("hex") };
|
|
69
|
+
}
|
|
70
|
+
function criterion(id, question, field, suggestedValues) { return { id, question, field, suggestedValues }; }
|
|
71
|
+
function selector(fields) {
|
|
72
|
+
return (value) => Object.fromEntries(fields.flatMap((field) => { const selected = field.split(".").reduce((current, key) => current && typeof current === "object" ? current[key] : undefined, value); return selected === undefined ? [] : [[field, selected]]; }));
|
|
73
|
+
}
|
|
74
|
+
function resourcePathBuilder(pattern) {
|
|
75
|
+
return (resourceId) => pattern.replace("{resourceId}", encodeURIComponent(resourceId)).replace("{object}", "records");
|
|
76
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "witnora",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Independent assurance for covered agent action paths across models and frameworks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,6 +48,10 @@
|
|
|
48
48
|
"types": "./dist/vendor/onegent-runtime/production-evaluator-kit.d.ts",
|
|
49
49
|
"import": "./dist/vendor/onegent-runtime/production-evaluator-kit.js"
|
|
50
50
|
},
|
|
51
|
+
"./provider-integration-packs": {
|
|
52
|
+
"types": "./dist/vendor/onegent-runtime/provider-integration-packs.d.ts",
|
|
53
|
+
"import": "./dist/vendor/onegent-runtime/provider-integration-packs.js"
|
|
54
|
+
},
|
|
51
55
|
"./change-manifest": {
|
|
52
56
|
"types": "./dist/vendor/onegent-runtime/signed-change-manifest.d.ts",
|
|
53
57
|
"import": "./dist/vendor/onegent-runtime/signed-change-manifest.js"
|