@opengeni/contracts 3.2.2 → 3.4.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.
@@ -5681,12 +5681,282 @@ export declare const BrowserSessionMutationResponse: z.ZodObject<{
5681
5681
  dispatchedAt: z.ZodNullable<z.ZodString>;
5682
5682
  settledAt: z.ZodNullable<z.ZodString>;
5683
5683
  }, z.core.$strict>;
5684
+ initialView: z.ZodOptional<z.ZodObject<{
5685
+ targets: z.ZodArray<z.ZodObject<{
5686
+ id: z.ZodString;
5687
+ browserSessionId: z.ZodString;
5688
+ controllerGeneration: z.ZodString;
5689
+ targetGeneration: z.ZodString;
5690
+ documentGeneration: z.ZodNullable<z.ZodString>;
5691
+ kind: z.ZodEnum<{
5692
+ background_page: "background_page";
5693
+ page: "page";
5694
+ popup: "popup";
5695
+ worker: "worker";
5696
+ }>;
5697
+ title: z.ZodString;
5698
+ url: z.ZodString;
5699
+ selected: z.ZodBoolean;
5700
+ attached: z.ZodBoolean;
5701
+ createdAt: z.ZodString;
5702
+ }, z.core.$strict>>;
5703
+ observation: z.ZodObject<{
5704
+ protocolVersion: z.ZodLiteral<1>;
5705
+ observationId: z.ZodString;
5706
+ browserSessionId: z.ZodString;
5707
+ target: z.ZodObject<{
5708
+ id: z.ZodString;
5709
+ browserSessionId: z.ZodString;
5710
+ controllerGeneration: z.ZodString;
5711
+ targetGeneration: z.ZodString;
5712
+ documentGeneration: z.ZodNullable<z.ZodString>;
5713
+ kind: z.ZodEnum<{
5714
+ background_page: "background_page";
5715
+ page: "page";
5716
+ popup: "popup";
5717
+ worker: "worker";
5718
+ }>;
5719
+ title: z.ZodString;
5720
+ url: z.ZodString;
5721
+ selected: z.ZodBoolean;
5722
+ attached: z.ZodBoolean;
5723
+ createdAt: z.ZodString;
5724
+ }, z.core.$strict>;
5725
+ frameId: z.ZodNullable<z.ZodString>;
5726
+ semantic: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
5727
+ kind: z.ZodLiteral<"snapshot">;
5728
+ roots: z.ZodArray<z.ZodType<InteractionSemanticNodeValue, unknown, z.core.$ZodTypeInternals<InteractionSemanticNodeValue, unknown>>>;
5729
+ nodeCount: z.ZodNumber;
5730
+ }, z.core.$strict>, z.ZodObject<{
5731
+ kind: z.ZodLiteral<"diff">;
5732
+ baseObservationId: z.ZodString;
5733
+ removedRefs: z.ZodArray<z.ZodString>;
5734
+ changed: z.ZodArray<z.ZodType<InteractionSemanticNodeValue, unknown, z.core.$ZodTypeInternals<InteractionSemanticNodeValue, unknown>>>;
5735
+ }, z.core.$strict>]>>;
5736
+ screenshot: z.ZodNullable<z.ZodObject<{
5737
+ available: z.ZodLiteral<true>;
5738
+ artifactId: z.ZodString;
5739
+ kind: z.ZodEnum<{
5740
+ assistant_completion: "assistant_completion";
5741
+ browser_screenshot: "browser_screenshot";
5742
+ computer_screenshot: "computer_screenshot";
5743
+ event_media: "event_media";
5744
+ file: "file";
5745
+ generated_image: "generated_image";
5746
+ generated_video: "generated_video";
5747
+ internal_update: "internal_update";
5748
+ tool_result: "tool_result";
5749
+ }>;
5750
+ contentType: z.ZodString;
5751
+ originalBytes: z.ZodNumber;
5752
+ sha256: z.ZodString;
5753
+ retainedAt: z.ZodString;
5754
+ dimensions: z.ZodOptional<z.ZodObject<{
5755
+ width: z.ZodNumber;
5756
+ height: z.ZodNumber;
5757
+ }, z.core.$strict>>;
5758
+ retention: z.ZodUnion<readonly [z.ZodObject<{
5759
+ policy: z.ZodLiteral<"workspace_file">;
5760
+ expiresAt: z.ZodNull;
5761
+ }, z.core.$strict>, z.ZodObject<{
5762
+ policy: z.ZodLiteral<"session_screenshot">;
5763
+ expiresAt: z.ZodString;
5764
+ }, z.core.$strict>]>;
5765
+ retrieval: z.ZodObject<{
5766
+ method: z.ZodLiteral<"GET">;
5767
+ path: z.ZodString;
5768
+ acceptRanges: z.ZodLiteral<"bytes">;
5769
+ maxRangeBytes: z.ZodNumber;
5770
+ }, z.core.$strict>;
5771
+ }, z.core.$strict>>;
5772
+ viewport: z.ZodOptional<z.ZodNullable<z.ZodObject<{
5773
+ width: z.ZodNumber;
5774
+ height: z.ZodNumber;
5775
+ visualWidth: z.ZodNumber;
5776
+ visualHeight: z.ZodNumber;
5777
+ deviceScaleFactor: z.ZodNumber;
5778
+ maxTouchPoints: z.ZodNumber;
5779
+ }, z.core.$strict>>>;
5780
+ focusedRef: z.ZodNullable<z.ZodString>;
5781
+ changedRegions: z.ZodArray<z.ZodObject<{
5782
+ x: z.ZodNumber;
5783
+ y: z.ZodNumber;
5784
+ width: z.ZodNumber;
5785
+ height: z.ZodNumber;
5786
+ }, z.core.$strict>>;
5787
+ diagnostics: z.ZodObject<{
5788
+ consoleErrorCount: z.ZodNumber;
5789
+ failedRequestCount: z.ZodNumber;
5790
+ downloadCount: z.ZodNumber;
5791
+ pageErrorCount: z.ZodNumber;
5792
+ }, z.core.$strict>;
5793
+ dialog: z.ZodNullable<z.ZodObject<{
5794
+ type: z.ZodEnum<{
5795
+ alert: "alert";
5796
+ beforeunload: "beforeunload";
5797
+ confirm: "confirm";
5798
+ prompt: "prompt";
5799
+ }>;
5800
+ message: z.ZodString;
5801
+ defaultPrompt: z.ZodString;
5802
+ openedAt: z.ZodString;
5803
+ }, z.core.$strict>>;
5804
+ observedAt: z.ZodString;
5805
+ }, z.core.$strict>;
5806
+ }, z.core.$strict>>;
5684
5807
  }, z.core.$strict>;
5685
5808
  export type BrowserSessionMutationResponse = z.infer<typeof BrowserSessionMutationResponse>;
5686
5809
  export declare const BrowserSessionLifecycleRequest: z.ZodObject<{
5687
5810
  operationId: z.ZodString;
5688
5811
  }, z.core.$strict>;
5689
5812
  export type BrowserSessionLifecycleRequest = z.infer<typeof BrowserSessionLifecycleRequest>;
5813
+ /** Why a preserved working copy cannot be adopted as it is. */
5814
+ export declare const BrowserWorkingCopyRefusal: z.ZodEnum<{
5815
+ adoption_not_needed: "adoption_not_needed";
5816
+ adoption_unresolved: "adoption_unresolved";
5817
+ authority_changed: "authority_changed";
5818
+ browser_running: "browser_running";
5819
+ process_state_unknown: "process_state_unknown";
5820
+ receipt_not_adoptable: "receipt_not_adoptable";
5821
+ unsupported_browser: "unsupported_browser";
5822
+ unsupported_platform: "unsupported_platform";
5823
+ working_copy_invalid: "working_copy_invalid";
5824
+ }>;
5825
+ export type BrowserWorkingCopyRefusal = z.infer<typeof BrowserWorkingCopyRefusal>;
5826
+ /** One adoption of a copied working directory, as its controller recorded it.
5827
+ * `adopted` is the only phase in which the browser runs from the copy; the
5828
+ * other terminal phases left the browser's own directory untouched or
5829
+ * restored, and every directory kept is listed for separate cleanup. */
5830
+ export declare const BrowserWorkingCopyAdoption: z.ZodObject<{
5831
+ operationId: z.ZodString;
5832
+ browserSessionId: z.ZodString;
5833
+ controllerGeneration: z.ZodString;
5834
+ manifestDigest: z.ZodString;
5835
+ phase: z.ZodEnum<{
5836
+ adopted: "adopted";
5837
+ collision: "collision";
5838
+ copied: "copied";
5839
+ failed: "failed";
5840
+ intent: "intent";
5841
+ interrupted: "interrupted";
5842
+ receipt: "receipt";
5843
+ reverted: "reverted";
5844
+ reverting: "reverting";
5845
+ source_preserved: "source_preserved";
5846
+ }>;
5847
+ failureCode: z.ZodNullable<z.ZodString>;
5848
+ retainedDirectories: z.ZodArray<z.ZodString>;
5849
+ createdAt: z.ZodString;
5850
+ updatedAt: z.ZodString;
5851
+ }, z.core.$strict>;
5852
+ export type BrowserWorkingCopyAdoption = z.infer<typeof BrowserWorkingCopyAdoption>;
5853
+ /** Evidence about a browser's preserved working copy after its controller
5854
+ * lost it, for example after the machine's disk was restored from a copy.
5855
+ * Machine evidence (receipt, profile identity, process proof, exact byte
5856
+ * digest) is kept separate from freshness, which is never proven: whoever
5857
+ * adopts the copy selects it as the browser's state. */
5858
+ export declare const BrowserWorkingCopyInspection: z.ZodObject<{
5859
+ browserSessionId: z.ZodString;
5860
+ controllerGeneration: z.ZodString;
5861
+ adoptable: z.ZodBoolean;
5862
+ refusal: z.ZodNullable<z.ZodEnum<{
5863
+ adoption_not_needed: "adoption_not_needed";
5864
+ adoption_unresolved: "adoption_unresolved";
5865
+ authority_changed: "authority_changed";
5866
+ browser_running: "browser_running";
5867
+ process_state_unknown: "process_state_unknown";
5868
+ receipt_not_adoptable: "receipt_not_adoptable";
5869
+ unsupported_browser: "unsupported_browser";
5870
+ unsupported_platform: "unsupported_platform";
5871
+ working_copy_invalid: "working_copy_invalid";
5872
+ }>>;
5873
+ explanation: z.ZodString;
5874
+ manifest: z.ZodNullable<z.ZodObject<{
5875
+ digest: z.ZodString;
5876
+ entries: z.ZodNumber;
5877
+ bytes: z.ZodNumber;
5878
+ excluded: z.ZodArray<z.ZodString>;
5879
+ }, z.core.$strict>>;
5880
+ platformSupported: z.ZodBoolean;
5881
+ profileIdentityMatches: z.ZodBoolean;
5882
+ profileInUse: z.ZodNullable<z.ZodBoolean>;
5883
+ receipt: z.ZodNullable<z.ZodObject<{
5884
+ operationId: z.ZodString;
5885
+ intent: z.ZodEnum<{
5886
+ adopt: "adopt";
5887
+ launch: "launch";
5888
+ retire: "retire";
5889
+ suspend: "suspend";
5890
+ }>;
5891
+ state: z.ZodString;
5892
+ directoryLaunchAllowed: z.ZodBoolean;
5893
+ authorityMatches: z.ZodBoolean;
5894
+ launchedFromCheckpoint: z.ZodBoolean;
5895
+ adoption: z.ZodNullable<z.ZodObject<{
5896
+ operationId: z.ZodString;
5897
+ manifestDigest: z.ZodString;
5898
+ }, z.core.$strict>>;
5899
+ }, z.core.$strict>>;
5900
+ freshness: z.ZodObject<{
5901
+ status: z.ZodLiteral<"unknown">;
5902
+ latestCheckpointAt: z.ZodNullable<z.ZodString>;
5903
+ }, z.core.$strict>;
5904
+ activeAdoption: z.ZodNullable<z.ZodObject<{
5905
+ operationId: z.ZodString;
5906
+ browserSessionId: z.ZodString;
5907
+ controllerGeneration: z.ZodString;
5908
+ manifestDigest: z.ZodString;
5909
+ phase: z.ZodEnum<{
5910
+ adopted: "adopted";
5911
+ collision: "collision";
5912
+ copied: "copied";
5913
+ failed: "failed";
5914
+ intent: "intent";
5915
+ interrupted: "interrupted";
5916
+ receipt: "receipt";
5917
+ reverted: "reverted";
5918
+ reverting: "reverting";
5919
+ source_preserved: "source_preserved";
5920
+ }>;
5921
+ failureCode: z.ZodNullable<z.ZodString>;
5922
+ retainedDirectories: z.ZodArray<z.ZodString>;
5923
+ createdAt: z.ZodString;
5924
+ updatedAt: z.ZodString;
5925
+ }, z.core.$strict>>;
5926
+ }, z.core.$strict>;
5927
+ export type BrowserWorkingCopyInspection = z.infer<typeof BrowserWorkingCopyInspection>;
5928
+ export declare const BrowserWorkingCopyAdoptionRequest: z.ZodObject<{
5929
+ operationId: z.ZodString;
5930
+ manifestDigest: z.ZodString;
5931
+ }, z.core.$strict>;
5932
+ export type BrowserWorkingCopyAdoptionRequest = z.infer<typeof BrowserWorkingCopyAdoptionRequest>;
5933
+ export declare const BrowserWorkingCopyAdoptionResponse: z.ZodObject<{
5934
+ inFlight: z.ZodBoolean;
5935
+ adoption: z.ZodNullable<z.ZodObject<{
5936
+ operationId: z.ZodString;
5937
+ browserSessionId: z.ZodString;
5938
+ controllerGeneration: z.ZodString;
5939
+ manifestDigest: z.ZodString;
5940
+ phase: z.ZodEnum<{
5941
+ adopted: "adopted";
5942
+ collision: "collision";
5943
+ copied: "copied";
5944
+ failed: "failed";
5945
+ intent: "intent";
5946
+ interrupted: "interrupted";
5947
+ receipt: "receipt";
5948
+ reverted: "reverted";
5949
+ reverting: "reverting";
5950
+ source_preserved: "source_preserved";
5951
+ }>;
5952
+ failureCode: z.ZodNullable<z.ZodString>;
5953
+ retainedDirectories: z.ZodArray<z.ZodString>;
5954
+ createdAt: z.ZodString;
5955
+ updatedAt: z.ZodString;
5956
+ }, z.core.$strict>>;
5957
+ explanation: z.ZodString;
5958
+ }, z.core.$strict>;
5959
+ export type BrowserWorkingCopyAdoptionResponse = z.infer<typeof BrowserWorkingCopyAdoptionResponse>;
5690
5960
  export declare const BrowserOpenTargetRequest: z.ZodObject<{
5691
5961
  url: z.ZodOptional<z.ZodString>;
5692
5962
  }, z.core.$strict>;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ConnectionMetadata
3
- } from "./chunk-B2G6NXLZ.js";
3
+ } from "./chunk-J6VQQPIL.js";
4
4
  import "./chunk-EFZYKUE2.js";
5
5
  import "./chunk-Z7WEVGCL.js";
6
6
  import "./chunk-LZ2LAHIX.js";
@@ -0,0 +1,35 @@
1
+ import { z } from "zod";
2
+ /** Operator-managed catalog; monetary amounts are USD micro-units. */
3
+ export declare const SubscriptionPlan: z.ZodObject<{
4
+ key: z.ZodString;
5
+ label: z.ZodString;
6
+ stripePriceId: z.ZodNullable<z.ZodString>;
7
+ monthlyPriceMicros: z.ZodNullable<z.ZodNumber>;
8
+ monthlyCreditMicros: z.ZodNumber;
9
+ seatLimit: z.ZodNullable<z.ZodNumber>;
10
+ freeCredit: z.ZodBoolean;
11
+ }, z.core.$strict>;
12
+ export type SubscriptionPlan = z.infer<typeof SubscriptionPlan>;
13
+ export declare const SubscriptionPlanCatalog: z.ZodArray<z.ZodObject<{
14
+ key: z.ZodString;
15
+ label: z.ZodString;
16
+ stripePriceId: z.ZodNullable<z.ZodString>;
17
+ monthlyPriceMicros: z.ZodNullable<z.ZodNumber>;
18
+ monthlyCreditMicros: z.ZodNumber;
19
+ seatLimit: z.ZodNullable<z.ZodNumber>;
20
+ freeCredit: z.ZodBoolean;
21
+ }, z.core.$strict>>;
22
+ export type SubscriptionPlanCatalog = z.infer<typeof SubscriptionPlanCatalog>;
23
+ export declare const BillingPlanBalance: z.ZodObject<{
24
+ key: z.ZodString;
25
+ label: z.ZodString;
26
+ status: z.ZodString;
27
+ creditGrantedMicros: z.ZodNumber;
28
+ creditRemainingMicros: z.ZodNumber;
29
+ creditPendingExpiryMicros: z.ZodOptional<z.ZodNumber>;
30
+ periodResetAt: z.ZodNullable<z.ZodString>;
31
+ seatLimit: z.ZodNullable<z.ZodNumber>;
32
+ seatsUsed: z.ZodNumber;
33
+ cancelAtPeriodEnd: z.ZodBoolean;
34
+ }, z.core.$strip>;
35
+ export type BillingPlanBalance = z.infer<typeof BillingPlanBalance>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/contracts",
3
- "version": "3.2.2",
3
+ "version": "3.4.0",
4
4
  "description": "Shared zod schemas and wire-contract types for the Opengeni API.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -0,0 +1,47 @@
1
+ import { z } from "zod";
2
+ import { BillingPlanBalance, SubscriptionPlan } from "./subscription-plans";
3
+
4
+ export const BillingSubscriptionCatalog = z.object({
5
+ accountId: z.string().uuid(),
6
+ revision: z.number().int().positive(),
7
+ plans: z.array(SubscriptionPlan.extend({ selfService: z.boolean() })),
8
+ plan: BillingPlanBalance.nullable(),
9
+ });
10
+ export type BillingSubscriptionCatalog = z.infer<typeof BillingSubscriptionCatalog>;
11
+
12
+ export const CreateSubscriptionCheckoutRequest = z.strictObject({
13
+ accountId: z.string().uuid().optional(),
14
+ planKey: z.string().min(1).max(40),
15
+ /** Stable across retries of the same action; use a fresh UUID for a new action. */
16
+ idempotencyKey: z.string().uuid(),
17
+ successUrl: z.string().url().optional(),
18
+ cancelUrl: z.string().url().optional(),
19
+ });
20
+ export type CreateSubscriptionCheckoutRequest = z.infer<typeof CreateSubscriptionCheckoutRequest>;
21
+
22
+ export const CreateSubscriptionCheckoutResponse = z.object({
23
+ checkoutSessionId: z.string(),
24
+ url: z.string().url(),
25
+ });
26
+ export type CreateSubscriptionCheckoutResponse = z.infer<typeof CreateSubscriptionCheckoutResponse>;
27
+
28
+ export const ChangeBillingSubscriptionRequest = z.strictObject({
29
+ accountId: z.string().uuid().optional(),
30
+ planKey: z.string().min(1).max(40),
31
+ idempotencyKey: z.string().uuid(),
32
+ });
33
+ export type ChangeBillingSubscriptionRequest = z.infer<typeof ChangeBillingSubscriptionRequest>;
34
+
35
+ export const CancelBillingSubscriptionRequest = z.strictObject({
36
+ accountId: z.string().uuid().optional(),
37
+ idempotencyKey: z.string().uuid(),
38
+ });
39
+ export type CancelBillingSubscriptionRequest = z.infer<typeof CancelBillingSubscriptionRequest>;
40
+
41
+ export const BillingSubscriptionChange = z.object({
42
+ subscriptionId: z.string(),
43
+ planKey: z.string(),
44
+ effectiveAt: z.string().datetime(),
45
+ cancelAtPeriodEnd: z.boolean(),
46
+ });
47
+ export type BillingSubscriptionChange = z.infer<typeof BillingSubscriptionChange>;
package/src/index.ts CHANGED
@@ -5864,6 +5864,21 @@ export const PromotionalCreditBalance = /* @__PURE__ */ defineSchema(() =>
5864
5864
  );
5865
5865
  export type PromotionalCreditBalance = z.infer<typeof PromotionalCreditBalance>;
5866
5866
 
5867
+ export {
5868
+ SubscriptionPlan,
5869
+ SubscriptionPlanCatalog,
5870
+ BillingPlanBalance,
5871
+ } from "./subscription-plans";
5872
+ export {
5873
+ BillingSubscriptionCatalog,
5874
+ CreateSubscriptionCheckoutRequest,
5875
+ CreateSubscriptionCheckoutResponse,
5876
+ ChangeBillingSubscriptionRequest,
5877
+ CancelBillingSubscriptionRequest,
5878
+ BillingSubscriptionChange,
5879
+ } from "./billing-subscriptions";
5880
+ import { BillingPlanBalance } from "./subscription-plans";
5881
+
5867
5882
  export const BillingBalance = /* @__PURE__ */ defineSchema(() =>
5868
5883
  z.object({
5869
5884
  accountId: z.string().uuid(),
@@ -5873,6 +5888,8 @@ export const BillingBalance = /* @__PURE__ */ defineSchema(() =>
5873
5888
  /** General credits, including unrestricted legacy grants. May be negative after use. */
5874
5889
  generalBalanceMicros: z.number().int().optional(),
5875
5890
  promotionalCredits: z.array(PromotionalCreditBalance).optional(),
5891
+ /** Absent/null until an operator or subscription worker activates this organization. */
5892
+ plan: BillingPlanBalance.nullable().optional(),
5876
5893
  }),
5877
5894
  );
5878
5895
  export type BillingBalance = z.infer<typeof BillingBalance>;
@@ -15798,6 +15815,8 @@ export const SessionListResponse = /* @__PURE__ */ defineSkillContractSchema(()
15798
15815
  needsYouOnly: z.literal(true).optional(),
15799
15816
  /** Explicit receipt for the read-only (archived idle session) filter. */
15800
15817
  contentArchivedOnly: z.literal(true).optional(),
15818
+ /** Explicit receipt for the started-or-messaged-by-you filter. */
15819
+ mineOnly: z.literal(true).optional(),
15801
15820
  totals: SessionListTotals.optional(),
15802
15821
  /** Effective server ordering; name uses ASCII-space trim, ASCII case fold,
15803
15822
  * UTF-8 byte order, then id ASC. Date keys and their id ties use DESC. */
@@ -15,6 +15,44 @@ export const InsightsUsageRange = /* @__PURE__ */ defineSchema(() =>
15
15
  );
16
16
  export type InsightsUsageRange = z.infer<typeof InsightsUsageRange>;
17
17
 
18
+ /** Aggregate Site accounting only: no viewer, session, turn or prompt identities. */
19
+ export const InsightsSiteUsageQuery = /* @__PURE__ */ defineSchema(() =>
20
+ z
21
+ .object({ range: z.enum(["today", "week", "month", "30d", "90d", "ytd"]).default("month") })
22
+ .strict(),
23
+ );
24
+ export type InsightsSiteUsageQuery = z.infer<typeof InsightsSiteUsageQuery>;
25
+ export const InsightsSiteUsageRow = /* @__PURE__ */ defineSchema(() =>
26
+ z
27
+ .object({
28
+ siteId: Identifier.nullable(),
29
+ title: z.string(),
30
+ kind: z.enum(["site", "restricted", "other"]),
31
+ calls: SafeCount,
32
+ pricedCalls: SafeCount,
33
+ /** Settled negative model-usage ledger entries, not a provider price. */
34
+ chargedMicros: SafeCount,
35
+ /** Recorded API-equivalent estimates across all payment paths. */
36
+ apiEquivalentMicros: SafeCount,
37
+ subscriptionApiEquivalentMicros: SafeCount,
38
+ ownKeyApiEquivalentMicros: SafeCount,
39
+ })
40
+ .strict(),
41
+ );
42
+ export type InsightsSiteUsageRow = z.infer<typeof InsightsSiteUsageRow>;
43
+ export const InsightsSiteUsageResponse = /* @__PURE__ */ defineSchema(() =>
44
+ z
45
+ .object({
46
+ workspaceId: Identifier,
47
+ range: InsightsSiteUsageQuery.shape.range,
48
+ windowStart: UtcDateTime,
49
+ windowEnd: UtcDateTime,
50
+ rows: z.array(InsightsSiteUsageRow).max(201),
51
+ })
52
+ .strict(),
53
+ );
54
+ export type InsightsSiteUsageResponse = z.infer<typeof InsightsSiteUsageResponse>;
55
+
18
56
  export const InsightsUsageGroupBy = /* @__PURE__ */ defineSchema(() =>
19
57
  z.enum([
20
58
  "model",
@@ -2806,6 +2806,17 @@ export const BrowserSessionMutationResponse = /* @__PURE__ */ defineSchema(() =>
2806
2806
  .object({
2807
2807
  session: BrowserSession,
2808
2808
  operation: InteractionLifecycleOperationReceipt,
2809
+ /** Set only by a create that launched the browser in this request: the
2810
+ * tabs and the opened tab's observation exactly as the controller
2811
+ * produced them, so a caller does not need two more reads. A replayed
2812
+ * or failed create omits it; read the targets and observe instead. */
2813
+ initialView: z
2814
+ .object({
2815
+ targets: z.array(BrowserTarget).max(10_000),
2816
+ observation: BrowserObservation,
2817
+ })
2818
+ .strict()
2819
+ .optional(),
2809
2820
  })
2810
2821
  .strict(),
2811
2822
  );
@@ -2820,6 +2831,137 @@ export const BrowserSessionLifecycleRequest = /* @__PURE__ */ defineSchema(() =>
2820
2831
  );
2821
2832
  export type BrowserSessionLifecycleRequest = z.infer<typeof BrowserSessionLifecycleRequest>;
2822
2833
 
2834
+ /** Why a preserved working copy cannot be adopted as it is. */
2835
+ export const BrowserWorkingCopyRefusal = /* @__PURE__ */ defineSchema(() =>
2836
+ z.enum([
2837
+ "unsupported_platform",
2838
+ "unsupported_browser",
2839
+ "browser_running",
2840
+ "working_copy_invalid",
2841
+ "receipt_not_adoptable",
2842
+ "authority_changed",
2843
+ "process_state_unknown",
2844
+ "adoption_not_needed",
2845
+ "adoption_unresolved",
2846
+ ]),
2847
+ );
2848
+ export type BrowserWorkingCopyRefusal = z.infer<typeof BrowserWorkingCopyRefusal>;
2849
+
2850
+ /** One adoption of a copied working directory, as its controller recorded it.
2851
+ * `adopted` is the only phase in which the browser runs from the copy; the
2852
+ * other terminal phases left the browser's own directory untouched or
2853
+ * restored, and every directory kept is listed for separate cleanup. */
2854
+ export const BrowserWorkingCopyAdoption = /* @__PURE__ */ defineSchema(() =>
2855
+ z
2856
+ .object({
2857
+ operationId: z.string().uuid(),
2858
+ browserSessionId: z.string().uuid(),
2859
+ controllerGeneration: opaqueGeneration,
2860
+ manifestDigest: sha256Hex,
2861
+ phase: z.enum([
2862
+ "intent",
2863
+ "copied",
2864
+ "receipt",
2865
+ "source_preserved",
2866
+ "adopted",
2867
+ "interrupted",
2868
+ "failed",
2869
+ "collision",
2870
+ "reverting",
2871
+ "reverted",
2872
+ ]),
2873
+ failureCode: z.string().min(1).max(64).nullable(),
2874
+ retainedDirectories: z.array(z.string().min(1).max(256)).max(64),
2875
+ createdAt: z.string().datetime({ offset: true }),
2876
+ updatedAt: z.string().datetime({ offset: true }),
2877
+ })
2878
+ .strict(),
2879
+ );
2880
+ export type BrowserWorkingCopyAdoption = z.infer<typeof BrowserWorkingCopyAdoption>;
2881
+
2882
+ /** Evidence about a browser's preserved working copy after its controller
2883
+ * lost it, for example after the machine's disk was restored from a copy.
2884
+ * Machine evidence (receipt, profile identity, process proof, exact byte
2885
+ * digest) is kept separate from freshness, which is never proven: whoever
2886
+ * adopts the copy selects it as the browser's state. */
2887
+ export const BrowserWorkingCopyInspection = /* @__PURE__ */ defineSchema(() =>
2888
+ z
2889
+ .object({
2890
+ browserSessionId: z.string().uuid(),
2891
+ controllerGeneration: opaqueGeneration,
2892
+ adoptable: z.boolean(),
2893
+ refusal: BrowserWorkingCopyRefusal.nullable(),
2894
+ /** Plain explanation of the state and the next action. */
2895
+ explanation: z.string().min(1).max(2_048),
2896
+ /** Exact digest of the bytes an adoption would take; pass it to adopt. */
2897
+ manifest: z
2898
+ .object({
2899
+ digest: sha256Hex,
2900
+ entries: z.number().int().nonnegative(),
2901
+ bytes: z.number().int().nonnegative(),
2902
+ /** Controller-owned derived entries left out of the copy (journal
2903
+ * shared-memory indexes and the per-launch launcher folder). */
2904
+ excluded: z.array(z.string().min(1).max(256)).max(16),
2905
+ })
2906
+ .strict()
2907
+ .nullable(),
2908
+ platformSupported: z.boolean(),
2909
+ profileIdentityMatches: z.boolean(),
2910
+ profileInUse: z.boolean().nullable(),
2911
+ receipt: z
2912
+ .object({
2913
+ operationId: z.string().uuid(),
2914
+ intent: z.enum(["launch", "suspend", "retire", "adopt"]),
2915
+ state: z.string().min(1).max(64),
2916
+ directoryLaunchAllowed: z.boolean(),
2917
+ authorityMatches: z.boolean(),
2918
+ launchedFromCheckpoint: z.boolean(),
2919
+ adoption: z
2920
+ .object({ operationId: z.string().uuid(), manifestDigest: sha256Hex })
2921
+ .strict()
2922
+ .nullable(),
2923
+ })
2924
+ .strict()
2925
+ .nullable(),
2926
+ freshness: z
2927
+ .object({
2928
+ /** How recent the copy's contents are is not machine-proven. */
2929
+ status: z.literal("unknown"),
2930
+ /** When the browser's latest saved checkpoint was taken, if any. */
2931
+ latestCheckpointAt: z.string().datetime({ offset: true }).nullable(),
2932
+ })
2933
+ .strict(),
2934
+ activeAdoption: BrowserWorkingCopyAdoption.nullable(),
2935
+ })
2936
+ .strict(),
2937
+ );
2938
+ export type BrowserWorkingCopyInspection = z.infer<typeof BrowserWorkingCopyInspection>;
2939
+
2940
+ export const BrowserWorkingCopyAdoptionRequest = /* @__PURE__ */ defineSchema(() =>
2941
+ z
2942
+ .object({
2943
+ operationId: z.string().uuid(),
2944
+ /** The manifest digest from an inspection of the exact bytes to adopt. */
2945
+ manifestDigest: sha256Hex,
2946
+ })
2947
+ .strict(),
2948
+ );
2949
+ export type BrowserWorkingCopyAdoptionRequest = z.infer<typeof BrowserWorkingCopyAdoptionRequest>;
2950
+
2951
+ export const BrowserWorkingCopyAdoptionResponse = /* @__PURE__ */ defineSchema(() =>
2952
+ z
2953
+ .object({
2954
+ /** True while the controller is still running this adoption. */
2955
+ inFlight: z.boolean(),
2956
+ /** Null when the controller has no record of the operation, which
2957
+ * proves it changed nothing there. */
2958
+ adoption: BrowserWorkingCopyAdoption.nullable(),
2959
+ explanation: z.string().min(1).max(2_048),
2960
+ })
2961
+ .strict(),
2962
+ );
2963
+ export type BrowserWorkingCopyAdoptionResponse = z.infer<typeof BrowserWorkingCopyAdoptionResponse>;
2964
+
2823
2965
  export const BrowserOpenTargetRequest = /* @__PURE__ */ defineSchema(() =>
2824
2966
  z
2825
2967
  .object({
@@ -0,0 +1,43 @@
1
+ import { z } from "zod";
2
+
3
+ /** Operator-managed catalog; monetary amounts are USD micro-units. */
4
+ export const SubscriptionPlan = z.strictObject({
5
+ key: z.string().regex(/^[a-z][a-z0-9_-]{0,39}$/),
6
+ label: z.string().trim().min(1).max(120),
7
+ stripePriceId: z.string().trim().min(1).max(200).nullable(),
8
+ monthlyPriceMicros: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).nullable(),
9
+ monthlyCreditMicros: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
10
+ seatLimit: z.number().int().positive().max(1_000_000).nullable(),
11
+ freeCredit: z.boolean(),
12
+ });
13
+ export type SubscriptionPlan = z.infer<typeof SubscriptionPlan>;
14
+
15
+ export const SubscriptionPlanCatalog = z
16
+ .array(SubscriptionPlan)
17
+ .min(1)
18
+ .max(100)
19
+ .superRefine((plans, context) => {
20
+ if (new Set(plans.map((plan) => plan.key)).size !== plans.length) {
21
+ context.addIssue({ code: "custom", message: "Plan keys must be unique" });
22
+ }
23
+ const prices = plans.flatMap((plan) => (plan.stripePriceId ? [plan.stripePriceId] : []));
24
+ if (new Set(prices).size !== prices.length) {
25
+ context.addIssue({ code: "custom", message: "Stripe price IDs must be unique" });
26
+ }
27
+ });
28
+ export type SubscriptionPlanCatalog = z.infer<typeof SubscriptionPlanCatalog>;
29
+
30
+ export const BillingPlanBalance = z.object({
31
+ key: z.string(),
32
+ label: z.string(),
33
+ status: z.string(),
34
+ creditGrantedMicros: z.number().int().nonnegative(),
35
+ creditRemainingMicros: z.number().int().nonnegative(),
36
+ /** Already unavailable, but not yet removed from the physical ledger. */
37
+ creditPendingExpiryMicros: z.number().int().nonnegative().optional(),
38
+ periodResetAt: z.string().nullable(),
39
+ seatLimit: z.number().int().positive().nullable(),
40
+ seatsUsed: z.number().int().nonnegative(),
41
+ cancelAtPeriodEnd: z.boolean(),
42
+ });
43
+ export type BillingPlanBalance = z.infer<typeof BillingPlanBalance>;