@opengeni/contracts 0.22.0 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,205 @@
1
+ import { z } from "zod";
2
+ /** Hard server-side ceiling for one retained-output response body. */
3
+ export declare const RETAINED_OUTPUT_MAX_PAGE_BYTES: number;
4
+ /** Default first page when the client does not send a Range header. */
5
+ export declare const RETAINED_OUTPUT_DEFAULT_PAGE_BYTES: number;
6
+ /** Receipts are timeline references, never an extensible metadata bag. */
7
+ export declare const RETAINED_OUTPUT_RECEIPT_MAX_BYTES: number;
8
+ export declare const RetainedOutputKind: z.ZodEnum<{
9
+ assistant_completion: "assistant_completion";
10
+ event_media: "event_media";
11
+ file: "file";
12
+ internal_update: "internal_update";
13
+ tool_result: "tool_result";
14
+ }>;
15
+ export type RetainedOutputKind = z.infer<typeof RetainedOutputKind>;
16
+ export declare const RetainedOutputUnavailableReason: z.ZodEnum<{
17
+ deleted: "deleted";
18
+ expired: "expired";
19
+ failed: "failed";
20
+ missing_storage: "missing_storage";
21
+ not_retained: "not_retained";
22
+ pending: "pending";
23
+ storage_write_failed: "storage_write_failed";
24
+ unsupported: "unsupported";
25
+ }>;
26
+ export type RetainedOutputUnavailableReason = z.infer<typeof RetainedOutputUnavailableReason>;
27
+ export declare const RetainedArtifactReferenceSchema: z.ZodObject<{
28
+ available: z.ZodLiteral<true>;
29
+ artifactId: z.ZodString;
30
+ kind: z.ZodEnum<{
31
+ assistant_completion: "assistant_completion";
32
+ event_media: "event_media";
33
+ file: "file";
34
+ internal_update: "internal_update";
35
+ tool_result: "tool_result";
36
+ }>;
37
+ contentType: z.ZodString;
38
+ originalBytes: z.ZodNumber;
39
+ sha256: z.ZodString;
40
+ retainedAt: z.ZodString;
41
+ retention: z.ZodObject<{
42
+ policy: z.ZodLiteral<"workspace_file">;
43
+ expiresAt: z.ZodNull;
44
+ }, z.core.$strict>;
45
+ retrieval: z.ZodObject<{
46
+ method: z.ZodLiteral<"GET">;
47
+ path: z.ZodString;
48
+ acceptRanges: z.ZodLiteral<"bytes">;
49
+ maxRangeBytes: z.ZodNumber;
50
+ }, z.core.$strict>;
51
+ }, z.core.$strict>;
52
+ /**
53
+ * Canonical evidence fact carried by bounded audit/NATS/SSE/UI previews.
54
+ *
55
+ * The available variant is intentionally provider-neutral and closed: no bucket,
56
+ * object key, signed URL, arbitrary metadata, or producer-controlled labels can
57
+ * cross this boundary.
58
+ */
59
+ export declare const RetainedOutputEvidenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
60
+ available: z.ZodLiteral<false>;
61
+ reason: z.ZodEnum<{
62
+ deleted: "deleted";
63
+ expired: "expired";
64
+ failed: "failed";
65
+ missing_storage: "missing_storage";
66
+ not_retained: "not_retained";
67
+ pending: "pending";
68
+ storage_write_failed: "storage_write_failed";
69
+ unsupported: "unsupported";
70
+ }>;
71
+ }, z.core.$strict>, z.ZodObject<{
72
+ available: z.ZodLiteral<true>;
73
+ artifactId: z.ZodString;
74
+ kind: z.ZodEnum<{
75
+ assistant_completion: "assistant_completion";
76
+ event_media: "event_media";
77
+ file: "file";
78
+ internal_update: "internal_update";
79
+ tool_result: "tool_result";
80
+ }>;
81
+ contentType: z.ZodString;
82
+ originalBytes: z.ZodNumber;
83
+ sha256: z.ZodString;
84
+ retainedAt: z.ZodString;
85
+ retention: z.ZodObject<{
86
+ policy: z.ZodLiteral<"workspace_file">;
87
+ expiresAt: z.ZodNull;
88
+ }, z.core.$strict>;
89
+ retrieval: z.ZodObject<{
90
+ method: z.ZodLiteral<"GET">;
91
+ path: z.ZodString;
92
+ acceptRanges: z.ZodLiteral<"bytes">;
93
+ maxRangeBytes: z.ZodNumber;
94
+ }, z.core.$strict>;
95
+ }, z.core.$strict>], "available">;
96
+ export type RetainedOutputEvidence = z.infer<typeof RetainedOutputEvidenceSchema>;
97
+ export type RetainedArtifactReference = z.infer<typeof RetainedArtifactReferenceSchema>;
98
+ /** @deprecated use RetainedArtifactReference. */
99
+ export type RetainedOutputAvailableEvidence = RetainedArtifactReference;
100
+ export declare const RetainedArtifactUnavailableSchema: z.ZodObject<{
101
+ available: z.ZodLiteral<false>;
102
+ artifactId: z.ZodString;
103
+ reason: z.ZodEnum<{
104
+ deleted: "deleted";
105
+ expired: "expired";
106
+ failed: "failed";
107
+ missing_storage: "missing_storage";
108
+ not_retained: "not_retained";
109
+ pending: "pending";
110
+ storage_write_failed: "storage_write_failed";
111
+ unsupported: "unsupported";
112
+ }>;
113
+ }, z.core.$strict>;
114
+ export type RetainedArtifactUnavailable = z.infer<typeof RetainedArtifactUnavailableSchema>;
115
+ /** Authenticated metadata result for one opaque workspace file identity. */
116
+ export declare const RetainedArtifactMetadataSchema: z.ZodUnion<readonly [z.ZodObject<{
117
+ available: z.ZodLiteral<true>;
118
+ artifactId: z.ZodString;
119
+ kind: z.ZodEnum<{
120
+ assistant_completion: "assistant_completion";
121
+ event_media: "event_media";
122
+ file: "file";
123
+ internal_update: "internal_update";
124
+ tool_result: "tool_result";
125
+ }>;
126
+ contentType: z.ZodString;
127
+ originalBytes: z.ZodNumber;
128
+ sha256: z.ZodString;
129
+ retainedAt: z.ZodString;
130
+ retention: z.ZodObject<{
131
+ policy: z.ZodLiteral<"workspace_file">;
132
+ expiresAt: z.ZodNull;
133
+ }, z.core.$strict>;
134
+ retrieval: z.ZodObject<{
135
+ method: z.ZodLiteral<"GET">;
136
+ path: z.ZodString;
137
+ acceptRanges: z.ZodLiteral<"bytes">;
138
+ maxRangeBytes: z.ZodNumber;
139
+ }, z.core.$strict>;
140
+ }, z.core.$strict>, z.ZodObject<{
141
+ available: z.ZodLiteral<false>;
142
+ artifactId: z.ZodString;
143
+ reason: z.ZodEnum<{
144
+ deleted: "deleted";
145
+ expired: "expired";
146
+ failed: "failed";
147
+ missing_storage: "missing_storage";
148
+ not_retained: "not_retained";
149
+ pending: "pending";
150
+ storage_write_failed: "storage_write_failed";
151
+ unsupported: "unsupported";
152
+ }>;
153
+ }, z.core.$strict>]>;
154
+ export type RetainedArtifactMetadata = z.infer<typeof RetainedArtifactMetadataSchema>;
155
+ export type RetainedArtifactFileInput = {
156
+ id: string;
157
+ workspaceId: string;
158
+ status: string;
159
+ contentType: string;
160
+ sizeBytes: number;
161
+ sha256: string | null;
162
+ updatedAt: string;
163
+ };
164
+ /**
165
+ * Convert a ready, integrity-addressed workspace file into the only available
166
+ * retained-output receipt shape. Invalid, pending, or checksum-less files fail
167
+ * closed instead of implying that full evidence is retrievable.
168
+ */
169
+ export declare function retainedArtifactReferenceFromFile(file: RetainedArtifactFileInput, kind?: RetainedOutputKind): RetainedArtifactReference | null;
170
+ /** Parse and clone a trusted server receipt; invalid/untrusted data fails closed. */
171
+ export declare function validateRetainedOutputEvidence(value: unknown): RetainedOutputEvidence | null;
172
+ export declare function retainedOutputUnavailable(reason?: RetainedOutputUnavailableReason): RetainedOutputEvidence;
173
+ export type RetainedOutputResolvedRange = {
174
+ kind: "range";
175
+ start: number;
176
+ end: number;
177
+ length: number;
178
+ totalBytes: number;
179
+ status: 200 | 206;
180
+ contentRange: string | null;
181
+ acceptRanges: "bytes";
182
+ };
183
+ export type RetainedOutputRangeResolution = RetainedOutputResolvedRange | {
184
+ kind: "empty";
185
+ length: 0;
186
+ totalBytes: 0;
187
+ status: 200;
188
+ contentRange: null;
189
+ acceptRanges: "bytes";
190
+ } | {
191
+ kind: "invalid";
192
+ reason: "malformed" | "multipart_not_supported" | "numeric_overflow" | "range_too_large";
193
+ maxPageBytes: number;
194
+ } | {
195
+ kind: "unsatisfiable";
196
+ reason: "empty_artifact" | "start_out_of_bounds" | "end_before_start" | "zero_suffix";
197
+ totalBytes: number;
198
+ contentRange: string;
199
+ };
200
+ /**
201
+ * Resolve one RFC-style bytes range without ever licensing a response larger
202
+ * than `maxPageBytes`. Multipart ranges and oversized explicit/suffix requests
203
+ * fail closed. An omitted or open-ended range becomes one resumable bounded page.
204
+ */
205
+ export declare function resolveRetainedOutputRange(rangeHeader: string | null | undefined, totalBytes: number, maxPageBytes?: number): RetainedOutputRangeResolution;
@@ -0,0 +1,41 @@
1
+ export declare const WORKSPACE_ARCHIVE_DESCRIPTOR_VERSION: 2;
2
+ export type WorkspaceTreeFingerprint = {
3
+ algorithm: "sha256";
4
+ sha256: string;
5
+ entryCount: number;
6
+ fileCount: number;
7
+ totalFileBytes: number;
8
+ };
9
+ export type TarWorkspaceArchiveDescriptor = {
10
+ version: 1;
11
+ revision: string;
12
+ archiveSha256: string;
13
+ archiveBytes: number;
14
+ capturedAt: string;
15
+ workspace: WorkspaceTreeFingerprint;
16
+ };
17
+ export type NativeSnapshotProvider = "e2b" | "modal_snapshot_directory" | "modal_snapshot_filesystem" | "runloop" | "vercel";
18
+ export type NativeSnapshotRef = {
19
+ provider: NativeSnapshotProvider;
20
+ snapshotId: string;
21
+ workspacePersistence?: string;
22
+ };
23
+ export type NativeSnapshotDescriptor = {
24
+ version: typeof WORKSPACE_ARCHIVE_DESCRIPTOR_VERSION;
25
+ kind: "provider_snapshot";
26
+ revision: string;
27
+ archiveSha256: string;
28
+ archiveBytes: number;
29
+ capturedAt: string;
30
+ provider: NativeSnapshotProvider;
31
+ snapshotId: string;
32
+ workspacePersistence?: string;
33
+ };
34
+ export type WorkspaceArchiveDescriptor = TarWorkspaceArchiveDescriptor | NativeSnapshotDescriptor;
35
+ export declare const NATIVE_SNAPSHOT_PREFIXES: ReadonlyArray<{
36
+ provider: NativeSnapshotProvider;
37
+ prefix: string;
38
+ }>;
39
+ export declare function parseWorkspaceArchiveDescriptor(value: unknown): WorkspaceArchiveDescriptor | null;
40
+ export declare function decodeNativeSnapshotRef(bytes: Uint8Array): NativeSnapshotRef | null;
41
+ export declare function backendForNativeSnapshotProvider(provider: NativeSnapshotProvider): string;
@@ -0,0 +1,40 @@
1
+ export type SecretForRedaction = {
2
+ name: string;
3
+ value: string;
4
+ };
5
+ /**
6
+ * Returns true only for fields whose value is itself credential material.
7
+ * Container fields such as `headers` and URL fields are intentionally not
8
+ * included: their nested/value sanitizers retain useful names, hosts, paths,
9
+ * and non-sensitive query parameters.
10
+ */
11
+ export declare function isSensitiveFieldName(name: string): boolean;
12
+ /**
13
+ * Return true only for header names whose values are credential material.
14
+ * Ordinary protocol metadata (`content-type`, `accept`, `user-agent`, and
15
+ * pagination/signature headers outside this allowlist) must remain intact.
16
+ */
17
+ export declare function isCredentialHeaderName(name: string): boolean;
18
+ /**
19
+ * Redact only exact known-secret provenance from a structured object key.
20
+ * Generic field/header heuristics intentionally do not run here: a key is
21
+ * metadata unless the caller has proved that its bytes are secret material.
22
+ */
23
+ export declare function redactSensitiveKey(key: string, knownSecrets?: readonly SecretForRedaction[]): string;
24
+ /**
25
+ * Redact known secret provenance and common credential-bearing text shapes.
26
+ * This is deliberately a conservative safety boundary, not a promise of
27
+ * general-purpose DLP. It never includes a matched value in a marker or error.
28
+ */
29
+ export declare function redactSensitiveText(text: string, knownSecrets?: readonly SecretForRedaction[]): string;
30
+ /** Deeply redact plain structured data while retaining its diagnostic shape. */
31
+ export declare function redactSensitiveData<T>(value: T, knownSecrets?: readonly SecretForRedaction[]): T;
32
+ /** Build the worker-friendly single-argument redactor used at turn boundaries. */
33
+ export declare function createSecretRedactor(knownSecrets: readonly SecretForRedaction[]): (value: unknown) => unknown;
34
+ /**
35
+ * Redact a serialized JSON checkpoint without requiring it to be valid JSON.
36
+ * Valid JSON retains structure; malformed/opaque text still receives text
37
+ * classification and exact-known-value replacement.
38
+ */
39
+ export declare function redactSerializedJson(serialized: string, knownSecrets?: readonly SecretForRedaction[]): string;
40
+ export declare function identityRedactor<T>(value: T): T;
@@ -0,0 +1,16 @@
1
+ export declare const OPENGENI_SLACK_BOT_REQUIRED_SCOPES: readonly ["canvases:read", "channels:history", "channels:read", "chat:write", "files:read", "groups:history", "groups:read", "im:history", "im:read", "im:write", "mpim:history", "mpim:read", "users:read"];
2
+ /**
3
+ * Optional bot grants that remain inside the shipped bot's read/identity
4
+ * boundary. Every other unrequired scope fails closed, including unknown future
5
+ * Slack scopes, so verification, core routing, and UI eligibility cannot drift.
6
+ */
7
+ export declare const OPENGENI_SLACK_BOT_SAFE_OPTIONAL_SCOPES: readonly ["team:read"];
8
+ /** @deprecated Use evaluateOpenGeniSlackBotScopes; an allowlist is the policy. */
9
+ export declare const OPENGENI_SLACK_BOT_FORBIDDEN_SCOPES: readonly ["channels:join", "chat:write.public"];
10
+ export type OpenGeniSlackBotScopePolicy = {
11
+ accepted: boolean;
12
+ missingRequired: string[];
13
+ unsupported: string[];
14
+ };
15
+ export declare function areOpenGeniSlackBotScopesAccepted(grantedScopes: readonly string[]): boolean;
16
+ export declare function evaluateOpenGeniSlackBotScopes(grantedScopes: readonly string[]): OpenGeniSlackBotScopePolicy;
@@ -0,0 +1,15 @@
1
+ import {
2
+ OPENGENI_SLACK_BOT_FORBIDDEN_SCOPES,
3
+ OPENGENI_SLACK_BOT_REQUIRED_SCOPES,
4
+ OPENGENI_SLACK_BOT_SAFE_OPTIONAL_SCOPES,
5
+ areOpenGeniSlackBotScopesAccepted,
6
+ evaluateOpenGeniSlackBotScopes
7
+ } from "./chunk-3B3XEYMN.js";
8
+ export {
9
+ OPENGENI_SLACK_BOT_FORBIDDEN_SCOPES,
10
+ OPENGENI_SLACK_BOT_REQUIRED_SCOPES,
11
+ OPENGENI_SLACK_BOT_SAFE_OPTIONAL_SCOPES,
12
+ areOpenGeniSlackBotScopesAccepted,
13
+ evaluateOpenGeniSlackBotScopes
14
+ };
15
+ //# sourceMappingURL=slack-bot-scopes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}