witnora 0.13.6 → 0.13.8
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/cli.js +19 -2
- package/dist/command-help.js +8 -0
- package/dist/gateway.js +147 -3
- package/dist/internal/control-client/durable-action-worker.d.ts +14 -1
- package/dist/internal/control-client/durable-action-worker.d.ts.map +1 -1
- package/dist/internal/control-client/durable-action-worker.js +19 -0
- package/dist/runtime-sandbox-kit.js +221 -0
- package/dist/vendor/onegent-runtime/managed-workflow-harness.d.ts +92 -0
- package/dist/vendor/onegent-runtime/managed-workflow-harness.d.ts.map +1 -0
- package/dist/vendor/onegent-runtime/managed-workflow-harness.js +269 -0
- package/dist/vendor/onegent-runtime/task-evaluation-hosted.d.ts +83 -0
- package/dist/vendor/onegent-runtime/task-evaluation-hosted.d.ts.map +1 -0
- package/dist/vendor/onegent-runtime/task-evaluation-hosted.js +108 -0
- package/dist/vendor/onegent-runtime/task-evaluation.d.ts +123 -0
- package/dist/vendor/onegent-runtime/task-evaluation.d.ts.map +1 -0
- package/dist/vendor/onegent-runtime/task-evaluation.js +206 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -39,7 +39,7 @@ import { runOnboard } from "./onboard.js";
|
|
|
39
39
|
import { inspectRepository } from "./onboard.js";
|
|
40
40
|
import { renderReleaseEvaluation, runReleaseEvaluation } from "./release-evaluation.js";
|
|
41
41
|
import { runPrivateCapabilityDiscovery } from "./private-discovery.js";
|
|
42
|
-
import { doctorCustomerGateway, initializeCustomerGateway, isGatewayDoctorReady, readManagedCustomerGatewayLogs, renderGatewayDoctor, renderManagedGatewayStatus, restartManagedCustomerGateway, runCustomerGateway, startManagedCustomerGateway, statusManagedCustomerGateway, stopManagedCustomerGateway, } from "./gateway.js";
|
|
42
|
+
import { configureManagedWorkflowHarness, doctorCustomerGateway, initializeCustomerGateway, isGatewayDoctorReady, readManagedCustomerGatewayLogs, renderGatewayDoctor, renderManagedGatewayStatus, restartManagedCustomerGateway, runCustomerGateway, startManagedCustomerGateway, statusManagedCustomerGateway, stopManagedCustomerGateway, } from "./gateway.js";
|
|
43
43
|
import { verifyEvidencePacketV02 } from "./evidence-v02.js";
|
|
44
44
|
process.on("uncaughtException", reportFatalError);
|
|
45
45
|
process.on("unhandledRejection", reportFatalError);
|
|
@@ -231,8 +231,25 @@ else if (command === "gateway") {
|
|
|
231
231
|
else if (action === "run") {
|
|
232
232
|
await runCustomerGateway({ repository: readFlag("--repo") ?? process.cwd(), dir: readFlag("--dir") });
|
|
233
233
|
}
|
|
234
|
+
else if (action === "workflow-harness") {
|
|
235
|
+
const workflowIds = process.argv.flatMap((argument, index) => argument === "--workflow" && process.argv[index + 1] ? [process.argv[index + 1]] : []);
|
|
236
|
+
const evaluatorOrigin = readFlag("--evaluator-origin");
|
|
237
|
+
const evaluatorCredentialHandle = readFlag("--evaluator-credential-handle");
|
|
238
|
+
const evaluatorContractSha256 = readFlag("--evaluator-contract-sha256");
|
|
239
|
+
if (!workflowIds.length || !evaluatorOrigin || !evaluatorCredentialHandle || !evaluatorContractSha256) {
|
|
240
|
+
throw new Error("Use witnora gateway workflow-harness --workflow <id> --evaluator-origin http://127.0.0.1:<port>/ --evaluator-credential-handle file://... --evaluator-contract-sha256 <sha256>.");
|
|
241
|
+
}
|
|
242
|
+
const result = await configureManagedWorkflowHarness({
|
|
243
|
+
repository: readFlag("--repo") ?? process.cwd(), dir: readFlag("--dir"), workflowIds,
|
|
244
|
+
evaluatorOrigin, evaluatorCredentialHandle, evaluatorContractSha256,
|
|
245
|
+
pollIntervalMs: readFlag("--poll-ms") ? Number(readFlag("--poll-ms")) : undefined,
|
|
246
|
+
maxConcurrency: readFlag("--max-concurrency") ? Number(readFlag("--max-concurrency")) : undefined,
|
|
247
|
+
force: readBoolFlag("--force"),
|
|
248
|
+
});
|
|
249
|
+
process.stdout.write(`Configured the Managed Workflow Harness for ${result.config.workflowIds.length} exact Workflow Contract(s).\nConfig: ${result.path}\nRestart the managed Gateway to activate it.\n`);
|
|
250
|
+
}
|
|
234
251
|
else {
|
|
235
|
-
throw new Error("Use witnora gateway init|doctor|start|status|logs|restart|stop|run.");
|
|
252
|
+
throw new Error("Use witnora gateway init|doctor|start|status|logs|restart|stop|run|workflow-harness.");
|
|
236
253
|
}
|
|
237
254
|
}
|
|
238
255
|
else if (command === "discover") {
|
package/dist/command-help.js
CHANGED
|
@@ -65,6 +65,8 @@ Options:
|
|
|
65
65
|
witnora gateway restart
|
|
66
66
|
witnora gateway stop
|
|
67
67
|
witnora gateway run
|
|
68
|
+
witnora gateway workflow-harness --workflow <id> --evaluator-origin http://127.0.0.1:<port>/ \\
|
|
69
|
+
--evaluator-credential-handle file://... --evaluator-contract-sha256 <sha256>
|
|
68
70
|
|
|
69
71
|
Initializes and manages a customer-owned, metadata-only collector beside the Agent.
|
|
70
72
|
The browser approval issues a collector-scoped credential; no API key is copied into
|
|
@@ -86,6 +88,12 @@ Options:
|
|
|
86
88
|
--force Replace an existing reviewed local setup
|
|
87
89
|
--json JSON status output
|
|
88
90
|
--lines <count> Number of recent log lines (default: 100)
|
|
91
|
+
--workflow <id> Exact active Workflow Contract (repeatable)
|
|
92
|
+
--evaluator-origin Literal-loopback customer evaluator origin
|
|
93
|
+
--evaluator-credential-handle Opaque file:// bearer credential reference
|
|
94
|
+
--evaluator-contract-sha256 Pinned evaluator contract digest
|
|
95
|
+
--poll-ms <milliseconds> Workflow plan interval (1000-60000)
|
|
96
|
+
--max-concurrency <count> Bounded ready evaluations (1-16)
|
|
89
97
|
`;
|
|
90
98
|
if (command === "design-partner")
|
|
91
99
|
return `Usage:
|
package/dist/gateway.js
CHANGED
|
@@ -13,6 +13,7 @@ import { generateRuntimeSandboxKit, LOCAL_SANDBOX_ADAPTER_ID, LOCAL_SANDBOX_ADAP
|
|
|
13
13
|
const CONFIG_SCHEMA = "witnora.customer_gateway_setup.v0.1";
|
|
14
14
|
const SECRETS_SCHEMA = "witnora.customer_gateway_local_secrets.v0.1";
|
|
15
15
|
const RUNTIME_SCHEMA = "witnora.managed_gateway_runtime.v0.1";
|
|
16
|
+
const WORKFLOW_HARNESS_SCHEMA = "witnora.managed_workflow_harness.v0.1";
|
|
16
17
|
export async function initializeCustomerGateway(options) {
|
|
17
18
|
const repository = resolve(options.repository ?? process.cwd());
|
|
18
19
|
const outDir = resolve(repository, options.outDir ?? ".witnora/gateway");
|
|
@@ -468,6 +469,10 @@ export async function runCustomerGateway(options) {
|
|
|
468
469
|
throw new Error("The saved Gateway credential does not match gateway.json. Run gateway init again.");
|
|
469
470
|
}
|
|
470
471
|
const dataDirectory = resolve(directory, config.storageDirectory);
|
|
472
|
+
const workflowHarnessConfigPath = join(directory, "workflow-harness.json");
|
|
473
|
+
const workflowHarnessConfig = await exists(workflowHarnessConfigPath)
|
|
474
|
+
? parseManagedWorkflowHarnessConfig(await readFile(workflowHarnessConfigPath, "utf8"))
|
|
475
|
+
: undefined;
|
|
471
476
|
const keyRingPath = join(dataDirectory, "source-keys.json");
|
|
472
477
|
const keyRing = await (await exists(keyRingPath)
|
|
473
478
|
? CustomerSourceKeyRing.open(keyRingPath)
|
|
@@ -489,6 +494,16 @@ export async function runCustomerGateway(options) {
|
|
|
489
494
|
FileActionCheckpointStore: (await durableWorker).FileActionCheckpointStore,
|
|
490
495
|
})
|
|
491
496
|
: undefined;
|
|
497
|
+
const workflowHarness = workflowHarnessConfig
|
|
498
|
+
? await createConfiguredWorkflowHarness({
|
|
499
|
+
directory,
|
|
500
|
+
projectId: config.projectId,
|
|
501
|
+
server: config.server,
|
|
502
|
+
apiKey: connection.apiKey,
|
|
503
|
+
config: workflowHarnessConfig,
|
|
504
|
+
managed: await configManagedWorkflowHarnessImport(),
|
|
505
|
+
})
|
|
506
|
+
: undefined;
|
|
492
507
|
actionWorker?.start();
|
|
493
508
|
const gateway = await startCustomerOwnedCollectorGateway({
|
|
494
509
|
client: new RemoteCollectorClient({ baseUrl: connection.server, projectId: connection.projectId, apiKey: connection.apiKey }),
|
|
@@ -533,12 +548,15 @@ export async function runCustomerGateway(options) {
|
|
|
533
548
|
} } : {}),
|
|
534
549
|
} } : {}),
|
|
535
550
|
});
|
|
551
|
+
workflowHarness?.start();
|
|
536
552
|
process.stdout.write(`Witnora customer-owned Gateway listening on ${gateway.baseUrl}\n`);
|
|
537
553
|
process.stdout.write(config.runtimeWorker
|
|
538
554
|
? "Runtime worker: READY. Approved exact configured actions execute automatically, then use the separate read-only probe and Hosted signed receipt.\n"
|
|
539
555
|
: "Evidence ceiling: RECORDED. No exact target adapter and separate outcome probe are configured, so runtime writes remain fail-closed.\n");
|
|
556
|
+
if (workflowHarness)
|
|
557
|
+
process.stdout.write("Managed Workflow Harness: CONFIGURED. Only authority-ready Replay and no-write Shadow evaluations will be sent to the pinned customer evaluator.\n");
|
|
540
558
|
for (const signal of ["SIGINT", "SIGTERM"]) {
|
|
541
|
-
process.once(signal, () => void Promise.allSettled([gateway.close(), ...(sandboxFixture ? [sandboxFixture.close()] : [])]).finally(() => process.exit(0)));
|
|
559
|
+
process.once(signal, () => void Promise.allSettled([gateway.close(), ...(workflowHarness ? [workflowHarness.close()] : []), ...(sandboxFixture ? [sandboxFixture.close()] : [])]).finally(() => process.exit(0)));
|
|
542
560
|
}
|
|
543
561
|
}
|
|
544
562
|
catch (error) {
|
|
@@ -546,6 +564,75 @@ export async function runCustomerGateway(options) {
|
|
|
546
564
|
throw error;
|
|
547
565
|
}
|
|
548
566
|
}
|
|
567
|
+
function configManagedWorkflowHarnessImport() {
|
|
568
|
+
return import(new URL("./vendor/onegent-runtime/managed-workflow-harness.js", import.meta.url).href);
|
|
569
|
+
}
|
|
570
|
+
export async function createConfiguredWorkflowHarness(input) {
|
|
571
|
+
const requestFetch = input.fetch ?? fetch;
|
|
572
|
+
const credential = await readSecretProviderHandle(input.config.evaluatorCredentialHandle);
|
|
573
|
+
const health = await requestFetch(`${input.config.evaluatorOrigin}/healthz`, {
|
|
574
|
+
headers: { authorization: `Bearer ${credential}` },
|
|
575
|
+
redirect: "error",
|
|
576
|
+
signal: AbortSignal.timeout(2_000),
|
|
577
|
+
});
|
|
578
|
+
const healthBody = await health.json().catch(() => ({}));
|
|
579
|
+
if (!health.ok
|
|
580
|
+
|| healthBody.schemaVersion !== "witnora.business_task_evaluator.v0.1"
|
|
581
|
+
|| healthBody.contractSha256 !== input.config.evaluatorContractSha256) {
|
|
582
|
+
throw new Error("Managed Workflow evaluator health did not match its pinned local contract.");
|
|
583
|
+
}
|
|
584
|
+
const hosted = input.managed.createManagedWorkflowHostedClient({
|
|
585
|
+
baseUrl: input.server,
|
|
586
|
+
projectId: input.projectId,
|
|
587
|
+
apiKey: input.apiKey,
|
|
588
|
+
workflowIds: input.config.workflowIds,
|
|
589
|
+
fetch: requestFetch,
|
|
590
|
+
});
|
|
591
|
+
const worker = new input.managed.ManagedBusinessWorkflowHarness({
|
|
592
|
+
client: hosted,
|
|
593
|
+
checkpoints: new input.managed.FileWorkflowEvaluationCheckpointStore(join(input.directory, "data", "workflow-evaluations")),
|
|
594
|
+
maxConcurrency: input.config.maxConcurrency,
|
|
595
|
+
evaluate: async ({ task, evaluation }) => {
|
|
596
|
+
const response = await requestFetch(`${input.config.evaluatorOrigin}/v1/evaluate`, {
|
|
597
|
+
method: "POST",
|
|
598
|
+
headers: { authorization: `Bearer ${credential}`, "content-type": "application/json" },
|
|
599
|
+
body: JSON.stringify({ schemaVersion: "witnora.business_task_evaluation_request.v0.1", task, evaluation }),
|
|
600
|
+
redirect: "error",
|
|
601
|
+
signal: AbortSignal.timeout(120_000),
|
|
602
|
+
});
|
|
603
|
+
const body = await response.json().catch(() => ({}));
|
|
604
|
+
if (!response.ok || !body.report || typeof body.report !== "object" || Array.isArray(body.report)) {
|
|
605
|
+
throw new Error(`Managed Workflow evaluator failed (${response.status}).`);
|
|
606
|
+
}
|
|
607
|
+
return body.report;
|
|
608
|
+
},
|
|
609
|
+
});
|
|
610
|
+
let timer;
|
|
611
|
+
let closing = false;
|
|
612
|
+
const tick = async () => {
|
|
613
|
+
const result = await worker.tick();
|
|
614
|
+
if ((result.evaluationsFailed ?? 0) > 0) {
|
|
615
|
+
process.stderr.write(`Managed Workflow Harness stopped ${result.evaluationsFailed} evaluation(s) fail-closed. ${result.limitations?.[0] ?? "Inspect the customer evaluator and retry."}\n`);
|
|
616
|
+
}
|
|
617
|
+
return result;
|
|
618
|
+
};
|
|
619
|
+
return {
|
|
620
|
+
start() {
|
|
621
|
+
if (timer || closing)
|
|
622
|
+
return;
|
|
623
|
+
void tick().catch((error) => process.stderr.write(`Managed Workflow Harness tick failed: ${error instanceof Error ? error.message : "unknown error"}\n`));
|
|
624
|
+
timer = setInterval(() => void tick().catch((error) => process.stderr.write(`Managed Workflow Harness tick failed: ${error instanceof Error ? error.message : "unknown error"}\n`)), input.config.pollIntervalMs ?? 5_000);
|
|
625
|
+
timer.unref?.();
|
|
626
|
+
},
|
|
627
|
+
async close() {
|
|
628
|
+
closing = true;
|
|
629
|
+
if (timer)
|
|
630
|
+
clearInterval(timer);
|
|
631
|
+
timer = undefined;
|
|
632
|
+
},
|
|
633
|
+
tick,
|
|
634
|
+
};
|
|
635
|
+
}
|
|
549
636
|
async function runtimeSandboxFixtureReady(config) {
|
|
550
637
|
try {
|
|
551
638
|
if (config.adapterId !== LOCAL_SANDBOX_ADAPTER_ID || !config.sandboxOrigin || !config.probeTargetCredentialHandle || !config.fixtureContractSha256)
|
|
@@ -634,7 +721,7 @@ export async function createConfiguredRuntimeActionWorker(input) {
|
|
|
634
721
|
const runtime = await adapterModule.createWitnoraRuntimeAdapter(adapterContext);
|
|
635
722
|
await inspectIsolatedOutcomeProbe(isolatedProbeConfig);
|
|
636
723
|
if (runtime.id !== workerConfig.adapterId || runtime.version !== workerConfig.adapterVersion || runtime.reconcileReadOnly !== true
|
|
637
|
-
|| typeof runtime.prepareClaim !== "function" || typeof runtime.execute !== "function" || typeof runtime.reconcile !== "function") {
|
|
724
|
+
|| typeof runtime.prepareClaim !== "function" || typeof runtime.execute !== "function" || typeof runtime.reconcile !== "function" || typeof runtime.submitEvidence !== "function") {
|
|
638
725
|
throw new Error("Runtime adapter does not match the exact configured id/version or read-only reconciliation contract.");
|
|
639
726
|
}
|
|
640
727
|
if (workerConfig.adapterId === LOCAL_SANDBOX_ADAPTER_ID && JSON.stringify(runtime.capabilities) !== JSON.stringify({
|
|
@@ -658,7 +745,7 @@ export async function createConfiguredRuntimeActionWorker(input) {
|
|
|
658
745
|
listActionReceipts: async (actionId) => (await primary(`actions/${encodeURIComponent(actionId)}/receipts`)).receipts ?? [],
|
|
659
746
|
claimExecutionGrant: (executionGrantId, claim, idempotencyKey) => claimHostedExecutionGrant(input.connection, requestFetch, executionGrantId, claim, idempotencyKey),
|
|
660
747
|
},
|
|
661
|
-
runtime: { reconcileReadOnly: true, prepareClaim: runtime.prepareClaim, execute: runtime.execute, reconcile: runtime.reconcile },
|
|
748
|
+
runtime: { reconcileReadOnly: true, prepareClaim: runtime.prepareClaim, execute: runtime.execute, reconcile: runtime.reconcile, submitEvidence: runtime.submitEvidence },
|
|
662
749
|
probe: {
|
|
663
750
|
id: workerConfig.probeId,
|
|
664
751
|
credentialHandle: workerConfig.probeTargetCredentialHandle,
|
|
@@ -936,6 +1023,63 @@ function parseConfig(raw) {
|
|
|
936
1023
|
}
|
|
937
1024
|
return config;
|
|
938
1025
|
}
|
|
1026
|
+
export function parseManagedWorkflowHarnessConfig(raw) {
|
|
1027
|
+
const value = JSON.parse(raw);
|
|
1028
|
+
if (value.schemaVersion !== WORKFLOW_HARNESS_SCHEMA
|
|
1029
|
+
|| value.enabled !== true
|
|
1030
|
+
|| !literalLoopbackOrigin(value.evaluatorOrigin)
|
|
1031
|
+
|| !credentialHandle(value.evaluatorCredentialHandle ?? "")
|
|
1032
|
+
|| !validDigest(value.evaluatorContractSha256 ?? "")
|
|
1033
|
+
|| !Array.isArray(value.workflowIds)
|
|
1034
|
+
|| !value.workflowIds.length
|
|
1035
|
+
|| value.workflowIds.length > 100
|
|
1036
|
+
|| new Set(value.workflowIds).size !== value.workflowIds.length
|
|
1037
|
+
|| value.workflowIds.some((id) => typeof id !== "string" || !/^[A-Za-z0-9._:-]{1,200}$/.test(id))) {
|
|
1038
|
+
throw new Error("workflow-harness.json requires an enabled, digest-pinned literal-loopback evaluator and a local credential handle.");
|
|
1039
|
+
}
|
|
1040
|
+
if (value.pollIntervalMs !== undefined && (!Number.isInteger(value.pollIntervalMs) || value.pollIntervalMs < 1_000 || value.pollIntervalMs > 60_000)) {
|
|
1041
|
+
throw new Error("workflow-harness.json pollIntervalMs must be between 1000 and 60000.");
|
|
1042
|
+
}
|
|
1043
|
+
if (value.maxConcurrency !== undefined && (!Number.isInteger(value.maxConcurrency) || value.maxConcurrency < 1 || value.maxConcurrency > 16)) {
|
|
1044
|
+
throw new Error("workflow-harness.json maxConcurrency must be between 1 and 16.");
|
|
1045
|
+
}
|
|
1046
|
+
return value;
|
|
1047
|
+
}
|
|
1048
|
+
export async function configureManagedWorkflowHarness(options) {
|
|
1049
|
+
const directory = resolve(options.repository ?? process.cwd(), options.dir ?? ".witnora/gateway");
|
|
1050
|
+
if (!await exists(join(directory, "gateway.json")))
|
|
1051
|
+
throw new Error("Initialize the customer-owned Gateway before configuring its Workflow Harness.");
|
|
1052
|
+
const config = parseManagedWorkflowHarnessConfig(JSON.stringify({
|
|
1053
|
+
schemaVersion: WORKFLOW_HARNESS_SCHEMA,
|
|
1054
|
+
enabled: true,
|
|
1055
|
+
evaluatorOrigin: options.evaluatorOrigin,
|
|
1056
|
+
evaluatorCredentialHandle: options.evaluatorCredentialHandle,
|
|
1057
|
+
evaluatorContractSha256: options.evaluatorContractSha256,
|
|
1058
|
+
workflowIds: options.workflowIds,
|
|
1059
|
+
...(options.pollIntervalMs === undefined ? {} : { pollIntervalMs: options.pollIntervalMs }),
|
|
1060
|
+
...(options.maxConcurrency === undefined ? {} : { maxConcurrency: options.maxConcurrency }),
|
|
1061
|
+
}));
|
|
1062
|
+
const path = join(directory, "workflow-harness.json");
|
|
1063
|
+
await writeExclusive(path, `${JSON.stringify(config, null, 2)}\n`, options.force ?? false, 0o600);
|
|
1064
|
+
return { path, config };
|
|
1065
|
+
}
|
|
1066
|
+
function literalLoopbackOrigin(value) {
|
|
1067
|
+
if (typeof value !== "string")
|
|
1068
|
+
return false;
|
|
1069
|
+
try {
|
|
1070
|
+
const url = new URL(value);
|
|
1071
|
+
return url.protocol === "http:"
|
|
1072
|
+
&& (url.hostname === "127.0.0.1" || url.hostname === "[::1]")
|
|
1073
|
+
&& url.username === ""
|
|
1074
|
+
&& url.password === ""
|
|
1075
|
+
&& url.pathname === "/"
|
|
1076
|
+
&& url.search === ""
|
|
1077
|
+
&& url.hash === "";
|
|
1078
|
+
}
|
|
1079
|
+
catch {
|
|
1080
|
+
return false;
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
939
1083
|
function validateRuntimeWorkerConfig(value) {
|
|
940
1084
|
if (value.enabled !== true || !value.adapterModulePath || !/^[a-f0-9]{64}$/.test(value.adapterModuleSha256)
|
|
941
1085
|
|| !value.probeModulePath || !/^[a-f0-9]{64}$/.test(value.probeModuleSha256)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type DurableActionPhase = "TRACKED" | "WAITING_APPROVAL" | "DENIED" | "EXPIRED" | "BLOCKED" | "GRANT_ISSUED" | "EXECUTION_STARTED" | "UNKNOWN_RESULT" | "EXECUTED" | "PROBED" | "COMPLETED";
|
|
1
|
+
export type DurableActionPhase = "TRACKED" | "WAITING_APPROVAL" | "DENIED" | "EXPIRED" | "BLOCKED" | "GRANT_ISSUED" | "EXECUTION_STARTED" | "UNKNOWN_RESULT" | "EXECUTED" | "PROBED" | "EVIDENCE_SUBMITTED" | "COMPLETED";
|
|
2
2
|
export interface DurableWorkerProposal {
|
|
3
3
|
externalId: string;
|
|
4
4
|
actionType: string;
|
|
@@ -25,6 +25,9 @@ export interface DurableWorkerAction {
|
|
|
25
25
|
targetSystem: string;
|
|
26
26
|
expectedState?: Record<string, unknown>;
|
|
27
27
|
approvalExpiresAt?: string;
|
|
28
|
+
verificationSuccess?: boolean;
|
|
29
|
+
receiptId?: string;
|
|
30
|
+
receiptSignatureCount?: number;
|
|
28
31
|
assuranceContext?: {
|
|
29
32
|
executionIntent?: {
|
|
30
33
|
adapterId: string;
|
|
@@ -118,6 +121,8 @@ export interface DurableApprovedActionWorkerOptions {
|
|
|
118
121
|
verifyAction(actionId: string, input: Record<string, unknown>, idempotencyKey: string): Promise<{
|
|
119
122
|
status: string;
|
|
120
123
|
verificationSuccess?: boolean;
|
|
124
|
+
receiptId?: string;
|
|
125
|
+
receiptSignatureCount?: number;
|
|
121
126
|
}>;
|
|
122
127
|
listActionReceipts(actionId: string): Promise<Array<{
|
|
123
128
|
id: string;
|
|
@@ -147,6 +152,14 @@ export interface DurableApprovedActionWorkerOptions {
|
|
|
147
152
|
proposal: DurableWorkerProposal;
|
|
148
153
|
grant: DurableWorkerGrant;
|
|
149
154
|
}): Promise<DurableWorkerExecutionResult | undefined>;
|
|
155
|
+
submitEvidence(input: {
|
|
156
|
+
action: DurableWorkerAction;
|
|
157
|
+
proposal: DurableWorkerProposal;
|
|
158
|
+
grant: DurableWorkerGrant;
|
|
159
|
+
hostedReservation: DurableWorkerHostedReservation;
|
|
160
|
+
execution: DurableWorkerExecutionResult;
|
|
161
|
+
observation: DurableWorkerObservation;
|
|
162
|
+
}): Promise<void>;
|
|
150
163
|
};
|
|
151
164
|
probe: {
|
|
152
165
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"durable-action-worker.d.ts","sourceRoot":"","sources":["../../../../agentcert-sdk/src/durable-action-worker.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GACT,kBAAkB,GAClB,QAAQ,GACR,SAAS,GACT,SAAS,GACT,cAAc,GACd,mBAAmB,GACnB,gBAAgB,GAChB,UAAU,GACV,QAAQ,GACR,WAAW,CAAC;AAEhB,MAAM,W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,SAAS;CAIlB;AAED,MAAM,WAAW,kCAAkC;IACjD,MAAM,EAAE;QACN,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,CAAC;QACvB,OAAO,EAAE,MAAM,CAAC;QAChB,qBAAqB,EAAE,MAAM,CAAC;QAC9B,iBAAiB,EAAE,MAAM,CAAC;QAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,KAAK,EAAE,qBAAqB,CAAC;IAC7B,MAAM,EAAE;QACN,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;QAC1D,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC3H,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"durable-action-worker.d.ts","sourceRoot":"","sources":["../../../../agentcert-sdk/src/durable-action-worker.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GACT,kBAAkB,GAClB,QAAQ,GACR,SAAS,GACT,SAAS,GACT,cAAc,GACd,mBAAmB,GACnB,gBAAgB,GAChB,UAAU,GACV,QAAQ,GACR,oBAAoB,GACpB,WAAW,CAAC;AAEhB,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAA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,CAAC,CAAC;KACzL,CAAC;IACF,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,2CAA2C,CAAC;IAC3D,KAAK,EAAE,OAAO,CAAC;IACf,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,2BAA2B;IAQ1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAPpC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAa;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuD;IAC9E,OAAO,CAAC,KAAK,CAAC,CAAiC;IAC/C,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;gBAEZ,OAAO,EAAE,kCAAkC;IAUlE,KAAK,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,qBAAqB,CAAA;KAAE,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAgB3G,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAOxD,KAAK,IAAI,IAAI;IAcb,IAAI,IAAI,IAAI;IAEN,MAAM,IAAI,OAAO,CAAC,yBAAyB,CAAC;YAapC,QAAQ;YAgIR,OAAO;CAMtB;AA2DD,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAY3F"}
|
|
@@ -160,6 +160,9 @@ export class DurableApprovedActionWorker {
|
|
|
160
160
|
if (!exactActionMatches(action, actionId, checkpoint.proposal, this.options.config.adapterId, this.options.config.adapterVersion)) {
|
|
161
161
|
return this.persist(checkpoint, "BLOCKED", { limitation: "Hosted action no longer matches the exact locally configured action, adapter, or build binding." });
|
|
162
162
|
}
|
|
163
|
+
if (action.status === "VERIFIED" && action.verificationSuccess === true && action.receiptId && (action.receiptSignatureCount ?? 0) > 0) {
|
|
164
|
+
return this.persist(checkpoint, "COMPLETED", { receiptId: action.receiptId, limitation: undefined });
|
|
165
|
+
}
|
|
163
166
|
if ((checkpoint.phase === "EXECUTION_STARTED" || checkpoint.phase === "UNKNOWN_RESULT") && checkpoint.grant) {
|
|
164
167
|
if (!exactGrantMatches(checkpoint.grant, actionId, checkpoint.proposal, this.options.config.runtimeIdentityId)) {
|
|
165
168
|
return this.persist(checkpoint, "BLOCKED", { limitation: "Hosted grant does not match the exact approved local action binding." });
|
|
@@ -261,6 +264,19 @@ export class DurableApprovedActionWorker {
|
|
|
261
264
|
throw new Error("Outcome observation did not come from the exact configured probe.");
|
|
262
265
|
checkpoint = await this.persist(checkpoint, "PROBED", { observation });
|
|
263
266
|
}
|
|
267
|
+
if (checkpoint.phase !== "EVIDENCE_SUBMITTED") {
|
|
268
|
+
if (!checkpoint.hostedReservation)
|
|
269
|
+
throw new Error("Durable execution evidence requires the bound Hosted reservation.");
|
|
270
|
+
await this.options.runtime.submitEvidence({
|
|
271
|
+
action,
|
|
272
|
+
proposal: checkpoint.proposal,
|
|
273
|
+
grant,
|
|
274
|
+
hostedReservation: checkpoint.hostedReservation,
|
|
275
|
+
execution: checkpoint.execution,
|
|
276
|
+
observation: checkpoint.observation,
|
|
277
|
+
});
|
|
278
|
+
checkpoint = await this.persist(checkpoint, "EVIDENCE_SUBMITTED");
|
|
279
|
+
}
|
|
264
280
|
const verified = await this.options.hosted.verifyAction(actionId, {
|
|
265
281
|
...checkpoint.observation,
|
|
266
282
|
executionGrantId: grant.id,
|
|
@@ -268,6 +284,9 @@ export class DurableApprovedActionWorker {
|
|
|
268
284
|
}, `durable-worker:verify:${actionId}:${checkpoint.execution.executionSessionId}`);
|
|
269
285
|
if (verified.status !== "VERIFIED" || verified.verificationSuccess !== true)
|
|
270
286
|
throw new Error("Hosted outcome verification did not establish the expected result.");
|
|
287
|
+
if (verified.receiptId && (verified.receiptSignatureCount ?? 0) > 0) {
|
|
288
|
+
return this.persist(checkpoint, "COMPLETED", { receiptId: verified.receiptId });
|
|
289
|
+
}
|
|
271
290
|
const receipts = await this.options.hosted.listActionReceipts(actionId);
|
|
272
291
|
const signed = receipts.find((item) => Array.isArray(item.receipt?.signatureSet) && item.receipt.signatureSet.length > 0);
|
|
273
292
|
if (!signed)
|
|
@@ -221,9 +221,230 @@ export function createWitnoraRuntimeAdapter(context) {
|
|
|
221
221
|
await persistExecution(context.storageDirectory, action.id, execution);
|
|
222
222
|
return execution;
|
|
223
223
|
},
|
|
224
|
+
async submitEvidence({ action, proposal, grant, hostedReservation, execution, observation }) {
|
|
225
|
+
const audit = await readCommittedAudit(reconcileCredential.handle, action.id, execution.executionSessionId);
|
|
226
|
+
const bundle = await loadOrCreateEvidenceBundle({
|
|
227
|
+
storageDirectory: context.storageDirectory,
|
|
228
|
+
action,
|
|
229
|
+
proposal,
|
|
230
|
+
grant,
|
|
231
|
+
hostedReservation,
|
|
232
|
+
execution,
|
|
233
|
+
observation,
|
|
234
|
+
audit,
|
|
235
|
+
runtime,
|
|
236
|
+
adapterId: context.adapterId,
|
|
237
|
+
adapterVersion: context.adapterVersion,
|
|
238
|
+
signingKeyHandle: signingKey.handle,
|
|
239
|
+
writeCredentialHandle: writeCredential.handle,
|
|
240
|
+
});
|
|
241
|
+
await context.hosted.request("execution-attempts/" + encodeURIComponent(execution.executionSessionId) + "/phase", {
|
|
242
|
+
method: "POST",
|
|
243
|
+
body: { executionSessionId: execution.executionSessionId, runtimeClaim: hostedReservation.claim, phase: "RECONCILED_SUCCESS", targetOperationId: execution.targetOperationId },
|
|
244
|
+
});
|
|
245
|
+
await context.hosted.request("execution-sessions/" + encodeURIComponent(execution.executionSessionId) + "/evidence", { method: "POST", body: bundle });
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
async function readCommittedAudit(handle, actionId, executionSessionId) {
|
|
251
|
+
const credential = await readSecretHandle(handle);
|
|
252
|
+
const response = await fetch("${sandboxOrigin}/audit/actions/" + encodeURIComponent(actionId) + "/sessions/" + encodeURIComponent(executionSessionId), { redirect: "error", headers: { "x-sandbox-audit-credential": credential } });
|
|
253
|
+
const audit = await response.json().catch(() => ({}));
|
|
254
|
+
if (!response.ok || audit.phase !== "COMMITTED" || audit.actionId !== actionId || audit.executionSessionId !== executionSessionId || typeof audit.transactionId !== "string") throw new Error("sandbox_evidence_audit_invalid");
|
|
255
|
+
return audit;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
async function loadOrCreateEvidenceBundle(input) {
|
|
259
|
+
const path = join(input.storageDirectory, "evidence-bundles", safeId(input.action.id) + ".json");
|
|
260
|
+
try { return JSON.parse(await readFile(path, "utf8")); }
|
|
261
|
+
catch (error) { if (error?.code !== "ENOENT") throw error; }
|
|
262
|
+
const bundle = await createEvidenceBundle(input);
|
|
263
|
+
await mkdir(dirname(path), { recursive: true });
|
|
264
|
+
const temporary = path + "." + randomUUID() + ".tmp";
|
|
265
|
+
await writeFile(temporary, JSON.stringify(bundle) + "\\n", { mode: 0o600 });
|
|
266
|
+
await rename(temporary, path);
|
|
267
|
+
return bundle;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
async function createEvidenceBundle(input) {
|
|
271
|
+
const grant = exactObject(input.grant?.grant, "grant");
|
|
272
|
+
const grantPayload = exactObject(grant.payload, "grant.payload");
|
|
273
|
+
const runtimeClaim = exactObject(input.hostedReservation.claim, "runtimeClaim");
|
|
274
|
+
const claimedAt = String(exactObject(runtimeClaim.payload, "runtimeClaim.payload").claimedAt);
|
|
275
|
+
const completedAt = new Date().toISOString();
|
|
276
|
+
const privateKeyPem = await readSecretHandle(input.signingKeyHandle);
|
|
277
|
+
const signRuntime = (payload) => {
|
|
278
|
+
const payloadSha256 = sha256(canonicalJson(payload));
|
|
279
|
+
return { payload, payloadSha256, signature: { algorithm: "Ed25519", keyId: input.runtime.keyId, signature: sign(null, Buffer.from(payloadSha256, "hex"), createPrivateKey(privateKeyPem)).toString("base64url") } };
|
|
280
|
+
};
|
|
281
|
+
const credentialLeaseId = randomUUID();
|
|
282
|
+
const eventChainGenesisHash = sha256(canonicalJson({ executionSessionId: input.execution.executionSessionId, executionGrantDigest: grant.payloadSha256, runtimeIdentityId: input.runtime.id }));
|
|
283
|
+
const executionSession = signRuntime({
|
|
284
|
+
protocolVersion: "agentcert.browser_enforcement.v0.2",
|
|
285
|
+
objectType: "ExecutionSessionAttestation",
|
|
286
|
+
signatureContext: "onegent.execution-session.v0.2",
|
|
287
|
+
executionSessionId: input.execution.executionSessionId,
|
|
288
|
+
executionGrantId: input.grant.id,
|
|
289
|
+
executionGrantDigest: grant.payloadSha256,
|
|
290
|
+
actionId: input.action.id,
|
|
291
|
+
actionIntentDigest: grantPayload.actionIntentDigest,
|
|
292
|
+
runtimeIdentityId: input.runtime.id,
|
|
293
|
+
runtimeKeyId: input.runtime.keyId,
|
|
294
|
+
adapterId: input.adapterId,
|
|
295
|
+
adapterVersion: input.adapterVersion,
|
|
296
|
+
browserContextIdDigest: sha256("durable-action:" + input.execution.executionSessionId),
|
|
297
|
+
credentialLeaseId,
|
|
298
|
+
credentialIsolationMode: "RUNTIME_INJECTED_CREDENTIAL",
|
|
299
|
+
targetAudience: grantPayload.targetAudience,
|
|
300
|
+
allowedOrigins: grantPayload.allowedOrigins,
|
|
301
|
+
startedAt: claimedAt,
|
|
302
|
+
sessionExpiresAt: grantPayload.expiresAt,
|
|
303
|
+
eventChainGenesisHash,
|
|
304
|
+
});
|
|
305
|
+
const events = [];
|
|
306
|
+
let previousEventHash = eventChainGenesisHash;
|
|
307
|
+
const append = (eventType, redactedPayload = {}) => {
|
|
308
|
+
const payload = {
|
|
309
|
+
protocolVersion: "agentcert.browser_enforcement.v0.2",
|
|
310
|
+
objectType: "ExecutionEvent",
|
|
311
|
+
signatureContext: "onegent.execution-event.v0.2",
|
|
312
|
+
eventId: randomUUID(),
|
|
313
|
+
actionId: input.action.id,
|
|
314
|
+
executionSessionId: input.execution.executionSessionId,
|
|
315
|
+
sequence: events.length + 1,
|
|
316
|
+
previousEventHash,
|
|
317
|
+
eventType,
|
|
318
|
+
sourceIdentityId: input.runtime.id,
|
|
319
|
+
sourceTimestamp: completedAt,
|
|
320
|
+
receivedTimestamp: completedAt,
|
|
321
|
+
payloadDigest: sha256(canonicalJson(redactedPayload)),
|
|
322
|
+
redactedPayload,
|
|
323
|
+
};
|
|
324
|
+
const signed = signRuntime(payload);
|
|
325
|
+
previousEventHash = signed.payloadSha256;
|
|
326
|
+
events.push(signed);
|
|
327
|
+
};
|
|
328
|
+
append("EXECUTION_GRANT_VERIFIED", { executionGrantDigest: grant.payloadSha256 });
|
|
329
|
+
append("EXECUTION_GRANT_CLAIMED", { executionGrantId: input.grant.id, claimDigest: runtimeClaim.payloadSha256 });
|
|
330
|
+
append("EXECUTION_SESSION_STARTED", { executionSessionDigest: executionSession.payloadSha256 });
|
|
331
|
+
append("CREDENTIAL_LEASE_ACTIVATED", { credentialLeaseId, isolationMode: "RUNTIME_INJECTED_CREDENTIAL" });
|
|
332
|
+
append("BROWSER_CONTEXT_CREATED", { browserContextIdDigest: executionSession.payload.browserContextIdDigest });
|
|
333
|
+
append("TARGET_NAVIGATION", { targetAudience: grantPayload.targetAudience, origin: grantPayload.allowedOrigins[0] });
|
|
334
|
+
append("AUTHORIZED_ACTION_PREPARED", { operation: grantPayload.allowedOperation, resource: grantPayload.allowedResource });
|
|
335
|
+
append("FINAL_PARAMETERS_VERIFIED", { parametersDigest: grantPayload.parametersDigest });
|
|
336
|
+
append("HIGH_RISK_SUBMISSION_STARTED", { actionId: input.action.id });
|
|
337
|
+
append("HIGH_RISK_SUBMISSION_COMPLETED", { targetSystem: input.action.targetSystem });
|
|
338
|
+
append("TARGET_RESPONSE_OBSERVED", { observedStateDigest: sha256(canonicalJson(input.execution.observedState ?? {})) });
|
|
339
|
+
append("OUTCOME_PROBE_STARTED", { probe: input.observation.observationSource });
|
|
340
|
+
append("OUTCOME_OBSERVED", { source: input.observation.observationSource, observedStateDigest: sha256(canonicalJson(input.observation.observedState)) });
|
|
341
|
+
append("CREDENTIAL_LEASE_REVOKED", { credentialLeaseId, revokedAt: completedAt, status: "REVOKED" });
|
|
342
|
+
const expectedState = input.action.expectedState ?? input.proposal.expectedState ?? {};
|
|
343
|
+
const outcomeResult = subsetMatches(expectedState, input.observation.observedState) ? "SATISFIED" : "NOT_SATISFIED";
|
|
344
|
+
const outcomeAttestation = signRuntime({
|
|
345
|
+
protocolVersion: "agentcert.browser_enforcement.v0.2",
|
|
346
|
+
objectType: "OutcomeAttestation",
|
|
347
|
+
signatureContext: "onegent.outcome-attestation.v0.2",
|
|
348
|
+
outcomeAttestationId: randomUUID(),
|
|
349
|
+
actionId: input.action.id,
|
|
350
|
+
executionSessionId: input.execution.executionSessionId,
|
|
351
|
+
executionGrantId: input.grant.id,
|
|
352
|
+
predicateId: "expected_state_subset",
|
|
353
|
+
predicateVersion: "1",
|
|
354
|
+
predicateDigest: grantPayload.outcomePredicateDigest,
|
|
355
|
+
expectedStateDigest: sha256(canonicalJson(expectedState)),
|
|
356
|
+
observedStateDigest: sha256(canonicalJson(input.observation.observedState)),
|
|
357
|
+
result: outcomeResult,
|
|
358
|
+
observationMethod: input.observation.observationMethod,
|
|
359
|
+
observationIndependence: "SEPARATE_READ_ONLY_PROBE",
|
|
360
|
+
observationSource: input.observation.observationSource,
|
|
361
|
+
sourceEvidenceDigest: sha256(canonicalJson(input.observation)),
|
|
362
|
+
evidenceReferences: ["target-audit:" + input.audit.transactionId],
|
|
363
|
+
collectorIdentityId: input.runtime.id,
|
|
364
|
+
collectorKeyId: input.runtime.keyId,
|
|
365
|
+
collectedAt: completedAt,
|
|
366
|
+
confidence: input.observation.confidence ?? 1,
|
|
367
|
+
limitations: ["The generated probe reads a separate localhost read credential; it is not an Independent Review."],
|
|
368
|
+
});
|
|
369
|
+
append("EXECUTION_SESSION_COMPLETED", { outcomeAttestationDigest: outcomeAttestation.payloadSha256 });
|
|
370
|
+
const credentialReferenceDigest = sha256(input.writeCredentialHandle);
|
|
371
|
+
const targetEvent = {
|
|
372
|
+
targetEventId: input.audit.transactionId,
|
|
373
|
+
actionId: input.action.id,
|
|
374
|
+
executionSessionId: input.execution.executionSessionId,
|
|
375
|
+
occurredAt: input.audit.at ?? completedAt,
|
|
376
|
+
operation: grantPayload.allowedOperation,
|
|
377
|
+
resource: grantPayload.allowedResource,
|
|
378
|
+
parametersDigest: grantPayload.parametersDigest,
|
|
379
|
+
credentialReferenceDigest,
|
|
380
|
+
};
|
|
381
|
+
const reconciliationReport = signRuntime({
|
|
382
|
+
protocolVersion: "agentcert.browser_enforcement.v0.2",
|
|
383
|
+
objectType: "ReconciliationReport",
|
|
384
|
+
signatureContext: "onegent.reconciliation-report.v0.2",
|
|
385
|
+
reconciliationReportId: randomUUID(),
|
|
386
|
+
tenantId: grantPayload.tenantId,
|
|
387
|
+
actionId: input.action.id,
|
|
388
|
+
executionSessionId: input.execution.executionSessionId,
|
|
389
|
+
targetSystem: grantPayload.targetAudience,
|
|
390
|
+
accountOrCredentialReferenceDigest: credentialReferenceDigest,
|
|
391
|
+
reconciliationWindowStart: claimedAt,
|
|
392
|
+
reconciliationWindowEnd: completedAt,
|
|
393
|
+
expectedActionIds: [input.action.id],
|
|
394
|
+
observedTargetEvents: [targetEvent],
|
|
395
|
+
matchedEvents: [input.audit.transactionId],
|
|
396
|
+
unmatchedTargetEvents: [],
|
|
397
|
+
unmatchedReceipts: [],
|
|
398
|
+
duplicateMatches: [],
|
|
399
|
+
result: "PASSED",
|
|
400
|
+
limitations: ["Reconciliation covers the dedicated localhost sandbox credential and this action only."],
|
|
401
|
+
collectorIdentityId: input.runtime.id,
|
|
402
|
+
collectedAt: completedAt,
|
|
403
|
+
});
|
|
404
|
+
const eventCheckpoint = signRuntime({
|
|
405
|
+
protocolVersion: "agentcert.browser_enforcement.v0.2",
|
|
406
|
+
objectType: "EventChainCheckpoint",
|
|
407
|
+
signatureContext: "onegent.event-checkpoint.v0.2",
|
|
408
|
+
actionId: input.action.id,
|
|
409
|
+
executionSessionId: input.execution.executionSessionId,
|
|
410
|
+
eventCount: events.length,
|
|
411
|
+
firstEventHash: events[0].payloadSha256,
|
|
412
|
+
finalEventHash: events.at(-1).payloadSha256,
|
|
413
|
+
completedAt,
|
|
414
|
+
});
|
|
415
|
+
return {
|
|
416
|
+
protocolVersion: "agentcert.browser_enforcement.v0.2",
|
|
417
|
+
executionGrant: grant,
|
|
418
|
+
grantStatus: "CONSUMED",
|
|
419
|
+
runtimeClaim,
|
|
420
|
+
executionSession,
|
|
421
|
+
credentialLease: {
|
|
422
|
+
credentialLeaseId,
|
|
423
|
+
tenantId: grantPayload.tenantId,
|
|
424
|
+
actionId: input.action.id,
|
|
425
|
+
executionSessionId: input.execution.executionSessionId,
|
|
426
|
+
providerType: "CUSTOMER_SECRET_PROVIDER",
|
|
427
|
+
providerReference: "opaque:" + credentialReferenceDigest,
|
|
428
|
+
targetAudience: grantPayload.targetAudience,
|
|
429
|
+
scopeDigest: sha256(canonicalJson({ allowedOrigins: grantPayload.allowedOrigins, operation: grantPayload.allowedOperation, resource: grantPayload.allowedResource })),
|
|
430
|
+
isolationMode: "RUNTIME_INJECTED_CREDENTIAL",
|
|
431
|
+
issuedAt: claimedAt,
|
|
432
|
+
expiresAt: grantPayload.expiresAt,
|
|
433
|
+
status: "REVOKED",
|
|
434
|
+
revokedAt: completedAt,
|
|
435
|
+
},
|
|
436
|
+
events,
|
|
437
|
+
eventCheckpoint,
|
|
438
|
+
outcomeAttestation,
|
|
439
|
+
reconciliationReport,
|
|
440
|
+
finalParametersDigest: grantPayload.parametersDigest,
|
|
441
|
+
detectedBypass: false,
|
|
442
|
+
execution: { method: "LOCAL_ADAPTER", status: "COMPLETED", targetSystem: input.action.targetSystem, observedState: input.execution.observedState },
|
|
224
443
|
};
|
|
225
444
|
}
|
|
226
445
|
|
|
446
|
+
function subsetMatches(expected, observed) { return Object.entries(expected).every(([key, value]) => canonicalJson(observed[key]) === canonicalJson(value)); }
|
|
447
|
+
|
|
227
448
|
function localhostTarget(proposal) {
|
|
228
449
|
if (proposal?.targetSystem !== "WitnoraLocalSandbox") throw new Error("sandbox_target_system_invalid");
|
|
229
450
|
const origins = proposal?.executionIntent?.allowedOrigins;
|