@opengeni/contracts 3.0.1 → 3.0.2-canary.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.
@@ -4,7 +4,7 @@ import {
4
4
  SessionTenancyVisibility,
5
5
  UserResourceAuthorityGrant,
6
6
  UserResourceDelegation
7
- } from "./chunk-EHHDZLGY.js";
7
+ } from "./chunk-FBXZZSXA.js";
8
8
 
9
9
  // src/connection-authority.ts
10
10
  import { z } from "zod";
@@ -345,4 +345,4 @@ export {
345
345
  ConnectionUseAuditFact,
346
346
  ConnectionUseAuthorizationResult
347
347
  };
348
- //# sourceMappingURL=chunk-IRR7CBBW.js.map
348
+ //# sourceMappingURL=chunk-FY5DZL7T.js.map
package/dist/connect.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  IntegrationInstanceKey,
3
3
  IntegrationSource
4
- } from "./chunk-EHHDZLGY.js";
4
+ } from "./chunk-FBXZZSXA.js";
5
5
  import "./chunk-YBW5JSA3.js";
6
6
  import "./chunk-O5LEQHDM.js";
7
7
  import "./chunk-GRG7PHWQ.js";
@@ -16,8 +16,8 @@ import {
16
16
  ListConnectionAuthoritiesQuery,
17
17
  ListConnectionAuthoritiesResponse,
18
18
  RevokeConnectionUseGrantQuery
19
- } from "./chunk-IRR7CBBW.js";
20
- import "./chunk-EHHDZLGY.js";
19
+ } from "./chunk-FY5DZL7T.js";
20
+ import "./chunk-FBXZZSXA.js";
21
21
  import "./chunk-YBW5JSA3.js";
22
22
  import "./chunk-O5LEQHDM.js";
23
23
  import "./chunk-GRG7PHWQ.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ConnectionMetadata
3
- } from "./chunk-EHHDZLGY.js";
3
+ } from "./chunk-FBXZZSXA.js";
4
4
  import "./chunk-YBW5JSA3.js";
5
5
  import "./chunk-O5LEQHDM.js";
6
6
  import "./chunk-GRG7PHWQ.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  ConnectionUseAuthoritySnapshot,
3
3
  IssueConnectionUseGrantRequest
4
- } from "./chunk-IRR7CBBW.js";
4
+ } from "./chunk-FY5DZL7T.js";
5
5
  import {
6
6
  HostMcpCreateSelections,
7
7
  McpServerConnectionRef,
8
8
  SessionTenancyVisibility
9
- } from "./chunk-EHHDZLGY.js";
9
+ } from "./chunk-FBXZZSXA.js";
10
10
  import "./chunk-YBW5JSA3.js";
11
11
  import "./chunk-O5LEQHDM.js";
12
12
  import "./chunk-GRG7PHWQ.js";
package/dist/index.d.ts CHANGED
@@ -37,7 +37,7 @@ export { CreateWorkspaceArtifactRequest, PublishWorkspaceArtifactVersionRequest,
37
37
  export { MCP_MUTATION_RECEIPT_MAX_BYTES, MCP_MUTATION_RECEIPT_VERSION, McpMutationReceipt, McpMutationReceiptIdempotencyStatus, McpMutationReceiptOutcome, McpMutationResource, type McpMutationReceipt as McpMutationReceiptType, type McpMutationReceiptIdempotencyStatus as McpMutationReceiptIdempotencyStatusType, type McpMutationReceiptOutcome as McpMutationReceiptOutcomeType, type McpMutationResource as McpMutationResourceType, } from "./mcp-receipts.js";
38
38
  export { SESSION_EVENT_PAYLOAD_MAX_BYTES, approximateSessionEventTokens, boundSessionEventPayload, measureSessionEventJson, sessionEventJsonBytes, sessionEventMediaPreview, sessionEventMediaPreviewFromDataUrl, sessionEventPayloadTruncation, type BoundSessionEventPayloadOptions, type SessionEventBoundarySurface, type SessionEventMediaPreview, type SessionEventJsonMeasurement, type SessionEventPayloadTruncation, } from "./event-preview.js";
39
39
  export { COMPUTER_SCREENSHOT_MAX_BYTES, COMPUTER_SCREENSHOT_MAX_DIMENSION, COMPUTER_SCREENSHOT_MAX_PIXELS, COMPUTER_SCREENSHOT_RETENTION_MS, COMPUTER_SCREENSHOT_WORKSPACE_QUOTA_BYTES, GENERATED_IMAGE_MAX_BYTES, GENERATED_VIDEO_MAX_BYTES, RETAINED_OUTPUT_DEFAULT_PAGE_BYTES, RETAINED_OUTPUT_MAX_PAGE_BYTES, RETAINED_OUTPUT_RECEIPT_MAX_BYTES, RetainedArtifactMetadataSchema, RetainedArtifactReferenceSchema, RetainedArtifactUnavailableSchema, RetainedOutputEvidenceSchema, RetainedOutputKind, RetainedOutputUnavailableReason, retainedArtifactReferenceFromFile, retainedGeneratedImageReferenceFromFile, retainedGeneratedVideoReferenceFromFile, retainedScreenshotReferenceFromFile, retainedOutputUnavailable, resolveRetainedOutputRange, validateRetainedOutputEvidence, type RetainedArtifactFileInput, type RetainedArtifactMetadata, type RetainedArtifactReference, type RetainedGeneratedImageArtifactInput, type RetainedGeneratedVideoArtifactInput, type RetainedScreenshotArtifactInput, type RetainedArtifactUnavailable, type RetainedOutputAvailableEvidence, type RetainedOutputEvidence, type RetainedOutputRangeResolution, type RetainedOutputResolvedRange, } from "./retained-output.js";
40
- export { NATIVE_SNAPSHOT_PREFIXES, WORKSPACE_ARCHIVE_DESCRIPTOR_VERSION, WORKSPACE_ARCHIVE_OBJECT_REF_SCHEMA, backendForNativeSnapshotProvider, decodeNativeSnapshotRef, encodeNativeSnapshotRef, omitInlineWorkspaceArchiveWhenObjectRefPresent, parseWorkspaceArchiveDescriptor, parseWorkspaceArchiveObjectRef, workspaceArchiveObjectKey, workspaceArchivePayloadPresent, type NativeSnapshotDescriptor, type NativeSnapshotProvider, type NativeSnapshotRef, type TarWorkspaceArchiveDescriptor, type WorkspaceArchiveDescriptor, type WorkspaceArchiveObjectRef, type WorkspaceTreeFingerprint, } from "./sandbox-snapshots.js";
40
+ export { NATIVE_SNAPSHOT_PREFIXES, WORKSPACE_ARCHIVE_DESCRIPTOR_VERSION, WORKSPACE_ARCHIVE_OBJECT_REF_SCHEMA, backendForNativeSnapshotProvider, decodeNativeSnapshotRef, encodeNativeSnapshotRef, omitInlineWorkspaceArchiveWhenObjectRefPresent, parseWorkspaceArchiveDescriptor, parseWorkspaceArchiveObjectKey, parseWorkspaceArchiveObjectRef, validateWorkspaceArchiveObjectRef, workspaceArchiveObjectKey, workspaceArchivePayloadPresent, type NativeSnapshotDescriptor, type NativeSnapshotProvider, type NativeSnapshotRef, type TarWorkspaceArchiveDescriptor, type WorkspaceArchiveDescriptor, type WorkspaceArchiveObjectRef, type WorkspaceArchiveObjectKey, type WorkspaceTreeFingerprint, } from "./sandbox-snapshots.js";
41
41
  export { canonicalModalCheckpointProviderBinding, type ModalCheckpointProviderBinding, } from "./checkpoint-provider-bindings.js";
42
42
  export declare const SandboxBackend: z.ZodEnum<{
43
43
  blaxel: "blaxel";
package/dist/index.js CHANGED
@@ -1798,6 +1798,7 @@ import {
1798
1798
  omitInlineWorkspaceArchiveWhenObjectRefPresent,
1799
1799
  parseSkillFrontmatter,
1800
1800
  parseWorkspaceArchiveDescriptor,
1801
+ parseWorkspaceArchiveObjectKey,
1801
1802
  parseWorkspaceArchiveObjectRef,
1802
1803
  prefixedMcpToolName,
1803
1804
  readCodexCredentialPolicySnapshotV1,
@@ -1851,6 +1852,7 @@ import {
1851
1852
  toolResultSpillSandboxPath,
1852
1853
  turnExecutionPolicyAuditMetadata,
1853
1854
  validateSkillTextFiles,
1855
+ validateWorkspaceArchiveObjectRef,
1854
1856
  variableSetVariableNameReservation,
1855
1857
  verifyDelegatedAccessToken,
1856
1858
  verifyEnrollToken,
@@ -1864,7 +1866,7 @@ import {
1864
1866
  workspaceLearningPolicyRouterContext,
1865
1867
  workspaceLearningSourceKey,
1866
1868
  workspaceSlackReactionChannelAllowed
1867
- } from "./chunk-EHHDZLGY.js";
1869
+ } from "./chunk-FBXZZSXA.js";
1868
1870
  import {
1869
1871
  CONNECTOR_ATTACHMENT_FILENAME_MAX_UTF8_BYTES,
1870
1872
  CONNECTOR_ATTACHMENT_MAX_BYTES,
@@ -4215,6 +4217,7 @@ export {
4215
4217
  parseConnectorAttachmentTransferEnvelope,
4216
4218
  parseSkillFrontmatter,
4217
4219
  parseWorkspaceArchiveDescriptor,
4220
+ parseWorkspaceArchiveObjectKey,
4218
4221
  parseWorkspaceArchiveObjectRef,
4219
4222
  prefixedMcpToolName,
4220
4223
  readCodexCredentialPolicySnapshotV1,
@@ -4279,6 +4282,7 @@ export {
4279
4282
  turnExecutionPolicyAuditMetadata,
4280
4283
  validateRetainedOutputEvidence,
4281
4284
  validateSkillTextFiles,
4285
+ validateWorkspaceArchiveObjectRef,
4282
4286
  variableSetVariableNameReservation,
4283
4287
  verifyDelegatedAccessToken,
4284
4288
  verifyEnrollToken,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ConnectionMetadata
3
- } from "./chunk-EHHDZLGY.js";
3
+ } from "./chunk-FBXZZSXA.js";
4
4
  import "./chunk-YBW5JSA3.js";
5
5
  import "./chunk-O5LEQHDM.js";
6
6
  import "./chunk-GRG7PHWQ.js";
@@ -50,13 +50,31 @@ export type WorkspaceArchiveObjectRef = {
50
50
  bytes: number;
51
51
  backend: string;
52
52
  };
53
+ export type WorkspaceArchiveObjectKey = {
54
+ accountId: string;
55
+ workspaceId: string;
56
+ sandboxGroupId: string;
57
+ revision: string;
58
+ uploadId: string | null;
59
+ };
60
+ export declare function parseWorkspaceArchiveObjectKey(value: unknown): WorkspaceArchiveObjectKey | null;
53
61
  export declare function parseWorkspaceArchiveObjectRef(value: unknown): WorkspaceArchiveObjectRef | null;
54
62
  export declare function workspaceArchiveObjectKey(input: {
55
63
  accountId: string;
56
64
  workspaceId: string;
57
65
  sandboxGroupId: string;
58
66
  revision: string;
67
+ /** New upload invocations supply a fresh randomUUID; omission is legacy-only. */
68
+ uploadId?: string;
59
69
  }): string;
70
+ /** Bind a stored locator to its publication/restore scope and verified tar
71
+ * descriptor. A logical revision never substitutes for the exact physical key. */
72
+ export declare function validateWorkspaceArchiveObjectRef(value: unknown, input: {
73
+ accountId: string;
74
+ workspaceId: string;
75
+ sandboxGroupId: string;
76
+ descriptor: WorkspaceArchiveDescriptor;
77
+ }): WorkspaceArchiveObjectRef | null;
60
78
  export declare function workspaceArchivePayloadPresent(sessionState: Record<string, unknown> | null | undefined): boolean;
61
79
  /** Restore may inline object bytes in memory for hydrate. That copy must never
62
80
  * be published onto a lease when a durable object-storage ref exists. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/contracts",
3
- "version": "3.0.1",
3
+ "version": "3.0.2-canary.0",
4
4
  "description": "Shared zod schemas and wire-contract types for the OpenGeni API.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
package/src/index.ts CHANGED
@@ -180,7 +180,9 @@ export {
180
180
  encodeNativeSnapshotRef,
181
181
  omitInlineWorkspaceArchiveWhenObjectRefPresent,
182
182
  parseWorkspaceArchiveDescriptor,
183
+ parseWorkspaceArchiveObjectKey,
183
184
  parseWorkspaceArchiveObjectRef,
185
+ validateWorkspaceArchiveObjectRef,
184
186
  workspaceArchiveObjectKey,
185
187
  workspaceArchivePayloadPresent,
186
188
  type NativeSnapshotDescriptor,
@@ -189,6 +191,7 @@ export {
189
191
  type TarWorkspaceArchiveDescriptor,
190
192
  type WorkspaceArchiveDescriptor,
191
193
  type WorkspaceArchiveObjectRef,
194
+ type WorkspaceArchiveObjectKey,
192
195
  type WorkspaceTreeFingerprint,
193
196
  } from "./sandbox-snapshots";
194
197
 
@@ -64,8 +64,35 @@ export type WorkspaceArchiveObjectRef = {
64
64
  backend: string;
65
65
  };
66
66
 
67
+ // Keep legacy scope/key spelling readable. New physical upload identities must
68
+ // be a complete RFC UUID (including version and variant), never arbitrary text.
69
+ const UPLOAD_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
67
70
  const OBJECT_KEY =
68
- /^sandbox-archives\/v1\/[0-9a-f-]{36}\/[0-9a-f-]{36}\/[0-9a-f-]{36}\/wa1:[0-9]{13}:[0-9a-f]{64}\.tar$/i;
71
+ /^sandbox-archives\/v1\/([0-9a-f-]{36})\/([0-9a-f-]{36})\/([0-9a-f-]{36})\/(wa1:[0-9]{13}:[0-9a-f]{64})(?:\.([0-9a-f-]+))?\.tar$/i;
72
+
73
+ export type WorkspaceArchiveObjectKey = {
74
+ accountId: string;
75
+ workspaceId: string;
76
+ sandboxGroupId: string;
77
+ revision: string;
78
+ uploadId: string | null;
79
+ };
80
+
81
+ export function parseWorkspaceArchiveObjectKey(value: unknown): WorkspaceArchiveObjectKey | null {
82
+ if (typeof value !== "string") return null;
83
+ const match = OBJECT_KEY.exec(value);
84
+ // JS $ may match before a final newline; a locator must match in full.
85
+ if (!match || match[0] !== value || (match[5] !== undefined && !UPLOAD_ID.test(match[5]))) {
86
+ return null;
87
+ }
88
+ return {
89
+ accountId: match[1]!,
90
+ workspaceId: match[2]!,
91
+ sandboxGroupId: match[3]!,
92
+ revision: match[4]!,
93
+ uploadId: match[5] ?? null,
94
+ };
95
+ }
69
96
 
70
97
  export function parseWorkspaceArchiveObjectRef(value: unknown): WorkspaceArchiveObjectRef | null {
71
98
  if (!value || typeof value !== "object" || Array.isArray(value)) return null;
@@ -73,7 +100,7 @@ export function parseWorkspaceArchiveObjectRef(value: unknown): WorkspaceArchive
73
100
  if (
74
101
  candidate.schema !== WORKSPACE_ARCHIVE_OBJECT_REF_SCHEMA ||
75
102
  typeof candidate.key !== "string" ||
76
- !OBJECT_KEY.test(candidate.key) ||
103
+ !parseWorkspaceArchiveObjectKey(candidate.key) ||
77
104
  typeof candidate.sha256 !== "string" ||
78
105
  !SHA256.test(candidate.sha256) ||
79
106
  !nonnegativeInteger(candidate.bytes) ||
@@ -98,8 +125,45 @@ export function workspaceArchiveObjectKey(input: {
98
125
  workspaceId: string;
99
126
  sandboxGroupId: string;
100
127
  revision: string;
128
+ /** New upload invocations supply a fresh randomUUID; omission is legacy-only. */
129
+ uploadId?: string;
101
130
  }): string {
102
- return `sandbox-archives/v1/${input.accountId}/${input.workspaceId}/${input.sandboxGroupId}/${input.revision}.tar`;
131
+ if (
132
+ input.uploadId !== undefined &&
133
+ (!UPLOAD_ID.test(input.uploadId) || input.uploadId.length !== 36)
134
+ ) {
135
+ throw new Error("Invalid workspace archive upload UUID");
136
+ }
137
+ return `sandbox-archives/v1/${input.accountId}/${input.workspaceId}/${input.sandboxGroupId}/${input.revision}${input.uploadId === undefined ? "" : `.${input.uploadId}`}.tar`;
138
+ }
139
+
140
+ /** Bind a stored locator to its publication/restore scope and verified tar
141
+ * descriptor. A logical revision never substitutes for the exact physical key. */
142
+ export function validateWorkspaceArchiveObjectRef(
143
+ value: unknown,
144
+ input: {
145
+ accountId: string;
146
+ workspaceId: string;
147
+ sandboxGroupId: string;
148
+ descriptor: WorkspaceArchiveDescriptor;
149
+ },
150
+ ): WorkspaceArchiveObjectRef | null {
151
+ const ref = parseWorkspaceArchiveObjectRef(value);
152
+ const key = ref && parseWorkspaceArchiveObjectKey(ref.key);
153
+ const descriptor = parseWorkspaceArchiveDescriptor(input.descriptor);
154
+ if (
155
+ !ref ||
156
+ !key ||
157
+ descriptor?.version !== 1 ||
158
+ key.accountId.toLowerCase() !== input.accountId.toLowerCase() ||
159
+ key.workspaceId.toLowerCase() !== input.workspaceId.toLowerCase() ||
160
+ key.sandboxGroupId.toLowerCase() !== input.sandboxGroupId.toLowerCase() ||
161
+ key.revision !== descriptor.revision ||
162
+ ref.sha256 !== descriptor.archiveSha256 ||
163
+ ref.bytes !== descriptor.archiveBytes
164
+ )
165
+ return null;
166
+ return ref;
103
167
  }
104
168
 
105
169
  export function workspaceArchivePayloadPresent(