@getvda/witness 0.1.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,134 @@
1
+ /**
2
+ * Witness contract types — mirrored from the live OpenAPI at
3
+ * https://witness.getvda.ai/openapi.json (verified 2026-07-18). Only the fields
4
+ * ACP produces/consumes are modelled; unknown fields are preserved via index
5
+ * signatures so records round-trip intact.
6
+ */
7
+ export interface Actor {
8
+ readonly id: string;
9
+ readonly type: 'human' | 'agent' | 'system';
10
+ readonly role?: string;
11
+ }
12
+ /** A rule governing a decision. `ref` required; `text`/`hash` optional. */
13
+ export interface GoverningClause {
14
+ readonly ref: string;
15
+ readonly text?: string;
16
+ readonly hash?: string;
17
+ }
18
+ /** Content-addressed evidence. `hash` is REQUIRED (sha256:<hex>). This is where a
19
+ * git commit reference rides (ref = commit URL/sha, hash = sha256 of content). */
20
+ export interface Evidence {
21
+ readonly ref: string;
22
+ readonly hash: string;
23
+ readonly media_type?: string;
24
+ readonly description?: string;
25
+ readonly captured_at?: string;
26
+ }
27
+ export type Disposition = 'approved' | 'rejected' | 'escalated' | 'modified';
28
+ /** POST /api/witness/seal/hitl-decision request. */
29
+ export interface HitlDecisionParams {
30
+ readonly actor: Actor & {
31
+ type: 'human';
32
+ };
33
+ readonly decision: {
34
+ statement: string;
35
+ disposition?: Disposition;
36
+ };
37
+ readonly governing_clauses: readonly GoverningClause[];
38
+ readonly evidence?: readonly Evidence[];
39
+ readonly evidence_omitted_reason?: string;
40
+ readonly basis_captured_at: string;
41
+ readonly decision_context?: string;
42
+ readonly chainKey?: string;
43
+ readonly decisionId?: string;
44
+ }
45
+ export interface RecordProof {
46
+ readonly algorithm: string;
47
+ readonly signature: string;
48
+ readonly created: string;
49
+ }
50
+ export interface WitnessRecord {
51
+ readonly schema: string;
52
+ readonly recordId: string;
53
+ readonly account?: string;
54
+ readonly seq?: number;
55
+ readonly issuedAt?: string;
56
+ /** Real Witness returns a signer OBJECT (keyId, custody, algorithm,
57
+ * publicKeyJwk) for customer-managed records; older shapes used a string. */
58
+ readonly signer?: unknown;
59
+ readonly prevHash?: string | null;
60
+ readonly proof?: RecordProof;
61
+ readonly [key: string]: unknown;
62
+ }
63
+ export interface SealedRecord {
64
+ readonly record: WitnessRecord;
65
+ readonly bodyHash?: string;
66
+ readonly sealed: boolean;
67
+ readonly anchored: boolean;
68
+ readonly sealedState: string;
69
+ }
70
+ /** POST /api/witness/seal/attestation — required [actor, claim, as_of]. Used for
71
+ * governance version-activation (claim references the git commit hash). */
72
+ export interface AttestationParams {
73
+ readonly actor: Actor;
74
+ readonly claim: string;
75
+ readonly as_of: string;
76
+ readonly evidence?: readonly Evidence[];
77
+ readonly governing_basis?: GoverningClause;
78
+ readonly context?: string;
79
+ readonly chainKey?: string;
80
+ readonly decisionId?: string;
81
+ }
82
+ /** POST /api/witness/seal/agent-action — required [actor, action, governing_rule].
83
+ * Used by the evaluator SDK to seal a runtime evaluation outcome. */
84
+ export interface AgentActionParams {
85
+ readonly actor: Actor & {
86
+ type: 'agent' | 'system';
87
+ };
88
+ readonly action: {
89
+ statement: string;
90
+ outcome?: string;
91
+ rationale?: string;
92
+ };
93
+ readonly governing_rule: GoverningClause;
94
+ readonly evidence?: readonly Evidence[];
95
+ readonly parameters?: Record<string, unknown>;
96
+ readonly evidence_omitted_reason?: string;
97
+ readonly agent_context?: Record<string, unknown>;
98
+ readonly basis_captured_at?: string;
99
+ readonly chainKey?: string;
100
+ readonly decisionId?: string;
101
+ }
102
+ export interface WhoAmI {
103
+ readonly account_id: string;
104
+ readonly tier: 'SEALED' | 'ANCHORED';
105
+ readonly scopes: readonly string[];
106
+ readonly compliance: boolean;
107
+ readonly key_id: string;
108
+ readonly revoked: boolean;
109
+ readonly expires_at: string | null;
110
+ }
111
+ export interface VerifyResult {
112
+ readonly ok: boolean;
113
+ readonly bodyHash?: string;
114
+ readonly signatureValid: boolean;
115
+ readonly errors?: readonly string[];
116
+ }
117
+ /**
118
+ * The Witness surface ACP uses. A real HTTP client and a no-network fake both
119
+ * implement this — the same substrate-with-a-fake pattern as the git provider,
120
+ * so the whole approval loop runs before Mike provisions ACP's Witness account.
121
+ */
122
+ export interface WitnessClient {
123
+ /** Seal a HITL decision (customer-managed custody in the real client). */
124
+ sealHitlDecision(params: HitlDecisionParams): Promise<SealedRecord>;
125
+ /** Seal an attestation (e.g. a governance version activation). */
126
+ sealAttestation(params: AttestationParams): Promise<SealedRecord>;
127
+ /** Seal an agent action (e.g. a runtime evaluation outcome). */
128
+ sealAgentAction(params: AgentActionParams): Promise<SealedRecord>;
129
+ /** Contract A — resolve the account behind the API key. */
130
+ whoami(): Promise<WhoAmI>;
131
+ /** Public verification of a sealed record's signature/chain. */
132
+ verify(record: WitnessRecord): Promise<VerifyResult>;
133
+ }
134
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC5C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,2EAA2E;AAC3E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;mFACmF;AACnF,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CA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AC,YAAY,CAAC,CAAC;IAClE,gEAAgE;IAChE,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAClE,2DAA2D;IAC3D,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1B,gEAAgE;IAChE,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACtD"}
package/dist/types.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Witness contract types — mirrored from the live OpenAPI at
3
+ * https://witness.getvda.ai/openapi.json (verified 2026-07-18). Only the fields
4
+ * ACP produces/consumes are modelled; unknown fields are preserved via index
5
+ * signatures so records round-trip intact.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@getvda/witness",
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "Witness sealing substrate for ACP. Real HTTP client (customer-managed custody: prepare→sign→submit) + a no-network fake for tests/demo. Seals hitl_decision / agent_action to witness.getvda.ai.",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "scripts": {
10
+ "build": "tsc --build",
11
+ "typecheck": "tsc --noEmit",
12
+ "test": "vitest run"
13
+ },
14
+ "license": "Apache-2.0",
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "README.md",
21
+ "LICENSE",
22
+ "NOTICE"
23
+ ],
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/getvda-ai/acp-agent.git",
27
+ "directory": "packages/witness"
28
+ },
29
+ "homepage": "https://getvda.ai"
30
+ }