@odingard/guardian-sdk 0.0.0-stage → 0.2.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/LICENSE +201 -0
- package/README.md +302 -2
- package/dist/contracts.js +9865 -0
- package/dist/index.js +14437 -0
- package/dist/public-catalog.v1.json +6915 -0
- package/dist-dts/catalog.d.ts +14 -0
- package/dist-dts/client.d.ts +130 -0
- package/dist-dts/contracts/action-pack.d.ts +464 -0
- package/dist-dts/contracts/action-parameters.d.ts +34 -0
- package/dist-dts/contracts/action-registry.d.ts +287 -0
- package/dist-dts/contracts/action.d.ts +2358 -0
- package/dist-dts/contracts/agent-state.d.ts +386 -0
- package/dist-dts/contracts/api.d.ts +78 -0
- package/dist-dts/contracts/approval.d.ts +425 -0
- package/dist-dts/contracts/assurance.d.ts +60 -0
- package/dist-dts/contracts/authority-graph.d.ts +294 -0
- package/dist-dts/contracts/authority-state.d.ts +108 -0
- package/dist-dts/contracts/authority.d.ts +339 -0
- package/dist-dts/contracts/billing.d.ts +32 -0
- package/dist-dts/contracts/calendar.d.ts +146 -0
- package/dist-dts/contracts/canonical-json.d.ts +4 -0
- package/dist-dts/contracts/capability.d.ts +28 -0
- package/dist-dts/contracts/commerce.d.ts +133 -0
- package/dist-dts/contracts/denial.d.ts +648 -0
- package/dist-dts/contracts/digest.d.ts +2 -0
- package/dist-dts/contracts/email.d.ts +45 -0
- package/dist-dts/contracts/evidence.d.ts +1087 -0
- package/dist-dts/contracts/execution.d.ts +1732 -0
- package/dist-dts/contracts/files.d.ts +61 -0
- package/dist-dts/contracts/identifiers.d.ts +49 -0
- package/dist-dts/contracts/index.d.ts +41 -0
- package/dist-dts/contracts/intent.d.ts +335 -0
- package/dist-dts/contracts/lineage.d.ts +218 -0
- package/dist-dts/contracts/local.d.ts +101 -0
- package/dist-dts/contracts/multi-principal.d.ts +292 -0
- package/dist-dts/contracts/multiparty.d.ts +169 -0
- package/dist-dts/contracts/obligation.d.ts +196 -0
- package/dist-dts/contracts/plan.d.ts +67 -0
- package/dist-dts/contracts/policy-simulation.d.ts +681 -0
- package/dist-dts/contracts/prerequisite.d.ts +147 -0
- package/dist-dts/contracts/protected-data.d.ts +160 -0
- package/dist-dts/contracts/receipt.d.ts +3126 -0
- package/dist-dts/contracts/resource-claims.d.ts +146 -0
- package/dist-dts/contracts/runtime.d.ts +111 -0
- package/dist-dts/contracts/safety-envelope.d.ts +287 -0
- package/dist-dts/contracts/sequence.d.ts +132 -0
- package/dist-dts/contracts/sources.d.ts +191 -0
- package/dist-dts/contracts/tools.d.ts +232 -0
- package/dist-dts/contracts/transaction.d.ts +360 -0
- package/dist-dts/contracts-entry.d.ts +1 -0
- package/dist-dts/embedded.d.ts +58 -0
- package/dist-dts/evidence/evidence.d.ts +25 -0
- package/dist-dts/evidence/receipt.d.ts +61 -0
- package/dist-dts/index.d.ts +5 -0
- package/dist-dts/lifecycle.d.ts +25 -0
- package/dist-dts/proposal.d.ts +41 -0
- package/dist-dts/receipts.d.ts +37 -0
- package/package.json +56 -4
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* WO-013 — files surface. Representative read/write/share/delete through the
|
|
4
|
+
* file adapter on a deterministic local file store (lowest-burden provider).
|
|
5
|
+
*/
|
|
6
|
+
export declare const FILE_PATH_MAX_LENGTH = 512;
|
|
7
|
+
export declare const FILE_CONTENT_MAX_LENGTH = 64000;
|
|
8
|
+
export declare const FILE_GRANTEE_MAX_LENGTH = 256;
|
|
9
|
+
export declare const FILE_ALLOWLIST_MAX_ENTRIES = 64;
|
|
10
|
+
/**
|
|
11
|
+
* Canonical file path: `/` + non-empty segments of `[A-Za-z0-9._~-]`.
|
|
12
|
+
* No `.` or `..` segments, no `//`, no trailing slash, no root `/`.
|
|
13
|
+
* Canonical form is required so path/share allowlist prefix checks cannot
|
|
14
|
+
* be escaped by traversal or duplicate separators.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isCanonicalFilePath(value: string): boolean;
|
|
17
|
+
export declare const FilePathSchema: z.ZodString;
|
|
18
|
+
/** Grantee / counterparty token: an opaque principal label (email or id). */
|
|
19
|
+
export declare const CounterpartyTokenSchema: z.ZodString;
|
|
20
|
+
export declare const FILE_READ_SCHEMA = "odingard.guardian.file.read.v1";
|
|
21
|
+
export declare const FILE_WRITE_SCHEMA = "odingard.guardian.file.write.v1";
|
|
22
|
+
export declare const FILE_SHARE_SCHEMA = "odingard.guardian.file.share.v1";
|
|
23
|
+
export declare const FILE_DELETE_SCHEMA = "odingard.guardian.file.delete.v1";
|
|
24
|
+
export declare const FileReadParametersV1Schema: z.ZodObject<{
|
|
25
|
+
schema: z.ZodLiteral<"odingard.guardian.file.read.v1">;
|
|
26
|
+
connectionId: z.core.$ZodBranded<z.ZodString, "ConnectionId", "out">;
|
|
27
|
+
path: z.ZodString;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
export type FileReadParametersV1 = z.infer<typeof FileReadParametersV1Schema>;
|
|
30
|
+
export declare const FileWriteParametersV1Schema: z.ZodObject<{
|
|
31
|
+
schema: z.ZodLiteral<"odingard.guardian.file.write.v1">;
|
|
32
|
+
connectionId: z.core.$ZodBranded<z.ZodString, "ConnectionId", "out">;
|
|
33
|
+
path: z.ZodString;
|
|
34
|
+
content: z.ZodString;
|
|
35
|
+
}, z.core.$strict>;
|
|
36
|
+
export type FileWriteParametersV1 = z.infer<typeof FileWriteParametersV1Schema>;
|
|
37
|
+
export declare const FileShareParametersV1Schema: z.ZodObject<{
|
|
38
|
+
schema: z.ZodLiteral<"odingard.guardian.file.share.v1">;
|
|
39
|
+
connectionId: z.core.$ZodBranded<z.ZodString, "ConnectionId", "out">;
|
|
40
|
+
path: z.ZodString;
|
|
41
|
+
grantee: z.ZodString;
|
|
42
|
+
expiresAtEpochMs: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
}, z.core.$strict>;
|
|
44
|
+
export type FileShareParametersV1 = z.infer<typeof FileShareParametersV1Schema>;
|
|
45
|
+
export declare const FileDeleteParametersV1Schema: z.ZodObject<{
|
|
46
|
+
schema: z.ZodLiteral<"odingard.guardian.file.delete.v1">;
|
|
47
|
+
connectionId: z.core.$ZodBranded<z.ZodString, "ConnectionId", "out">;
|
|
48
|
+
path: z.ZodString;
|
|
49
|
+
}, z.core.$strict>;
|
|
50
|
+
export type FileDeleteParametersV1 = z.infer<typeof FileDeleteParametersV1Schema>;
|
|
51
|
+
/**
|
|
52
|
+
* Fail-closed prefix match over canonical paths: `path` must equal an
|
|
53
|
+
* allowlist entry or sit under an entry that ends with `/`. A trailing-slash
|
|
54
|
+
* prefix cannot be escaped because `..` and `//` are excluded by canonical
|
|
55
|
+
* form.
|
|
56
|
+
*/
|
|
57
|
+
export declare function filePathWithinAllowlist(path: string, allowlist: readonly string[]): boolean;
|
|
58
|
+
export declare function fileReadVerificationProjection(input: FileReadParametersV1): unknown;
|
|
59
|
+
export declare function fileWriteVerificationProjection(input: FileWriteParametersV1): unknown;
|
|
60
|
+
export declare function fileShareVerificationProjection(input: FileShareParametersV1): unknown;
|
|
61
|
+
export declare function fileDeleteVerificationProjection(input: FileDeleteParametersV1): unknown;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const TenantIdSchema: z.core.$ZodBranded<z.ZodString, "TenantId", "out">;
|
|
3
|
+
export declare const PrincipalIdSchema: z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">;
|
|
4
|
+
export declare const AgentIdSchema: z.core.$ZodBranded<z.ZodString, "AgentId", "out">;
|
|
5
|
+
export declare const GrantIdSchema: z.core.$ZodBranded<z.ZodString, "GrantId", "out">;
|
|
6
|
+
export declare const PolicyIdSchema: z.core.$ZodBranded<z.ZodString, "PolicyId", "out">;
|
|
7
|
+
export declare const RequestIdSchema: z.core.$ZodBranded<z.ZodString, "RequestId", "out">;
|
|
8
|
+
export declare const ApprovalIdSchema: z.core.$ZodBranded<z.ZodString, "ApprovalId", "out">;
|
|
9
|
+
export declare const CapabilityIdSchema: z.core.$ZodBranded<z.ZodString, "CapabilityId", "out">;
|
|
10
|
+
export declare const CorrelationIdSchema: z.core.$ZodBranded<z.ZodString, "CorrelationId", "out">;
|
|
11
|
+
export declare const EvidenceIdSchema: z.core.$ZodBranded<z.ZodString, "EvidenceId", "out">;
|
|
12
|
+
export declare const AdapterIdSchema: z.core.$ZodBranded<z.ZodString, "AdapterId", "out">;
|
|
13
|
+
export declare const ConnectionIdSchema: z.core.$ZodBranded<z.ZodString, "ConnectionId", "out">;
|
|
14
|
+
export declare const AttemptIdSchema: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
|
|
15
|
+
export declare const BudgetIdSchema: z.core.$ZodBranded<z.ZodString, "BudgetId", "out">;
|
|
16
|
+
export declare const TaskIdSchema: z.core.$ZodBranded<z.ZodString, "TaskId", "out">;
|
|
17
|
+
export declare const PauseIdSchema: z.core.$ZodBranded<z.ZodString, "PauseId", "out">;
|
|
18
|
+
export declare const ScopeIdSchema: z.core.$ZodBranded<z.ZodString, "ScopeId", "out">;
|
|
19
|
+
export declare const MembershipIdSchema: z.core.$ZodBranded<z.ZodString, "MembershipId", "out">;
|
|
20
|
+
export declare const IntentIdSchema: z.core.$ZodBranded<z.ZodString, "IntentId", "out">;
|
|
21
|
+
export declare const PlanIdSchema: z.core.$ZodBranded<z.ZodString, "PlanId", "out">;
|
|
22
|
+
export declare const DataObjectIdSchema: z.core.$ZodBranded<z.ZodString, "DataObjectId", "out">;
|
|
23
|
+
export declare const LineageEventIdSchema: z.core.$ZodBranded<z.ZodString, "LineageEventId", "out">;
|
|
24
|
+
export declare const TransactionIdSchema: z.core.$ZodBranded<z.ZodString, "TransactionId", "out">;
|
|
25
|
+
export declare const NonceSchema: z.core.$ZodBranded<z.ZodString, "Nonce", "out">;
|
|
26
|
+
export type TenantId = z.infer<typeof TenantIdSchema>;
|
|
27
|
+
export type PrincipalId = z.infer<typeof PrincipalIdSchema>;
|
|
28
|
+
export type AgentId = z.infer<typeof AgentIdSchema>;
|
|
29
|
+
export type GrantId = z.infer<typeof GrantIdSchema>;
|
|
30
|
+
export type PolicyId = z.infer<typeof PolicyIdSchema>;
|
|
31
|
+
export type RequestId = z.infer<typeof RequestIdSchema>;
|
|
32
|
+
export type ApprovalId = z.infer<typeof ApprovalIdSchema>;
|
|
33
|
+
export type CapabilityId = z.infer<typeof CapabilityIdSchema>;
|
|
34
|
+
export type CorrelationId = z.infer<typeof CorrelationIdSchema>;
|
|
35
|
+
export type EvidenceId = z.infer<typeof EvidenceIdSchema>;
|
|
36
|
+
export type AdapterId = z.infer<typeof AdapterIdSchema>;
|
|
37
|
+
export type ConnectionId = z.infer<typeof ConnectionIdSchema>;
|
|
38
|
+
export type AttemptId = z.infer<typeof AttemptIdSchema>;
|
|
39
|
+
export type BudgetId = z.infer<typeof BudgetIdSchema>;
|
|
40
|
+
export type TaskId = z.infer<typeof TaskIdSchema>;
|
|
41
|
+
export type PauseId = z.infer<typeof PauseIdSchema>;
|
|
42
|
+
export type ScopeId = z.infer<typeof ScopeIdSchema>;
|
|
43
|
+
export type MembershipId = z.infer<typeof MembershipIdSchema>;
|
|
44
|
+
export type IntentId = z.infer<typeof IntentIdSchema>;
|
|
45
|
+
export type PlanId = z.infer<typeof PlanIdSchema>;
|
|
46
|
+
export type DataObjectId = z.infer<typeof DataObjectIdSchema>;
|
|
47
|
+
export type LineageEventId = z.infer<typeof LineageEventIdSchema>;
|
|
48
|
+
export type TransactionId = z.infer<typeof TransactionIdSchema>;
|
|
49
|
+
export type Nonce = z.infer<typeof NonceSchema>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export * from "./action.js";
|
|
2
|
+
export * from "./action-pack.js";
|
|
3
|
+
export * from "./action-registry.js";
|
|
4
|
+
export * from "./agent-state.js";
|
|
5
|
+
export * from "./api.js";
|
|
6
|
+
export * from "./action-parameters.js";
|
|
7
|
+
export * from "./assurance.js";
|
|
8
|
+
export * from "./approval.js";
|
|
9
|
+
export * from "./authority.js";
|
|
10
|
+
export * from "./authority-state.js";
|
|
11
|
+
export * from "./authority-graph.js";
|
|
12
|
+
export * from "./billing.js";
|
|
13
|
+
export * from "./calendar.js";
|
|
14
|
+
export * from "./canonical-json.js";
|
|
15
|
+
export * from "./capability.js";
|
|
16
|
+
export * from "./commerce.js";
|
|
17
|
+
export * from "./denial.js";
|
|
18
|
+
export * from "./digest.js";
|
|
19
|
+
export * from "./identifiers.js";
|
|
20
|
+
export * from "./intent.js";
|
|
21
|
+
export * from "./lineage.js";
|
|
22
|
+
export * from "./evidence.js";
|
|
23
|
+
export * from "./plan.js";
|
|
24
|
+
export * from "./policy-simulation.js";
|
|
25
|
+
export * from "./receipt.js";
|
|
26
|
+
export * from "./tools.js";
|
|
27
|
+
export * from "./transaction.js";
|
|
28
|
+
export * from "./email.js";
|
|
29
|
+
export * from "./execution.js";
|
|
30
|
+
export * from "./files.js";
|
|
31
|
+
export * from "./local.js";
|
|
32
|
+
export * from "./multi-principal.js";
|
|
33
|
+
export * from "./multiparty.js";
|
|
34
|
+
export * from "./obligation.js";
|
|
35
|
+
export * from "./prerequisite.js";
|
|
36
|
+
export * from "./protected-data.js";
|
|
37
|
+
export * from "./safety-envelope.js";
|
|
38
|
+
export * from "./sequence.js";
|
|
39
|
+
export * from "./sources.js";
|
|
40
|
+
export * from "./resource-claims.js";
|
|
41
|
+
export * from "./runtime.js";
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* WO-022: guardian.intent.v1 — first-class Intent Authority.
|
|
4
|
+
*
|
|
5
|
+
* An intent is a human-authored container that NARROWS what an agent may do
|
|
6
|
+
* for a bounded objective: which agents may act, which action families,
|
|
7
|
+
* which resources and counterparties, and how much value/activity the
|
|
8
|
+
* container may commit. Intents never enlarge authority — the gateway
|
|
9
|
+
* pre-gate intersects the intent's allowlists with the agent's existing
|
|
10
|
+
* authority chain, so an empty intersection denies. An intent is a
|
|
11
|
+
* declarative input to the one authority kernel (directive §89, K15);
|
|
12
|
+
* it grants no authority of its own.
|
|
13
|
+
*
|
|
14
|
+
* `obligations` and `prerequisites` are WO-023 declarative inputs
|
|
15
|
+
* (guardian.obligation.v1 / guardian.prerequisite.v1): they are evaluated
|
|
16
|
+
* deterministically at the gateway pre-gate — a failed or unsettleable
|
|
17
|
+
* entry denies, human-facing entries route through the existing ASK
|
|
18
|
+
* machinery, and nothing here ever enlarges authority.
|
|
19
|
+
* `dataBudget`/`networkBudget` are tracked-only counters — they are
|
|
20
|
+
* recorded at capability issue but do not deny.
|
|
21
|
+
*/
|
|
22
|
+
export declare const INTENT_CONTRACT_SCHEMA = "guardian.intent.v1";
|
|
23
|
+
export declare const IntentStatusSchema: z.ZodEnum<{
|
|
24
|
+
draft: "draft";
|
|
25
|
+
active: "active";
|
|
26
|
+
revoked: "revoked";
|
|
27
|
+
expired: "expired";
|
|
28
|
+
paused: "paused";
|
|
29
|
+
completed: "completed";
|
|
30
|
+
}>;
|
|
31
|
+
export type IntentStatus = z.infer<typeof IntentStatusSchema>;
|
|
32
|
+
export declare function canTransitionIntent(from: IntentStatus, to: IntentStatus): boolean;
|
|
33
|
+
/** Absolute denials match an action id exactly or `family:<name>`. */
|
|
34
|
+
export declare const AbsoluteDenialSchema: z.ZodString;
|
|
35
|
+
/** Per-kind protected_data caps inside an intent (subset of §7 protected_data_rules). */
|
|
36
|
+
export declare const IntentProtectedDataRuleSchema: z.ZodObject<{
|
|
37
|
+
kind: z.ZodEnum<{
|
|
38
|
+
view: "view";
|
|
39
|
+
use: "use";
|
|
40
|
+
disclose: "disclose";
|
|
41
|
+
persist: "persist";
|
|
42
|
+
}>;
|
|
43
|
+
maxCount: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
}, z.core.$strict>;
|
|
45
|
+
export type IntentProtectedDataRule = z.infer<typeof IntentProtectedDataRuleSchema>;
|
|
46
|
+
export declare const IntentContractSchema: z.ZodObject<{
|
|
47
|
+
schema: z.ZodLiteral<"guardian.intent.v1">;
|
|
48
|
+
intentId: z.core.$ZodBranded<z.ZodString, "IntentId", "out">;
|
|
49
|
+
tenantId: z.core.$ZodBranded<z.ZodString, "TenantId", "out">;
|
|
50
|
+
principal: z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">;
|
|
51
|
+
title: z.ZodString;
|
|
52
|
+
purpose: z.ZodString;
|
|
53
|
+
desiredOutcome: z.ZodString;
|
|
54
|
+
start: z.ZodNumber;
|
|
55
|
+
expires: z.ZodNumber;
|
|
56
|
+
authorizedAgents: z.ZodArray<z.core.$ZodBranded<z.ZodString, "AgentId", "out">>;
|
|
57
|
+
allowedActionFamilies: z.ZodArray<z.ZodString>;
|
|
58
|
+
allowedResources: z.ZodOptional<z.ZodArray<z.core.$ZodBranded<z.ZodString, "ResourceRef", "out">>>;
|
|
59
|
+
counterparties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
60
|
+
moneyBudgetCents: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
toolBudget: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
timeBudgetMs: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
dataBudget: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
networkBudget: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
protectedDataRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
66
|
+
kind: z.ZodEnum<{
|
|
67
|
+
view: "view";
|
|
68
|
+
use: "use";
|
|
69
|
+
disclose: "disclose";
|
|
70
|
+
persist: "persist";
|
|
71
|
+
}>;
|
|
72
|
+
maxCount: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
}, z.core.$strict>>>;
|
|
74
|
+
delegationDepth: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
obligations: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
76
|
+
type: z.ZodEnum<{
|
|
77
|
+
log: "log";
|
|
78
|
+
retain_receipt: "retain_receipt";
|
|
79
|
+
notify: "notify";
|
|
80
|
+
delay: "delay";
|
|
81
|
+
cooling_period: "cooling_period";
|
|
82
|
+
delete_after_use: "delete_after_use";
|
|
83
|
+
redact: "redact";
|
|
84
|
+
encrypt: "encrypt";
|
|
85
|
+
tokenize: "tokenize";
|
|
86
|
+
minimize: "minimize";
|
|
87
|
+
verify_counterparty: "verify_counterparty";
|
|
88
|
+
verify_resource: "verify_resource";
|
|
89
|
+
verify_effect: "verify_effect";
|
|
90
|
+
attest_runtime: "attest_runtime";
|
|
91
|
+
require_consent: "require_consent";
|
|
92
|
+
require_location: "require_location";
|
|
93
|
+
require_device: "require_device";
|
|
94
|
+
require_network: "require_network";
|
|
95
|
+
require_contract: "require_contract";
|
|
96
|
+
step_up: "step_up";
|
|
97
|
+
second_approver: "second_approver";
|
|
98
|
+
quorum: "quorum";
|
|
99
|
+
authenticate: "authenticate";
|
|
100
|
+
}>;
|
|
101
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
|
|
102
|
+
}, z.core.$strict>, z.ZodPipe<z.ZodEnum<{
|
|
103
|
+
log: "log";
|
|
104
|
+
retain_receipt: "retain_receipt";
|
|
105
|
+
notify: "notify";
|
|
106
|
+
delay: "delay";
|
|
107
|
+
cooling_period: "cooling_period";
|
|
108
|
+
delete_after_use: "delete_after_use";
|
|
109
|
+
redact: "redact";
|
|
110
|
+
encrypt: "encrypt";
|
|
111
|
+
tokenize: "tokenize";
|
|
112
|
+
minimize: "minimize";
|
|
113
|
+
verify_counterparty: "verify_counterparty";
|
|
114
|
+
verify_resource: "verify_resource";
|
|
115
|
+
verify_effect: "verify_effect";
|
|
116
|
+
attest_runtime: "attest_runtime";
|
|
117
|
+
require_consent: "require_consent";
|
|
118
|
+
require_location: "require_location";
|
|
119
|
+
require_device: "require_device";
|
|
120
|
+
require_network: "require_network";
|
|
121
|
+
require_contract: "require_contract";
|
|
122
|
+
step_up: "step_up";
|
|
123
|
+
second_approver: "second_approver";
|
|
124
|
+
quorum: "quorum";
|
|
125
|
+
authenticate: "authenticate";
|
|
126
|
+
}>, z.ZodTransform<{
|
|
127
|
+
type: "log" | "retain_receipt" | "notify" | "delay" | "cooling_period" | "delete_after_use" | "redact" | "encrypt" | "tokenize" | "minimize" | "verify_counterparty" | "verify_resource" | "verify_effect" | "attest_runtime" | "require_consent" | "require_location" | "require_device" | "require_network" | "require_contract" | "step_up" | "second_approver" | "quorum" | "authenticate";
|
|
128
|
+
}, "log" | "retain_receipt" | "notify" | "delay" | "cooling_period" | "delete_after_use" | "redact" | "encrypt" | "tokenize" | "minimize" | "verify_counterparty" | "verify_resource" | "verify_effect" | "attest_runtime" | "require_consent" | "require_location" | "require_device" | "require_network" | "require_contract" | "step_up" | "second_approver" | "quorum" | "authenticate">>]>>;
|
|
129
|
+
prerequisites: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
130
|
+
id: z.ZodString;
|
|
131
|
+
type: z.ZodEnum<{
|
|
132
|
+
merchant_verified: "merchant_verified";
|
|
133
|
+
counterparty_verified: "counterparty_verified";
|
|
134
|
+
budget_available: "budget_available";
|
|
135
|
+
capability_present: "capability_present";
|
|
136
|
+
address_authority: "address_authority";
|
|
137
|
+
human_approval: "human_approval";
|
|
138
|
+
}>;
|
|
139
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
|
|
140
|
+
}, z.core.$strict>>>;
|
|
141
|
+
sequences: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
142
|
+
id: z.ZodString;
|
|
143
|
+
a: z.ZodOptional<z.ZodObject<{
|
|
144
|
+
action: z.ZodOptional<z.ZodString>;
|
|
145
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
146
|
+
counterparty: z.ZodOptional<z.ZodString>;
|
|
147
|
+
}, z.core.$strict>>;
|
|
148
|
+
b: z.ZodOptional<z.ZodObject<{
|
|
149
|
+
action: z.ZodOptional<z.ZodString>;
|
|
150
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
151
|
+
counterparty: z.ZodOptional<z.ZodString>;
|
|
152
|
+
}, z.core.$strict>>;
|
|
153
|
+
combinator: z.ZodEnum<{
|
|
154
|
+
then: "then";
|
|
155
|
+
plus: "plus";
|
|
156
|
+
within_minutes: "within_minutes";
|
|
157
|
+
using_result_of: "using_result_of";
|
|
158
|
+
affecting_resource_of: "affecting_resource_of";
|
|
159
|
+
after_protected_data: "after_protected_data";
|
|
160
|
+
}>;
|
|
161
|
+
windowMinutes: z.ZodOptional<z.ZodNumber>;
|
|
162
|
+
effect: z.ZodEnum<{
|
|
163
|
+
deny: "deny";
|
|
164
|
+
require_approval: "require_approval";
|
|
165
|
+
}>;
|
|
166
|
+
}, z.core.$strict>>>;
|
|
167
|
+
lineage: z.ZodOptional<z.ZodObject<{
|
|
168
|
+
maxClassification: z.ZodOptional<z.ZodEnum<{
|
|
169
|
+
financial: "financial";
|
|
170
|
+
internal: "internal";
|
|
171
|
+
public: "public";
|
|
172
|
+
pii: "pii";
|
|
173
|
+
phi: "phi";
|
|
174
|
+
credential: "credential";
|
|
175
|
+
confidential: "confidential";
|
|
176
|
+
}>>;
|
|
177
|
+
requireApprovalAbove: z.ZodOptional<z.ZodEnum<{
|
|
178
|
+
financial: "financial";
|
|
179
|
+
internal: "internal";
|
|
180
|
+
public: "public";
|
|
181
|
+
pii: "pii";
|
|
182
|
+
phi: "phi";
|
|
183
|
+
credential: "credential";
|
|
184
|
+
confidential: "confidential";
|
|
185
|
+
}>>;
|
|
186
|
+
}, z.core.$strict>>;
|
|
187
|
+
runtime: z.ZodOptional<z.ZodObject<{
|
|
188
|
+
minLevel: z.ZodOptional<z.ZodEnum<{
|
|
189
|
+
T0_UNKNOWN: "T0_UNKNOWN";
|
|
190
|
+
T1_IDENTIFIED: "T1_IDENTIFIED";
|
|
191
|
+
T2_VERIFIED: "T2_VERIFIED";
|
|
192
|
+
T3_ATTESTED: "T3_ATTESTED";
|
|
193
|
+
T4_HARDWARE_BACKED: "T4_HARDWARE_BACKED";
|
|
194
|
+
}>>;
|
|
195
|
+
requireApprovalBelow: z.ZodOptional<z.ZodEnum<{
|
|
196
|
+
T0_UNKNOWN: "T0_UNKNOWN";
|
|
197
|
+
T1_IDENTIFIED: "T1_IDENTIFIED";
|
|
198
|
+
T2_VERIFIED: "T2_VERIFIED";
|
|
199
|
+
T3_ATTESTED: "T3_ATTESTED";
|
|
200
|
+
T4_HARDWARE_BACKED: "T4_HARDWARE_BACKED";
|
|
201
|
+
}>>;
|
|
202
|
+
}, z.core.$strict>>;
|
|
203
|
+
approvalStructure: z.ZodOptional<z.ZodObject<{
|
|
204
|
+
schema: z.ZodLiteral<"guardian.multiparty.v1">;
|
|
205
|
+
structureId: z.ZodString;
|
|
206
|
+
members: z.ZodArray<z.ZodObject<{
|
|
207
|
+
memberId: z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">;
|
|
208
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
209
|
+
}, z.core.$strict>>;
|
|
210
|
+
requirement: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
211
|
+
kind: z.ZodLiteral<"single">;
|
|
212
|
+
memberId: z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">;
|
|
213
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
214
|
+
kind: z.ZodLiteral<"nOfM">;
|
|
215
|
+
n: z.ZodNumber;
|
|
216
|
+
members: z.ZodArray<z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">>;
|
|
217
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
218
|
+
kind: z.ZodLiteral<"unanimous">;
|
|
219
|
+
members: z.ZodArray<z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">>;
|
|
220
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
221
|
+
kind: z.ZodLiteral<"roleQuorum">;
|
|
222
|
+
role: z.ZodString;
|
|
223
|
+
n: z.ZodNumber;
|
|
224
|
+
m: z.ZodNumber;
|
|
225
|
+
}, z.core.$strict>], "kind">;
|
|
226
|
+
specificRequired: z.ZodOptional<z.ZodArray<z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">>>;
|
|
227
|
+
veto: z.ZodOptional<z.ZodArray<z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">>>;
|
|
228
|
+
separationOfDuties: z.ZodOptional<z.ZodObject<{
|
|
229
|
+
mutuallyExclusive: z.ZodArray<z.ZodArray<z.ZodString>>;
|
|
230
|
+
}, z.core.$strict>>;
|
|
231
|
+
temporaryApprovers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
232
|
+
memberId: z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">;
|
|
233
|
+
expiresAtEpochMs: z.ZodNumber;
|
|
234
|
+
}, z.core.$strict>>>;
|
|
235
|
+
delegatedApprovers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
236
|
+
memberId: z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">;
|
|
237
|
+
delegatedBy: z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">;
|
|
238
|
+
}, z.core.$strict>>>;
|
|
239
|
+
emergencyApprovers: z.ZodOptional<z.ZodArray<z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">>>;
|
|
240
|
+
coolingPeriod: z.ZodOptional<z.ZodObject<{
|
|
241
|
+
seconds: z.ZodNumber;
|
|
242
|
+
}, z.core.$strict>>;
|
|
243
|
+
}, z.core.$strict>>;
|
|
244
|
+
authoritySources: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
245
|
+
transaction: z.ZodOptional<z.ZodObject<{
|
|
246
|
+
schema: z.ZodLiteral<"guardian.transaction.v1">;
|
|
247
|
+
stages: z.ZodArray<z.ZodEnum<{
|
|
248
|
+
PROPOSE: "PROPOSE";
|
|
249
|
+
PREPARE: "PREPARE";
|
|
250
|
+
AUTHORIZE: "AUTHORIZE";
|
|
251
|
+
LOCK: "LOCK";
|
|
252
|
+
COMMIT: "COMMIT";
|
|
253
|
+
VERIFY: "VERIFY";
|
|
254
|
+
SETTLE: "SETTLE";
|
|
255
|
+
}>>;
|
|
256
|
+
deadlineMs: z.ZodOptional<z.ZodNumber>;
|
|
257
|
+
}, z.core.$strict>>;
|
|
258
|
+
safetyEnvelope: z.ZodOptional<z.ZodObject<{
|
|
259
|
+
schema: z.ZodLiteral<"guardian.safety_envelope.v1">;
|
|
260
|
+
allowedZone: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
261
|
+
forbiddenZone: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
262
|
+
maxSpeed: z.ZodOptional<z.ZodNumber>;
|
|
263
|
+
maxForce: z.ZodOptional<z.ZodNumber>;
|
|
264
|
+
maxPayload: z.ZodOptional<z.ZodNumber>;
|
|
265
|
+
timeWindow: z.ZodOptional<z.ZodObject<{
|
|
266
|
+
startMinutesOfDay: z.ZodNumber;
|
|
267
|
+
endMinutesOfDay: z.ZodNumber;
|
|
268
|
+
}, z.core.$strict>>;
|
|
269
|
+
proximityConstraints: z.ZodOptional<z.ZodObject<{
|
|
270
|
+
minHumanDistance: z.ZodNumber;
|
|
271
|
+
}, z.core.$strict>>;
|
|
272
|
+
environmentConditions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
273
|
+
supervisionRequired: z.ZodOptional<z.ZodBoolean>;
|
|
274
|
+
failSafeAction: z.ZodOptional<z.ZodString>;
|
|
275
|
+
emergencyStop: z.ZodOptional<z.ZodBoolean>;
|
|
276
|
+
}, z.core.$strict>>;
|
|
277
|
+
absoluteDenials: z.ZodArray<z.ZodString>;
|
|
278
|
+
approvalPolicy: z.ZodEnum<{
|
|
279
|
+
default: "default";
|
|
280
|
+
always_ask: "always_ask";
|
|
281
|
+
}>;
|
|
282
|
+
authorityVersion: z.ZodNumber;
|
|
283
|
+
status: z.ZodEnum<{
|
|
284
|
+
draft: "draft";
|
|
285
|
+
active: "active";
|
|
286
|
+
revoked: "revoked";
|
|
287
|
+
expired: "expired";
|
|
288
|
+
paused: "paused";
|
|
289
|
+
completed: "completed";
|
|
290
|
+
}>;
|
|
291
|
+
version: z.ZodNumber;
|
|
292
|
+
createdAtEpochMs: z.ZodNumber;
|
|
293
|
+
updatedAtEpochMs: z.ZodNumber;
|
|
294
|
+
}, z.core.$strict>;
|
|
295
|
+
export type IntentContract = z.infer<typeof IntentContractSchema>;
|
|
296
|
+
export declare const IntentTransitionRequestSchema: z.ZodObject<{
|
|
297
|
+
to: z.ZodEnum<{
|
|
298
|
+
draft: "draft";
|
|
299
|
+
active: "active";
|
|
300
|
+
revoked: "revoked";
|
|
301
|
+
expired: "expired";
|
|
302
|
+
paused: "paused";
|
|
303
|
+
completed: "completed";
|
|
304
|
+
}>;
|
|
305
|
+
}, z.core.$strict>;
|
|
306
|
+
export type IntentTransitionRequest = z.infer<typeof IntentTransitionRequestSchema>;
|
|
307
|
+
/** Pure transition: returns the next contract or a reason code. */
|
|
308
|
+
export declare function transitionIntent(intent: IntentContract, to: IntentStatus, nowEpochMs: number): {
|
|
309
|
+
ok: true;
|
|
310
|
+
intent: IntentContract;
|
|
311
|
+
} | {
|
|
312
|
+
ok: false;
|
|
313
|
+
reasonCode: string;
|
|
314
|
+
};
|
|
315
|
+
/** Deterministic expiry: an active/paused intent past its expiry reads as expired. */
|
|
316
|
+
export declare function effectiveIntentStatus(intent: IntentContract, nowEpochMs: number): IntentStatus;
|
|
317
|
+
export type IntentPreGateFailure = "INTENT_NOT_FOUND" | "INTENT_TENANT_MISMATCH" | "INTENT_PRINCIPAL_MISMATCH" | "INTENT_NOT_ACTIVE" | "INTENT_NOT_YET_STARTED" | "INTENT_EXPIRED" | "INTENT_TIME_BUDGET_EXCEEDED" | "INTENT_AGENT_NOT_AUTHORIZED" | "INTENT_ACTION_DENIED" | "INTENT_DELEGATION_DEPTH_EXCEEDED" | "INTENT_TASK_NOT_IN_PLAN" | "INTENT_PROTECTED_DATA_DENIED" | "INTENT_BUDGET_EXCEEDED";
|
|
318
|
+
export interface IntentPreGateInput {
|
|
319
|
+
readonly intent: IntentContract | null;
|
|
320
|
+
readonly tenantId: string;
|
|
321
|
+
readonly principalId: string;
|
|
322
|
+
readonly agentId: string;
|
|
323
|
+
readonly actionId: string;
|
|
324
|
+
readonly actionFamily: string | null;
|
|
325
|
+
readonly nowEpochMs: number;
|
|
326
|
+
/** Delegation depth of the acting agent (0 = no parent chain). */
|
|
327
|
+
readonly agentDelegationDepth: number;
|
|
328
|
+
/** Plan task membership: when the action carries taskId, whether a plan
|
|
329
|
+
* under this intent contains that task; undefined = no plans exist. */
|
|
330
|
+
readonly taskInPlan: boolean | undefined;
|
|
331
|
+
/** For protected_data.* actions: the kind suffix (use|view|disclose|persist). */
|
|
332
|
+
readonly protectedDataKind: IntentProtectedDataRule["kind"] | null;
|
|
333
|
+
}
|
|
334
|
+
/** Pure pre-gate evaluator. Returns the failed rule name or null (pass). */
|
|
335
|
+
export declare function evaluateIntentPreGate(input: IntentPreGateInput): IntentPreGateFailure | null;
|