@openchamber/sdk 2.1.0 → 2.1.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.
@@ -104,15 +104,31 @@ export declare const guestSessionWorktreeSchema: z.ZodUnion<readonly [z.ZodBoole
104
104
  export declare const guestStorageRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
105
105
  op: z.ZodLiteral<"get">;
106
106
  key: z.ZodString;
107
+ scope: z.ZodOptional<z.ZodEnum<{
108
+ instance: "instance";
109
+ device: "device";
110
+ }>>;
107
111
  }, z.core.$strict>, z.ZodObject<{
108
112
  op: z.ZodLiteral<"delete">;
109
113
  key: z.ZodString;
114
+ scope: z.ZodOptional<z.ZodEnum<{
115
+ instance: "instance";
116
+ device: "device";
117
+ }>>;
110
118
  }, z.core.$strict>, z.ZodObject<{
111
119
  op: z.ZodLiteral<"set">;
112
120
  key: z.ZodString;
113
121
  value: z.ZodJSONSchema;
122
+ scope: z.ZodOptional<z.ZodEnum<{
123
+ instance: "instance";
124
+ device: "device";
125
+ }>>;
114
126
  }, z.core.$strict>, z.ZodObject<{
115
127
  op: z.ZodLiteral<"keys">;
128
+ scope: z.ZodOptional<z.ZodEnum<{
129
+ instance: "instance";
130
+ device: "device";
131
+ }>>;
116
132
  }, z.core.$strict>], "op">;
117
133
  export declare const guestStorageResultSchema: z.ZodUnion<readonly [z.ZodObject<{
118
134
  storage: z.ZodLiteral<true>;
@@ -31,10 +31,10 @@ export const guestSessionWorktreeSchema = z.union([
31
31
  ]);
32
32
  const storageKey = z.string().min(1).max(GUEST_STORAGE_KEY_MAX);
33
33
  export const guestStorageRequestSchema = z.discriminatedUnion('op', [
34
- z.object({ op: z.literal('get'), key: storageKey }).strict(),
35
- z.object({ op: z.literal('delete'), key: storageKey }).strict(),
36
- z.object({ op: z.literal('set'), key: storageKey, value: z.json().refine((value) => new TextEncoder().encode(JSON.stringify(value)).length <= GUEST_STORAGE_VALUE_BYTES) }).strict(),
37
- z.object({ op: z.literal('keys') }).strict(),
34
+ z.object({ op: z.literal('get'), key: storageKey, scope: z.enum(['instance', 'device']).optional() }).strict(),
35
+ z.object({ op: z.literal('delete'), key: storageKey, scope: z.enum(['instance', 'device']).optional() }).strict(),
36
+ z.object({ op: z.literal('set'), key: storageKey, value: z.json().refine((value) => new TextEncoder().encode(JSON.stringify(value)).length <= GUEST_STORAGE_VALUE_BYTES), scope: z.enum(['instance', 'device']).optional() }).strict(),
37
+ z.object({ op: z.literal('keys'), scope: z.enum(['instance', 'device']).optional() }).strict(),
38
38
  ]);
39
39
  export const guestStorageResultSchema = z.union([
40
40
  z.object({ storage: z.literal(true), op: z.literal('get'), found: z.literal(false) }),
@@ -74,17 +74,23 @@ export type GuestWorkspaceUpdate = {
74
74
  export declare const GUEST_STORAGE_KEY_MAX = 128;
75
75
  export declare const GUEST_STORAGE_VALUE_BYTES = 65536;
76
76
  export declare const GUEST_STORAGE_TOTAL_BYTES = 2097152;
77
+ /** Maximum bytes retained across all device-scoped guest storage namespaces. */
78
+ export declare const GUEST_DEVICE_STORAGE_TOTAL_BYTES = 16777216;
77
79
  export declare const GUEST_STORAGE_KEYS_MAX = 2000;
78
- export type GuestStorageRequest = {
80
+ export type GuestStorageScope = 'instance' | 'device';
81
+ export type GuestStorageOptions = {
82
+ scope?: GuestStorageScope;
83
+ };
84
+ export type GuestStorageRequest = ({
79
85
  op: 'get' | 'delete';
80
86
  key: string;
81
- } | {
87
+ } & GuestStorageOptions) | ({
82
88
  op: 'set';
83
89
  key: string;
84
90
  value: JsonValue;
85
- } | {
91
+ } & GuestStorageOptions) | ({
86
92
  op: 'keys';
87
- };
93
+ } & GuestStorageOptions);
88
94
  export type GuestStorageResult = {
89
95
  storage: true;
90
96
  } & ({
package/dist/workspace.js CHANGED
@@ -1,4 +1,6 @@
1
1
  export const GUEST_STORAGE_KEY_MAX = 128;
2
2
  export const GUEST_STORAGE_VALUE_BYTES = 65_536;
3
3
  export const GUEST_STORAGE_TOTAL_BYTES = 2_097_152;
4
+ /** Maximum bytes retained across all device-scoped guest storage namespaces. */
5
+ export const GUEST_DEVICE_STORAGE_TOTAL_BYTES = 16_777_216;
4
6
  export const GUEST_STORAGE_KEYS_MAX = 2_000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openchamber/sdk",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Contract for OpenChamber guests: manifest parse and iframe host bridge.",
5
5
  "private": false,
6
6
  "license": "MIT",