@tinycloud/sdk-core 2.6.3 → 2.7.0-beta.3

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,229 @@
1
+ import { InvokeFunction, InvokeAnyFunction } from '@tinycloud/sdk-services';
2
+ import { P as PolicyCapability } from '../capability-DpdAwc1W.cjs';
3
+
4
+ declare const REQUESTER_NEAR_EXPIRY_SECONDS = 30;
5
+ declare const REQUESTER_ENGINE_RETRY_ATTEMPTS = 3;
6
+ declare const REQUESTER_ENGINE_RETRY_MAX_DELAY_MS = 250;
7
+ declare const POLICY_ENGINE_CHALLENGE_REQUEST_SCHEMA: "xyz.tinycloud.policy-engine/challenge-request/v0";
8
+ declare const POLICY_ENGINE_CHALLENGE_RESPONSE_SCHEMA: "xyz.tinycloud.policy/challenge/v0";
9
+ declare const POLICY_ENGINE_RESOLVE_REQUEST_SCHEMA: "xyz.tinycloud.policy/presentation/v0";
10
+ declare const POLICY_ENGINE_DENIAL_SCHEMA: "xyz.tinycloud.policy-engine/denial/v0";
11
+ declare const HOLDER_KEY_BINDING_PRESENTATION_SCHEMA: "xyz.tinycloud.policy/presentation/v0";
12
+ declare const PORTABLE_DELEGATION_SCHEMA: "xyz.tinycloud.policy/portable-delegation/v0";
13
+ declare const POLICY_ENGINE_GRANT_PRESENTATION_DENIAL_CODES: readonly ["schema-invalid", "challenge-not-found", "challenge-expired", "challenge-nonce-consumed", "presentation-expired", "presentation-audience-mismatch", "presentation-evidence-missing", "digest-mismatch", "evidence-requirement-unknown", "evidence-requirement-duplicate", "holder-signature-invalid", "holder-signature-signer-mismatch", "id-mismatch", "requested-capabilities-exceeded", "requested-capabilities-hash-mismatch", "evidence-authority-missing", "evidence-credential-invalid", "evidence-domain-invalid", "evidence-domain-missing", "evidence-freshness-expired", "evidence-freshness-unestablishable", "evidence-issuer-missing", "evidence-issuer-untrusted", "evidence-presentation-invalid", "evidence-requirements-invalid", "evidence-verifier-unsupported", "enrollment-binding-mismatch", "enrollment-expired", "enrollment-not-yet-valid", "enrollment-out-of-scope", "enrollment-revoked", "enrollment-revoked-irreversible", "enrollment-status-rollback", "signature-invalid", "signer-not-authorized", "audience-mismatch", "capability-not-contained", "evidence-invalid", "evidence-missing", "evidence-stale", "evidence-subject-mismatch", "evidence-untrusted", "grant-ttl-exceeds-policy", "holder-did-mismatch", "holder-key-not-permitted", "holder-signature-invalid", "owner-mismatch", "policy-expired", "policy-inactive", "policy-not-found", "policy-not-satisfied", "policy-revoked", "policy-status-rollback", "rate-limited"];
14
+ type PolicyEngineGrantPresentationDenialCode = (typeof POLICY_ENGINE_GRANT_PRESENTATION_DENIAL_CODES)[number];
15
+ type TranscriptRequesterErrorCode = "requester-bootstrap-malformed" | "requester-bootstrap-unknown-key" | "requester-engine-record-signature-invalid" | "requester-engine-record-owner-mismatch" | "requester-engine-record-audience-mismatch" | "requester-engine-record-endpoint-mismatch" | "requester-engine-record-invalid" | "requester-policy-engine-endpoint-invalid" | "requester-engine-unreachable" | "requester-engine-response-invalid" | "requester-renewal-required" | "requester-challenge-reused" | "requester-presentation-invalid" | "requester-delegation-invalid" | "requester-delegation-wrong-holder" | "requester-delegation-not-refresh-only" | "requester-delegation-ttl-excessive" | "requester-delegation-capability-wider" | "requester-owner-node-endpoint-invalid" | "requester-delegation-import-failed" | "requester-invocation-signer-required" | "requester-invocation-signer-mismatch" | "requester-node-denied" | "requester-node-unreachable" | "requester-node-response-invalid" | "requester-access-not-contained" | "requester-access-denied" | "requester-access-unreachable" | "requester-access-ended" | `policy-engine-denied-${PolicyEngineGrantPresentationDenialCode}`;
16
+ type TranscriptRequesterErrorState = "bootstrap-invalid" | "denied" | "unreachable" | "renewal-required" | "access-ended" | "invalid" | "not-contained";
17
+ declare class TranscriptRequesterError extends Error {
18
+ readonly code: TranscriptRequesterErrorCode;
19
+ readonly state: TranscriptRequesterErrorState;
20
+ readonly denialCode?: PolicyEngineGrantPresentationDenialCode;
21
+ readonly status?: number;
22
+ constructor(code: TranscriptRequesterErrorCode, message: string, state?: TranscriptRequesterErrorState, denialCode?: PolicyEngineGrantPresentationDenialCode, status?: number);
23
+ }
24
+ interface RequesterHttpRequest {
25
+ readonly method: "POST" | "GET";
26
+ readonly url: string;
27
+ readonly headers?: Readonly<Record<string, string>>;
28
+ readonly body?: unknown;
29
+ /** Endpoint requests must not follow redirects. */
30
+ readonly redirect?: "error";
31
+ /** Transport must connect only to one of these pre-resolved public addresses. */
32
+ readonly allowedResolvedAddresses?: readonly string[];
33
+ }
34
+ interface RequesterHttpResponse {
35
+ readonly status: number;
36
+ readonly body: unknown;
37
+ /** Required for policy-engine and owner-node requests; reports the non-redirected final URL. */
38
+ readonly finalUrl?: string;
39
+ /** Required for policy-engine and owner-node requests; reports the actual connected IP. */
40
+ readonly resolvedAddress?: string;
41
+ }
42
+ interface RequesterEndpointResolution {
43
+ readonly addresses: readonly string[];
44
+ }
45
+ interface RequesterTransport {
46
+ request(request: RequesterHttpRequest): Promise<RequesterHttpResponse>;
47
+ /** Resolve before egress so the requester can pin public addresses and detect rebinding. */
48
+ resolveEndpoint?(endpoint: string): Promise<RequesterEndpointResolution>;
49
+ }
50
+ interface RequesterInvocationCapability {
51
+ readonly holderDid: string;
52
+ readonly verificationMethod: string;
53
+ readonly jwk: object;
54
+ readonly invoke: InvokeFunction;
55
+ readonly invokeAny?: InvokeAnyFunction;
56
+ }
57
+ interface HolderKeyBindingPresentation {
58
+ readonly schema: typeof HOLDER_KEY_BINDING_PRESENTATION_SCHEMA;
59
+ readonly policyId: string;
60
+ readonly eligibleSubjectDid: string;
61
+ readonly holderDid: string;
62
+ readonly holderBinding: unknown;
63
+ readonly requestedCapabilities: readonly PolicyCapability[];
64
+ readonly requestedCapabilitiesHash: string;
65
+ readonly audience: string;
66
+ readonly nonce: string;
67
+ readonly expiresAt: string;
68
+ readonly evidence?: readonly unknown[];
69
+ readonly holderSignature: {
70
+ readonly suite: string;
71
+ readonly signerDid: string;
72
+ readonly value: string;
73
+ };
74
+ }
75
+ interface RequesterSigningCapability {
76
+ readonly holderDid: string;
77
+ readonly keyId: string;
78
+ readonly suite?: string;
79
+ readonly holderBinding?: unknown;
80
+ readonly eligibleSubjectDid?: string;
81
+ readonly evidence?: readonly unknown[];
82
+ signGrantPresentation?(input: {
83
+ readonly schema: typeof HOLDER_KEY_BINDING_PRESENTATION_SCHEMA;
84
+ readonly policyId: string;
85
+ readonly eligibleSubjectDid: string;
86
+ readonly holderDid: string;
87
+ readonly holderBinding: unknown;
88
+ readonly requestedCapabilities: readonly PolicyCapability[];
89
+ readonly requestedCapabilitiesHash: string;
90
+ readonly audience: string;
91
+ readonly nonce: string;
92
+ readonly expiresAt: string;
93
+ readonly evidence?: readonly unknown[];
94
+ }): Promise<string> | string;
95
+ signKeyBinding(input: {
96
+ readonly schema: typeof HOLDER_KEY_BINDING_PRESENTATION_SCHEMA;
97
+ readonly policyId?: string;
98
+ readonly eligibleSubjectDid?: string;
99
+ readonly holderDid: string;
100
+ readonly holderBinding?: unknown;
101
+ readonly requestedCapabilities?: readonly PolicyCapability[];
102
+ readonly requestedCapabilitiesHash?: string;
103
+ readonly audience: string;
104
+ readonly nonce: string;
105
+ readonly challengeId: string;
106
+ readonly issuedAt: string;
107
+ readonly keyId: string;
108
+ }): Promise<string> | string;
109
+ }
110
+ interface PortableDelegation {
111
+ readonly schema?: typeof PORTABLE_DELEGATION_SCHEMA;
112
+ readonly delegationId: string;
113
+ readonly policyId: string;
114
+ readonly issuerDid: string;
115
+ readonly holderDid: string;
116
+ readonly audience?: string;
117
+ readonly issuedAt: string;
118
+ readonly expiresAt: string;
119
+ readonly terminal: boolean;
120
+ readonly maxTtlSeconds: number;
121
+ readonly capabilities: readonly PolicyCapability[];
122
+ readonly encoded?: string;
123
+ }
124
+ interface TranscriptRequesterOptions {
125
+ readonly bootstrap: unknown;
126
+ readonly requesterDid: string;
127
+ readonly ownerDid: string;
128
+ readonly audience: string;
129
+ readonly grantIssuerDid: string;
130
+ /** Owner-node binding from trusted TinyCloud discovery/config, never copied from bootstrap. */
131
+ readonly trustedOwnerNode: {
132
+ readonly endpoint: string;
133
+ readonly spaceId: string;
134
+ };
135
+ readonly transport: RequesterTransport;
136
+ readonly signingCapability?: RequesterSigningCapability;
137
+ readonly invocationCapability?: RequesterInvocationCapability;
138
+ readonly eligibleSubjectDid?: string;
139
+ readonly holderBinding?: unknown;
140
+ readonly evidence?: readonly unknown[];
141
+ readonly presentationTtlSeconds?: number;
142
+ readonly now?: () => Date;
143
+ readonly sleep?: (milliseconds: number) => Promise<void>;
144
+ readonly random?: () => number;
145
+ readonly engineRetryAttempts?: number;
146
+ }
147
+ interface TranscriptRequesterReadSqlResult {
148
+ readonly rows: readonly unknown[];
149
+ }
150
+ interface TranscriptRequesterReadKvResult {
151
+ readonly value: unknown;
152
+ }
153
+ declare const LISTEN_SQL_STATEMENT_CATALOG: readonly [{
154
+ readonly name: "listen.getConversation";
155
+ readonly sql: "SELECT id, title, source, source_id, source_url, started_at, ended_at, duration_secs, summary, metadata, transcript_json, transcript_text, created_at, updated_at FROM conversation WHERE id = ?";
156
+ readonly fixedParams: readonly [{
157
+ readonly index: 0;
158
+ readonly value: "{conversationId}";
159
+ }];
160
+ }, {
161
+ readonly name: "listen.listParticipants";
162
+ readonly sql: "SELECT id, name, email, speaker_label FROM participant WHERE conversation_id = ? ORDER BY COALESCE(speaker_label, name), id";
163
+ readonly fixedParams: readonly [{
164
+ readonly index: 0;
165
+ readonly value: "{conversationId}";
166
+ }];
167
+ }];
168
+ type ListenSqlStatementName = (typeof LISTEN_SQL_STATEMENT_CATALOG)[number]["name"];
169
+ declare function listenTranscriptScopedStatementName(statementName: ListenSqlStatementName, conversationId: string): string;
170
+ declare class TranscriptRequester {
171
+ private readonly bootstrap;
172
+ private readonly requesterDid;
173
+ private readonly ownerDid;
174
+ private readonly audience;
175
+ private readonly grantIssuerDid;
176
+ private readonly transport;
177
+ private readonly signingCapability?;
178
+ private readonly invocationCapability?;
179
+ private readonly policyEngineRecordExpiresAtMs;
180
+ private readonly policyEngineAddresses;
181
+ private readonly ownerNodeAddresses;
182
+ private readonly now;
183
+ private readonly sleep;
184
+ private readonly random;
185
+ private readonly engineRetryAttempts;
186
+ private readonly requestedCapabilities;
187
+ private readonly nativeAuthorityCeiling;
188
+ private readonly requestedCapabilitiesHash;
189
+ private readonly eligibleSubjectDid;
190
+ private readonly holderBinding;
191
+ private readonly evidence?;
192
+ private readonly presentationTtlSeconds;
193
+ private readonly usedChallengeNonces;
194
+ private importedDelegation?;
195
+ private importedDelegationCid?;
196
+ private accessEnded;
197
+ private constructor();
198
+ static create(options: TranscriptRequesterOptions): Promise<TranscriptRequester>;
199
+ get accessState(): "active" | "needs-renewal" | "access-ended";
200
+ readSql(statementName: ListenSqlStatementName, conversationId?: string): Promise<TranscriptRequesterReadSqlResult>;
201
+ readKv(path: string): Promise<TranscriptRequesterReadKvResult>;
202
+ private nativeInvoke;
203
+ private ensureFreshDelegation;
204
+ private recordAccessEnded;
205
+ private obtainChallenge;
206
+ private mintPresentation;
207
+ private resolveOnce;
208
+ private importPortableDelegation;
209
+ private assertOwnerNodeResponse;
210
+ private assertPolicyEngineRecordCurrent;
211
+ private assertPolicyEngineResponse;
212
+ private assertEndpointResponse;
213
+ private assertContainedByDelegation;
214
+ private sqlAccessCapabilityForDelegation;
215
+ private requiresRenewal;
216
+ private challengeRequestWithRetry;
217
+ private resolveRequestOnce;
218
+ }
219
+ declare function createTranscriptRequester(options: TranscriptRequesterOptions): Promise<TranscriptRequester>;
220
+ /**
221
+ * Parse a frozen policy-engine delegation response and derive its authority
222
+ * exclusively from the signed compact-JWS payload. This performs no egress or
223
+ * node import and is suitable for constrained runners that cannot honestly
224
+ * satisfy the public-endpoint transport profile.
225
+ */
226
+ declare function parseNodeNativePortableDelegation(input: unknown): PortableDelegation;
227
+ declare function deriveDelegationCid(encoded: string): string;
228
+
229
+ export { HOLDER_KEY_BINDING_PRESENTATION_SCHEMA, type HolderKeyBindingPresentation, LISTEN_SQL_STATEMENT_CATALOG, type ListenSqlStatementName, POLICY_ENGINE_CHALLENGE_REQUEST_SCHEMA, POLICY_ENGINE_CHALLENGE_RESPONSE_SCHEMA, POLICY_ENGINE_DENIAL_SCHEMA, POLICY_ENGINE_GRANT_PRESENTATION_DENIAL_CODES, POLICY_ENGINE_RESOLVE_REQUEST_SCHEMA, PORTABLE_DELEGATION_SCHEMA, type PolicyEngineGrantPresentationDenialCode, type PortableDelegation, REQUESTER_ENGINE_RETRY_ATTEMPTS, REQUESTER_ENGINE_RETRY_MAX_DELAY_MS, REQUESTER_NEAR_EXPIRY_SECONDS, type RequesterEndpointResolution, type RequesterHttpRequest, type RequesterHttpResponse, type RequesterInvocationCapability, type RequesterSigningCapability, type RequesterTransport, TranscriptRequester, TranscriptRequesterError, type TranscriptRequesterErrorCode, type TranscriptRequesterErrorState, type TranscriptRequesterOptions, type TranscriptRequesterReadKvResult, type TranscriptRequesterReadSqlResult, createTranscriptRequester, deriveDelegationCid, listenTranscriptScopedStatementName, parseNodeNativePortableDelegation };
@@ -0,0 +1,229 @@
1
+ import { InvokeFunction, InvokeAnyFunction } from '@tinycloud/sdk-services';
2
+ import { P as PolicyCapability } from '../capability-DpdAwc1W.js';
3
+
4
+ declare const REQUESTER_NEAR_EXPIRY_SECONDS = 30;
5
+ declare const REQUESTER_ENGINE_RETRY_ATTEMPTS = 3;
6
+ declare const REQUESTER_ENGINE_RETRY_MAX_DELAY_MS = 250;
7
+ declare const POLICY_ENGINE_CHALLENGE_REQUEST_SCHEMA: "xyz.tinycloud.policy-engine/challenge-request/v0";
8
+ declare const POLICY_ENGINE_CHALLENGE_RESPONSE_SCHEMA: "xyz.tinycloud.policy/challenge/v0";
9
+ declare const POLICY_ENGINE_RESOLVE_REQUEST_SCHEMA: "xyz.tinycloud.policy/presentation/v0";
10
+ declare const POLICY_ENGINE_DENIAL_SCHEMA: "xyz.tinycloud.policy-engine/denial/v0";
11
+ declare const HOLDER_KEY_BINDING_PRESENTATION_SCHEMA: "xyz.tinycloud.policy/presentation/v0";
12
+ declare const PORTABLE_DELEGATION_SCHEMA: "xyz.tinycloud.policy/portable-delegation/v0";
13
+ declare const POLICY_ENGINE_GRANT_PRESENTATION_DENIAL_CODES: readonly ["schema-invalid", "challenge-not-found", "challenge-expired", "challenge-nonce-consumed", "presentation-expired", "presentation-audience-mismatch", "presentation-evidence-missing", "digest-mismatch", "evidence-requirement-unknown", "evidence-requirement-duplicate", "holder-signature-invalid", "holder-signature-signer-mismatch", "id-mismatch", "requested-capabilities-exceeded", "requested-capabilities-hash-mismatch", "evidence-authority-missing", "evidence-credential-invalid", "evidence-domain-invalid", "evidence-domain-missing", "evidence-freshness-expired", "evidence-freshness-unestablishable", "evidence-issuer-missing", "evidence-issuer-untrusted", "evidence-presentation-invalid", "evidence-requirements-invalid", "evidence-verifier-unsupported", "enrollment-binding-mismatch", "enrollment-expired", "enrollment-not-yet-valid", "enrollment-out-of-scope", "enrollment-revoked", "enrollment-revoked-irreversible", "enrollment-status-rollback", "signature-invalid", "signer-not-authorized", "audience-mismatch", "capability-not-contained", "evidence-invalid", "evidence-missing", "evidence-stale", "evidence-subject-mismatch", "evidence-untrusted", "grant-ttl-exceeds-policy", "holder-did-mismatch", "holder-key-not-permitted", "holder-signature-invalid", "owner-mismatch", "policy-expired", "policy-inactive", "policy-not-found", "policy-not-satisfied", "policy-revoked", "policy-status-rollback", "rate-limited"];
14
+ type PolicyEngineGrantPresentationDenialCode = (typeof POLICY_ENGINE_GRANT_PRESENTATION_DENIAL_CODES)[number];
15
+ type TranscriptRequesterErrorCode = "requester-bootstrap-malformed" | "requester-bootstrap-unknown-key" | "requester-engine-record-signature-invalid" | "requester-engine-record-owner-mismatch" | "requester-engine-record-audience-mismatch" | "requester-engine-record-endpoint-mismatch" | "requester-engine-record-invalid" | "requester-policy-engine-endpoint-invalid" | "requester-engine-unreachable" | "requester-engine-response-invalid" | "requester-renewal-required" | "requester-challenge-reused" | "requester-presentation-invalid" | "requester-delegation-invalid" | "requester-delegation-wrong-holder" | "requester-delegation-not-refresh-only" | "requester-delegation-ttl-excessive" | "requester-delegation-capability-wider" | "requester-owner-node-endpoint-invalid" | "requester-delegation-import-failed" | "requester-invocation-signer-required" | "requester-invocation-signer-mismatch" | "requester-node-denied" | "requester-node-unreachable" | "requester-node-response-invalid" | "requester-access-not-contained" | "requester-access-denied" | "requester-access-unreachable" | "requester-access-ended" | `policy-engine-denied-${PolicyEngineGrantPresentationDenialCode}`;
16
+ type TranscriptRequesterErrorState = "bootstrap-invalid" | "denied" | "unreachable" | "renewal-required" | "access-ended" | "invalid" | "not-contained";
17
+ declare class TranscriptRequesterError extends Error {
18
+ readonly code: TranscriptRequesterErrorCode;
19
+ readonly state: TranscriptRequesterErrorState;
20
+ readonly denialCode?: PolicyEngineGrantPresentationDenialCode;
21
+ readonly status?: number;
22
+ constructor(code: TranscriptRequesterErrorCode, message: string, state?: TranscriptRequesterErrorState, denialCode?: PolicyEngineGrantPresentationDenialCode, status?: number);
23
+ }
24
+ interface RequesterHttpRequest {
25
+ readonly method: "POST" | "GET";
26
+ readonly url: string;
27
+ readonly headers?: Readonly<Record<string, string>>;
28
+ readonly body?: unknown;
29
+ /** Endpoint requests must not follow redirects. */
30
+ readonly redirect?: "error";
31
+ /** Transport must connect only to one of these pre-resolved public addresses. */
32
+ readonly allowedResolvedAddresses?: readonly string[];
33
+ }
34
+ interface RequesterHttpResponse {
35
+ readonly status: number;
36
+ readonly body: unknown;
37
+ /** Required for policy-engine and owner-node requests; reports the non-redirected final URL. */
38
+ readonly finalUrl?: string;
39
+ /** Required for policy-engine and owner-node requests; reports the actual connected IP. */
40
+ readonly resolvedAddress?: string;
41
+ }
42
+ interface RequesterEndpointResolution {
43
+ readonly addresses: readonly string[];
44
+ }
45
+ interface RequesterTransport {
46
+ request(request: RequesterHttpRequest): Promise<RequesterHttpResponse>;
47
+ /** Resolve before egress so the requester can pin public addresses and detect rebinding. */
48
+ resolveEndpoint?(endpoint: string): Promise<RequesterEndpointResolution>;
49
+ }
50
+ interface RequesterInvocationCapability {
51
+ readonly holderDid: string;
52
+ readonly verificationMethod: string;
53
+ readonly jwk: object;
54
+ readonly invoke: InvokeFunction;
55
+ readonly invokeAny?: InvokeAnyFunction;
56
+ }
57
+ interface HolderKeyBindingPresentation {
58
+ readonly schema: typeof HOLDER_KEY_BINDING_PRESENTATION_SCHEMA;
59
+ readonly policyId: string;
60
+ readonly eligibleSubjectDid: string;
61
+ readonly holderDid: string;
62
+ readonly holderBinding: unknown;
63
+ readonly requestedCapabilities: readonly PolicyCapability[];
64
+ readonly requestedCapabilitiesHash: string;
65
+ readonly audience: string;
66
+ readonly nonce: string;
67
+ readonly expiresAt: string;
68
+ readonly evidence?: readonly unknown[];
69
+ readonly holderSignature: {
70
+ readonly suite: string;
71
+ readonly signerDid: string;
72
+ readonly value: string;
73
+ };
74
+ }
75
+ interface RequesterSigningCapability {
76
+ readonly holderDid: string;
77
+ readonly keyId: string;
78
+ readonly suite?: string;
79
+ readonly holderBinding?: unknown;
80
+ readonly eligibleSubjectDid?: string;
81
+ readonly evidence?: readonly unknown[];
82
+ signGrantPresentation?(input: {
83
+ readonly schema: typeof HOLDER_KEY_BINDING_PRESENTATION_SCHEMA;
84
+ readonly policyId: string;
85
+ readonly eligibleSubjectDid: string;
86
+ readonly holderDid: string;
87
+ readonly holderBinding: unknown;
88
+ readonly requestedCapabilities: readonly PolicyCapability[];
89
+ readonly requestedCapabilitiesHash: string;
90
+ readonly audience: string;
91
+ readonly nonce: string;
92
+ readonly expiresAt: string;
93
+ readonly evidence?: readonly unknown[];
94
+ }): Promise<string> | string;
95
+ signKeyBinding(input: {
96
+ readonly schema: typeof HOLDER_KEY_BINDING_PRESENTATION_SCHEMA;
97
+ readonly policyId?: string;
98
+ readonly eligibleSubjectDid?: string;
99
+ readonly holderDid: string;
100
+ readonly holderBinding?: unknown;
101
+ readonly requestedCapabilities?: readonly PolicyCapability[];
102
+ readonly requestedCapabilitiesHash?: string;
103
+ readonly audience: string;
104
+ readonly nonce: string;
105
+ readonly challengeId: string;
106
+ readonly issuedAt: string;
107
+ readonly keyId: string;
108
+ }): Promise<string> | string;
109
+ }
110
+ interface PortableDelegation {
111
+ readonly schema?: typeof PORTABLE_DELEGATION_SCHEMA;
112
+ readonly delegationId: string;
113
+ readonly policyId: string;
114
+ readonly issuerDid: string;
115
+ readonly holderDid: string;
116
+ readonly audience?: string;
117
+ readonly issuedAt: string;
118
+ readonly expiresAt: string;
119
+ readonly terminal: boolean;
120
+ readonly maxTtlSeconds: number;
121
+ readonly capabilities: readonly PolicyCapability[];
122
+ readonly encoded?: string;
123
+ }
124
+ interface TranscriptRequesterOptions {
125
+ readonly bootstrap: unknown;
126
+ readonly requesterDid: string;
127
+ readonly ownerDid: string;
128
+ readonly audience: string;
129
+ readonly grantIssuerDid: string;
130
+ /** Owner-node binding from trusted TinyCloud discovery/config, never copied from bootstrap. */
131
+ readonly trustedOwnerNode: {
132
+ readonly endpoint: string;
133
+ readonly spaceId: string;
134
+ };
135
+ readonly transport: RequesterTransport;
136
+ readonly signingCapability?: RequesterSigningCapability;
137
+ readonly invocationCapability?: RequesterInvocationCapability;
138
+ readonly eligibleSubjectDid?: string;
139
+ readonly holderBinding?: unknown;
140
+ readonly evidence?: readonly unknown[];
141
+ readonly presentationTtlSeconds?: number;
142
+ readonly now?: () => Date;
143
+ readonly sleep?: (milliseconds: number) => Promise<void>;
144
+ readonly random?: () => number;
145
+ readonly engineRetryAttempts?: number;
146
+ }
147
+ interface TranscriptRequesterReadSqlResult {
148
+ readonly rows: readonly unknown[];
149
+ }
150
+ interface TranscriptRequesterReadKvResult {
151
+ readonly value: unknown;
152
+ }
153
+ declare const LISTEN_SQL_STATEMENT_CATALOG: readonly [{
154
+ readonly name: "listen.getConversation";
155
+ readonly sql: "SELECT id, title, source, source_id, source_url, started_at, ended_at, duration_secs, summary, metadata, transcript_json, transcript_text, created_at, updated_at FROM conversation WHERE id = ?";
156
+ readonly fixedParams: readonly [{
157
+ readonly index: 0;
158
+ readonly value: "{conversationId}";
159
+ }];
160
+ }, {
161
+ readonly name: "listen.listParticipants";
162
+ readonly sql: "SELECT id, name, email, speaker_label FROM participant WHERE conversation_id = ? ORDER BY COALESCE(speaker_label, name), id";
163
+ readonly fixedParams: readonly [{
164
+ readonly index: 0;
165
+ readonly value: "{conversationId}";
166
+ }];
167
+ }];
168
+ type ListenSqlStatementName = (typeof LISTEN_SQL_STATEMENT_CATALOG)[number]["name"];
169
+ declare function listenTranscriptScopedStatementName(statementName: ListenSqlStatementName, conversationId: string): string;
170
+ declare class TranscriptRequester {
171
+ private readonly bootstrap;
172
+ private readonly requesterDid;
173
+ private readonly ownerDid;
174
+ private readonly audience;
175
+ private readonly grantIssuerDid;
176
+ private readonly transport;
177
+ private readonly signingCapability?;
178
+ private readonly invocationCapability?;
179
+ private readonly policyEngineRecordExpiresAtMs;
180
+ private readonly policyEngineAddresses;
181
+ private readonly ownerNodeAddresses;
182
+ private readonly now;
183
+ private readonly sleep;
184
+ private readonly random;
185
+ private readonly engineRetryAttempts;
186
+ private readonly requestedCapabilities;
187
+ private readonly nativeAuthorityCeiling;
188
+ private readonly requestedCapabilitiesHash;
189
+ private readonly eligibleSubjectDid;
190
+ private readonly holderBinding;
191
+ private readonly evidence?;
192
+ private readonly presentationTtlSeconds;
193
+ private readonly usedChallengeNonces;
194
+ private importedDelegation?;
195
+ private importedDelegationCid?;
196
+ private accessEnded;
197
+ private constructor();
198
+ static create(options: TranscriptRequesterOptions): Promise<TranscriptRequester>;
199
+ get accessState(): "active" | "needs-renewal" | "access-ended";
200
+ readSql(statementName: ListenSqlStatementName, conversationId?: string): Promise<TranscriptRequesterReadSqlResult>;
201
+ readKv(path: string): Promise<TranscriptRequesterReadKvResult>;
202
+ private nativeInvoke;
203
+ private ensureFreshDelegation;
204
+ private recordAccessEnded;
205
+ private obtainChallenge;
206
+ private mintPresentation;
207
+ private resolveOnce;
208
+ private importPortableDelegation;
209
+ private assertOwnerNodeResponse;
210
+ private assertPolicyEngineRecordCurrent;
211
+ private assertPolicyEngineResponse;
212
+ private assertEndpointResponse;
213
+ private assertContainedByDelegation;
214
+ private sqlAccessCapabilityForDelegation;
215
+ private requiresRenewal;
216
+ private challengeRequestWithRetry;
217
+ private resolveRequestOnce;
218
+ }
219
+ declare function createTranscriptRequester(options: TranscriptRequesterOptions): Promise<TranscriptRequester>;
220
+ /**
221
+ * Parse a frozen policy-engine delegation response and derive its authority
222
+ * exclusively from the signed compact-JWS payload. This performs no egress or
223
+ * node import and is suitable for constrained runners that cannot honestly
224
+ * satisfy the public-endpoint transport profile.
225
+ */
226
+ declare function parseNodeNativePortableDelegation(input: unknown): PortableDelegation;
227
+ declare function deriveDelegationCid(encoded: string): string;
228
+
229
+ export { HOLDER_KEY_BINDING_PRESENTATION_SCHEMA, type HolderKeyBindingPresentation, LISTEN_SQL_STATEMENT_CATALOG, type ListenSqlStatementName, POLICY_ENGINE_CHALLENGE_REQUEST_SCHEMA, POLICY_ENGINE_CHALLENGE_RESPONSE_SCHEMA, POLICY_ENGINE_DENIAL_SCHEMA, POLICY_ENGINE_GRANT_PRESENTATION_DENIAL_CODES, POLICY_ENGINE_RESOLVE_REQUEST_SCHEMA, PORTABLE_DELEGATION_SCHEMA, type PolicyEngineGrantPresentationDenialCode, type PortableDelegation, REQUESTER_ENGINE_RETRY_ATTEMPTS, REQUESTER_ENGINE_RETRY_MAX_DELAY_MS, REQUESTER_NEAR_EXPIRY_SECONDS, type RequesterEndpointResolution, type RequesterHttpRequest, type RequesterHttpResponse, type RequesterInvocationCapability, type RequesterSigningCapability, type RequesterTransport, TranscriptRequester, TranscriptRequesterError, type TranscriptRequesterErrorCode, type TranscriptRequesterErrorState, type TranscriptRequesterOptions, type TranscriptRequesterReadKvResult, type TranscriptRequesterReadSqlResult, createTranscriptRequester, deriveDelegationCid, listenTranscriptScopedStatementName, parseNodeNativePortableDelegation };