witnora 0.19.0 → 0.19.1

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/onboard.js CHANGED
@@ -311,7 +311,7 @@ export async function runOnboard(options) {
311
311
  ? "Runtime: LOCAL_SANDBOX_READY. This proves only the generated localhost sandbox loop is ready; it does not establish coverage, CURRENT, or a verified customer outcome.\n"
312
312
  : `Runtime: RECORDED_ONLY. ${runtimeReadiness.limitations[0]}\n`);
313
313
  output(assuranceHarnessReadiness.state === "ACTIVE"
314
- ? `Assurance Harness: ACTIVE. Nora can dispatch authority-ready Replay and no-write Shadow evaluations without manual Workflow IDs, evaluator origins, credentials, or contract digests.${realPathActivation.activations.length ? ` ${realPathActivation.activations.length} exact Stripe test-mode real-path binding(s) passed read-only preflight.` : ""}\n`
314
+ ? `Assurance Harness: ACTIVE. Nora can dispatch authority-ready Replay and no-write Shadow evaluations without manual Workflow IDs, evaluator origins, credentials, or contract digests.${realPathActivation.activations.length ? ` ${realPathActivation.activations.length} exact sandbox real-path binding(s) passed read-only preflight.` : ""}\n`
315
315
  : `Assurance Harness: WAITING_FOR_CUSTOMER_HARNESS. ${assuranceHarnessReadiness.limitation}\n`);
316
316
  if (httpActionSetup?.state === "READY" && httpActionSetup.action) {
317
317
  output(`HTTP Action: READY. POST ${managedGateway.baseUrl}${httpActionSetup.action.path}; copy the action-scoped token and request example from .witnora/gateway/HTTP_ACTION.md.\n`);
@@ -12,7 +12,7 @@ export async function activateRealPathIntegrations(options) {
12
12
  throw new Error(`Could not load approved real-path integrations (${response.status}).`);
13
13
  const body = await boundedJson(response);
14
14
  const approved = Array.isArray(body.integrations) ? body.integrations.map(parsePlan).filter((plan) => plan.status === "READY_TO_ACTIVATE" || plan.status === "HARNESS_ACTIVE") : [];
15
- const plans = approved.filter((plan) => ["STRIPE_REFUND", "SHOPIFY_DISPUTE", "ZENDESK_TICKET", "SALESFORCE_RECORD", "HUBSPOT_CRM_RECORD", "POSTGRES_RECORD"].includes(plan.generated.providerPackId) && plan.environment === "sandbox" && plan.customerSummary.evaluationMode === "SHADOW");
15
+ const plans = approved.filter((plan) => ["STRIPE_REFUND", "SHOPIFY_DISPUTE", "ZENDESK_TICKET", "SALESFORCE_RECORD", "HUBSPOT_CRM_RECORD", "POSTGRES_RECORD", "QUEUE_JOB"].includes(plan.generated.providerPackId) && plan.environment === "sandbox" && plan.customerSummary.evaluationMode === "SHADOW");
16
16
  if (!plans.length)
17
17
  return { state: "NOT_CONFIGURED", created: false, activations: [], generatedFiles: [], rollback: async () => undefined };
18
18
  const environment = options.env ?? process.env;
@@ -91,6 +91,8 @@ async function providerPreflight(request, env, plan, now, postgresClientFactory)
91
91
  }
92
92
  if (plan.generated.providerPackId === "SHOPIFY_DISPUTE")
93
93
  return shopifyDisputePreflight(request, env, plan, now);
94
+ if (plan.generated.providerPackId === "QUEUE_JOB" && plan.environment === "sandbox")
95
+ return localSandboxFixturePreflight(plan, now, "queue-job", "queue-job-sandbox");
94
96
  if (plan.generated.providerPackId === "ZENDESK_TICKET")
95
97
  return zendeskPreflight(request, env, plan, now);
96
98
  if (plan.generated.providerPackId === "SALESFORCE_RECORD")
@@ -124,10 +126,13 @@ async function shopifyDisputePreflight(request, env, plan, now) {
124
126
  return preflightResult(plan, now, "shopify", id, observation);
125
127
  }
126
128
  function shopifySandboxFixturePreflight(plan, now) {
127
- const resourceId = `sellershield-dispute-${sha(plan.taskContractDigestSha256).slice(0, 16)}`;
129
+ return localSandboxFixturePreflight(plan, now, "sellershield-dispute", "shopify-sandbox");
130
+ }
131
+ function localSandboxFixturePreflight(plan, now, resourcePrefix, scenarioPrefix) {
132
+ const resourceId = `${resourcePrefix}-${sha(plan.taskContractDigestSha256).slice(0, 16)}`;
128
133
  const observation = { status: plan.generated.criterion.expected };
129
134
  const resultDigest = sha(canonical(observation));
130
- return { acceptance: { kind: "READ_ONLY_PROVIDER_PREFLIGHT", passedAt: now.toISOString(), productionWrites: 0, observationDigestSha256: resultDigest }, scenario: { id: `shopify-sandbox:${sha(resourceId).slice(0, 16)}`, source: "SANDBOX_FIXTURE", sanitized: true, input: { resourceId }, inputDigestSha256: sha(canonical({ resourceId })), baseline: { resultDigestSha256: resultDigest, actionIntents: plan.generated.actionPathBindings.map((item) => ({ pathId: item.actionPathId, parametersDigestSha256: sha(resourceId) })) } } };
135
+ return { acceptance: { kind: "READ_ONLY_PROVIDER_PREFLIGHT", passedAt: now.toISOString(), productionWrites: 0, observationDigestSha256: resultDigest }, scenario: { id: `${scenarioPrefix}:${sha(resourceId).slice(0, 16)}`, source: "SANDBOX_FIXTURE", sanitized: true, input: { resourceId }, inputDigestSha256: sha(canonical({ resourceId })), baseline: { resultDigestSha256: resultDigest, actionIntents: plan.generated.actionPathBindings.map((item) => ({ pathId: item.actionPathId, parametersDigestSha256: sha(resourceId) })) } } };
131
136
  }
132
137
  async function stripePreflight(request, secret, plan, now) {
133
138
  const response = await request("https://api.stripe.com/v1/refunds?limit=1", { headers: { authorization: `Bearer ${secret}` }, redirect: "error", signal: AbortSignal.timeout(5_000) });
@@ -240,7 +245,7 @@ async function postgresPreflight(env, plan, now, clientFactory) {
240
245
  }
241
246
  async function defaultPostgresClient(connectionString) { const imported = await import("pg"); return new imported.Client({ connectionString, application_name: "witnora-read-only-preflight" }); }
242
247
  function generatedProviderHarness(plans) {
243
- const contracts = plans.map((plan) => ({ taskContractId: plan.taskContractId, providerPackId: plan.generated.providerPackId, providerConfiguration: plan.generated.providerConfiguration ?? {}, credentialHandle: `.witnora/provider-credentials/${plan.id}.secret`, criterion: plan.generated.criterion, actionPathIds: plan.generated.actionPathBindings.map((item) => item.actionPathId), ...(plan.generated.providerPackId === "SHOPIFY_DISPUTE" && plan.environment === "sandbox" && plan.generated.providerConfiguration === undefined ? { sandboxObservation: { [plan.generated.criterion.field]: plan.generated.criterion.expected } } : {}) }));
248
+ const contracts = plans.map((plan) => ({ taskContractId: plan.taskContractId, providerPackId: plan.generated.providerPackId, providerConfiguration: plan.generated.providerConfiguration ?? {}, credentialHandle: `.witnora/provider-credentials/${plan.id}.secret`, criterion: plan.generated.criterion, actionPathIds: plan.generated.actionPathBindings.map((item) => item.actionPathId), ...((plan.generated.providerPackId === "SHOPIFY_DISPUTE" && plan.environment === "sandbox" && plan.generated.providerConfiguration === undefined) || (plan.generated.providerPackId === "QUEUE_JOB" && plan.environment === "sandbox") ? { sandboxObservation: { [plan.generated.criterion.field]: plan.generated.criterion.expected } } : {}) }));
244
249
  return `import {createHash} from "node:crypto";
245
250
  import {readFile} from "node:fs/promises";
246
251
  import {join} from "node:path";
@@ -258,6 +263,8 @@ export async function checkWitnoraProviderHealth(context){for(const contract of
258
263
  async function persistProviderCredential(repository, plan, environment) {
259
264
  if (plan.generated.providerPackId === "SHOPIFY_DISPUTE" && plan.environment === "sandbox" && plan.generated.providerConfiguration === undefined)
260
265
  return;
266
+ if (plan.generated.providerPackId === "QUEUE_JOB" && plan.environment === "sandbox")
267
+ return;
261
268
  const name = providerCredentialEnvironmentName(plan.generated.providerPackId);
262
269
  const value = environment[name];
263
270
  const directory = join(repository, ".witnora", "provider-credentials");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "witnora",
3
- "version": "0.19.0",
3
+ "version": "0.19.1",
4
4
  "description": "Independent assurance for covered agent action paths across models and frameworks.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",