@stim-cli/server 1.20.2 → 1.21.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.
@@ -1,5 +1,6 @@
1
1
  import "node:module";
2
- import { ACTIONS, BUILD_REPO_PATTERN, BUILD_RUBY_VERSION_PATTERN, CAPABILITIES, CONTROL_END_REASONS, DEVICE_POSTURES, ERROR_CODES, FEATURES, FRAME_EDGE, FRAME_FPS, INPUT_BUTTONS, INPUT_KEYS, KEY_MODIFIERS, LEGACY_PUSH_EVENTS, LOG_LEVELS, LOG_SOURCES, MAX_INPUT_TEXT, MAX_LOG_TAIL, NOTIFICATION_LEVELS, NOTIFICATION_SUPPRESSIONS, PLATFORMS, PROTOCOL_VERSION, PUSH_EVENTS, PUSH_TOKEN_PATTERN, RELOAD_PLATFORMS, REPLAY_MARKER_KINDS, REPLAY_RATES, ROTATE_DIRECTIONS, TOUCH_PHASES, VIDEO_CODECS } from "@stim-cli/core/protocol";
2
+ import { ACTIONS, ARCHIVED_PAGE_LIMIT, BUILD_REPO_PATTERN, BUILD_RUBY_VERSION_PATTERN, CAPABILITIES, CONTROL_END_REASONS, DEVICE_POSTURES, ERROR_CODES, FEATURES, FRAME_EDGE, FRAME_FPS, INPUT_BUTTONS, INPUT_KEYS, KEY_MODIFIERS, LEGACY_PUSH_EVENTS, LOG_LEVELS, LOG_SOURCES, MAX_INPUT_TEXT, MAX_LOG_TAIL, NOTIFICATION_LEVELS, NOTIFICATION_SUPPRESSIONS, PLATFORMS, PROTOCOL_VERSION, PUSH_EVENTS, PUSH_TOKEN_PATTERN, RELOAD_PLATFORMS, REPLAY_MARKER_KINDS, REPLAY_RATES, ROTATE_DIRECTIONS, TOUCH_PHASES, VIDEO_CODECS } from "@stim-cli/core/protocol";
3
+ import { SETTING_SCOPES } from "@stim-cli/core/state";
3
4
  //#region \0rolldown/runtime.js
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -44,6 +45,49 @@ const buildRepo = {
44
45
  type: "string",
45
46
  pattern: BUILD_REPO_PATTERN
46
47
  };
48
+ const buildArtifactIdentity = {
49
+ type: "object",
50
+ required: ["fingerprint", "cacheKey"],
51
+ additionalProperties: false,
52
+ properties: {
53
+ fingerprint: {
54
+ type: "string",
55
+ minLength: 1,
56
+ maxLength: 256
57
+ },
58
+ cacheKey: {
59
+ type: "string",
60
+ minLength: 1,
61
+ maxLength: 1024
62
+ }
63
+ }
64
+ };
65
+ const workspaceRef = {
66
+ type: "object",
67
+ required: ["workspace"],
68
+ additionalProperties: false,
69
+ properties: { workspace: {
70
+ type: "string",
71
+ minLength: 1
72
+ } }
73
+ };
74
+ const keyedDelta = (description) => ({
75
+ type: "object",
76
+ required: ["upsert", "remove"],
77
+ additionalProperties: false,
78
+ properties: {
79
+ upsert: {
80
+ type: "array",
81
+ items: { type: "object" },
82
+ description
83
+ },
84
+ remove: {
85
+ type: "array",
86
+ items: { type: "string" },
87
+ description: "The paths that are gone."
88
+ }
89
+ }
90
+ });
47
91
  const sha256 = {
48
92
  type: "string",
49
93
  pattern: "^[0-9a-f]{64}$"
@@ -776,14 +820,10 @@ function protocolJsonSchema() {
776
820
  },
777
821
  HelloParams: {
778
822
  type: "object",
779
- required: [
780
- "protocol",
781
- "client",
782
- "auth"
783
- ],
823
+ description: "The first request, sent encrypted after the Noise handshake on a network connection, or in the clear on the local Unix socket.",
824
+ required: ["client"],
784
825
  additionalProperties: false,
785
826
  properties: {
786
- protocol: { type: "integer" },
787
827
  client: {
788
828
  type: "object",
789
829
  required: ["name", "version"],
@@ -796,44 +836,8 @@ function protocolJsonSchema() {
796
836
  }
797
837
  }
798
838
  },
799
- auth: { oneOf: [
800
- {
801
- type: "object",
802
- required: ["pairingToken", "deviceName"],
803
- additionalProperties: false,
804
- properties: {
805
- pairingToken: { type: "string" },
806
- deviceName: {
807
- type: "string",
808
- minLength: 1
809
- }
810
- }
811
- },
812
- {
813
- type: "object",
814
- required: ["deviceToken"],
815
- additionalProperties: false,
816
- properties: { deviceToken: { type: "string" } }
817
- },
818
- {
819
- type: "object",
820
- required: ["request", "deviceName"],
821
- additionalProperties: false,
822
- properties: {
823
- request: { enum: ["build", "device-host"] },
824
- deviceName: {
825
- type: "string",
826
- minLength: 1
827
- },
828
- setupTicket: {
829
- type: "string",
830
- minLength: 43,
831
- maxLength: 43,
832
- pattern: "^[A-Za-z0-9_-]{43}$"
833
- }
834
- }
835
- }
836
- ] }
839
+ access: { enum: ["build", "device-host"] },
840
+ desktopBootstrap: { const: true }
837
841
  }
838
842
  },
839
843
  HelloResult: {
@@ -875,7 +879,9 @@ function protocolJsonSchema() {
875
879
  name: { type: "string" },
876
880
  version: { type: "string" },
877
881
  stim: { type: "string" },
878
- home: { type: "string" }
882
+ home: { type: "string" },
883
+ id: { type: "string" },
884
+ port: { type: "integer" }
879
885
  }
880
886
  },
881
887
  capabilities: {
@@ -899,18 +905,29 @@ function protocolJsonSchema() {
899
905
  name: { type: "string" }
900
906
  }
901
907
  },
902
- deviceToken: { type: "string" },
903
- approval: {
908
+ desktopBootstrap: {
904
909
  type: "object",
905
- required: ["state", "expiresAt"],
910
+ required: ["nonce", "proof"],
906
911
  additionalProperties: false,
907
912
  properties: {
908
- state: { const: "pending" },
909
- expiresAt: { type: "string" }
913
+ nonce: {
914
+ type: "string",
915
+ pattern: "^[A-Za-z0-9_-]{43}$"
916
+ },
917
+ proof: {
918
+ type: "string",
919
+ pattern: "^[A-Za-z0-9_-]{43}$"
920
+ }
910
921
  }
911
922
  }
912
923
  }
913
924
  },
925
+ DesktopAuthenticateResult: {
926
+ type: "object",
927
+ required: ["authorized"],
928
+ additionalProperties: false,
929
+ properties: { authorized: { const: true } }
930
+ },
914
931
  LogRecord: {
915
932
  type: "object",
916
933
  description: "One record as `stim logs --json` prints it.",
@@ -926,6 +943,25 @@ function protocolJsonSchema() {
926
943
  }
927
944
  }
928
945
  },
946
+ DesktopLogFilter: {
947
+ type: "object",
948
+ required: ["workspace"],
949
+ additionalProperties: false,
950
+ properties: {
951
+ workspace: { type: "string" },
952
+ sources: {
953
+ type: "array",
954
+ minItems: 1,
955
+ items: { enum: [...LOG_SOURCES] }
956
+ },
957
+ level: { enum: [...LOG_LEVELS] },
958
+ grep: {
959
+ type: "string",
960
+ pattern: "^[^\\u0000]*$"
961
+ },
962
+ errors: { type: "boolean" }
963
+ }
964
+ },
929
965
  LogFilter: {
930
966
  type: "object",
931
967
  oneOf: [{ required: ["workspace"] }, { required: ["archive"] }],
@@ -1383,6 +1419,36 @@ function protocolJsonSchema() {
1383
1419
  suppressed: { enum: [...NOTIFICATION_SUPPRESSIONS] }
1384
1420
  }
1385
1421
  },
1422
+ DesktopReportTarget: { oneOf: [{
1423
+ type: "object",
1424
+ required: ["report"],
1425
+ additionalProperties: false,
1426
+ properties: { report: { const: "gc" } }
1427
+ }, {
1428
+ type: "object",
1429
+ required: ["report", "cwd"],
1430
+ additionalProperties: false,
1431
+ properties: {
1432
+ report: { const: "doctor" },
1433
+ cwd: {
1434
+ type: "string",
1435
+ minLength: 1,
1436
+ maxLength: 4096
1437
+ },
1438
+ platform: { enum: ["ios", "android"] }
1439
+ }
1440
+ }] },
1441
+ DesktopReportSnapshot: {
1442
+ type: "object",
1443
+ required: ["pending", "value"],
1444
+ additionalProperties: false,
1445
+ properties: {
1446
+ pending: { type: "boolean" },
1447
+ value: { type: ["object", "null"] },
1448
+ error: { type: "string" },
1449
+ measuredAt: { type: "string" }
1450
+ }
1451
+ },
1386
1452
  MachineDetails: {
1387
1453
  type: "object",
1388
1454
  required: [
@@ -1405,7 +1471,7 @@ function protocolJsonSchema() {
1405
1471
  statsError: { type: "string" },
1406
1472
  buildMachines: {
1407
1473
  type: ["array", "null"],
1408
- description: "`remoteMachines` from `stim doctor --json --platform ios`.",
1474
+ description: "`remoteMachines` from `stim doctor --json`.",
1409
1475
  items: { type: "object" }
1410
1476
  },
1411
1477
  buildMachinesError: { type: "string" },
@@ -1413,7 +1479,7 @@ function protocolJsonSchema() {
1413
1479
  buildMachinesPending: { type: "boolean" },
1414
1480
  buildClients: {
1415
1481
  type: "array",
1416
- description: "The builds this Mac ran for each client, from the audit log.",
1482
+ description: "The builds this machine ran for each client, from the audit log.",
1417
1483
  items: {
1418
1484
  type: "object",
1419
1485
  required: [
@@ -1916,11 +1982,130 @@ function protocolJsonSchema() {
1916
1982
  request("device-host.input.rotate", session({ direction: { enum: [...ROTATE_DIRECTIONS] } }, ["direction"])),
1917
1983
  request("device-host.input.posture", session({ posture: { enum: [...DEVICE_POSTURES] } }, ["posture"])),
1918
1984
  request("hello", { $ref: "#/$defs/HelloParams" }),
1985
+ request("desktop.authenticate", {
1986
+ type: "object",
1987
+ required: ["proof"],
1988
+ additionalProperties: false,
1989
+ properties: { proof: {
1990
+ type: "string",
1991
+ pattern: "^[A-Za-z0-9_-]{43}$"
1992
+ } }
1993
+ }),
1919
1994
  optionalParams("route.setup", {
1920
1995
  type: "object",
1921
1996
  maxProperties: 0
1922
1997
  }),
1998
+ request("desktop.reports.get", { $ref: "#/$defs/DesktopReportTarget" }),
1999
+ request("desktop.reports.subscribe", { $ref: "#/$defs/DesktopReportTarget" }),
2000
+ optionalParams("desktop.reports.invalidate", {
2001
+ type: "object",
2002
+ maxProperties: 0
2003
+ }),
2004
+ request("desktop.settings.get", {
2005
+ type: "object",
2006
+ required: ["cwd"],
2007
+ additionalProperties: false,
2008
+ properties: { cwd: {
2009
+ type: "string",
2010
+ minLength: 1,
2011
+ maxLength: 4096
2012
+ } }
2013
+ }),
2014
+ request("desktop.settings.write", { oneOf: ["set", "unset"].map((action) => ({
2015
+ type: "object",
2016
+ required: [
2017
+ "cwd",
2018
+ "action",
2019
+ "key",
2020
+ ...action === "set" ? ["value"] : []
2021
+ ],
2022
+ additionalProperties: false,
2023
+ properties: {
2024
+ cwd: {
2025
+ type: "string",
2026
+ minLength: 1,
2027
+ maxLength: 4096
2028
+ },
2029
+ action: { const: action },
2030
+ key: {
2031
+ type: "string",
2032
+ minLength: 1,
2033
+ maxLength: 256
2034
+ },
2035
+ scope: { enum: [...SETTING_SCOPES] },
2036
+ ...action === "set" ? { value: { type: "string" } } : {}
2037
+ }
2038
+ })) }),
2039
+ request("desktop.logs.subscribe", { $ref: "#/$defs/DesktopLogFilter" }),
2040
+ request("desktop.doctor.run", {
2041
+ type: "object",
2042
+ required: ["cwd"],
2043
+ additionalProperties: false,
2044
+ properties: {
2045
+ cwd: {
2046
+ type: "string",
2047
+ minLength: 1,
2048
+ maxLength: 4096
2049
+ },
2050
+ platform: { enum: ["ios", "android"] }
2051
+ }
2052
+ }),
2053
+ request("desktop.stop.subscribe", {
2054
+ type: "object",
2055
+ required: ["cwd"],
2056
+ additionalProperties: false,
2057
+ properties: {
2058
+ cwd: {
2059
+ type: "string",
2060
+ minLength: 1,
2061
+ maxLength: 4096
2062
+ },
2063
+ slot: {
2064
+ type: "string",
2065
+ pattern: "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$",
2066
+ not: { enum: [
2067
+ "constructor",
2068
+ "prototype",
2069
+ "__proto__"
2070
+ ] }
2071
+ }
2072
+ }
2073
+ }),
2074
+ request("desktop.reload.subscribe", {
2075
+ type: "object",
2076
+ required: ["cwd"],
2077
+ additionalProperties: false,
2078
+ properties: {
2079
+ cwd: {
2080
+ type: "string",
2081
+ minLength: 1,
2082
+ maxLength: 4096
2083
+ },
2084
+ platform: { enum: [...RELOAD_PLATFORMS] }
2085
+ }
2086
+ }),
1923
2087
  request("status.subscribe"),
2088
+ request("workspaces.subscribe"),
2089
+ request("workspace.subscribe", workspaceRef),
2090
+ request("machine.subscribe"),
2091
+ request("builds.history", workspaceRef),
2092
+ optionalParams("archived.list", {
2093
+ type: "object",
2094
+ additionalProperties: false,
2095
+ properties: {
2096
+ before: {
2097
+ type: "string",
2098
+ minLength: 1
2099
+ },
2100
+ limit: {
2101
+ type: "integer",
2102
+ minimum: 1,
2103
+ maximum: ARCHIVED_PAGE_LIMIT
2104
+ }
2105
+ }
2106
+ }),
2107
+ request("worktrees.list"),
2108
+ request("maintenance.get"),
1924
2109
  request("logs.query", { $ref: "#/$defs/LogFilter" }),
1925
2110
  request("logs.subscribe", { $ref: "#/$defs/LogFilter" }),
1926
2111
  request("frames.subscribe", { $ref: "#/$defs/FrameTarget" }),
@@ -1942,7 +2127,7 @@ function protocolJsonSchema() {
1942
2127
  subscription: { type: "string" },
1943
2128
  at: {
1944
2129
  type: "number",
1945
- description: "Epoch milliseconds on the Mac clock."
2130
+ description: "Epoch milliseconds on the machine clock."
1946
2131
  },
1947
2132
  rate: { enum: [...REPLAY_RATES] }
1948
2133
  }
@@ -2001,7 +2186,7 @@ function protocolJsonSchema() {
2001
2186
  },
2002
2187
  at: {
2003
2188
  type: "number",
2004
- description: "Epoch milliseconds on the Mac clock."
2189
+ description: "Epoch milliseconds on the machine clock."
2005
2190
  }
2006
2191
  }
2007
2192
  }),
@@ -2225,7 +2410,8 @@ function protocolJsonSchema() {
2225
2410
  type: "string",
2226
2411
  pattern: BUILD_RUBY_VERSION_PATTERN
2227
2412
  },
2228
- native: { enum: ["xcode", "gradle"] }
2413
+ native: { enum: ["xcode", "gradle"] },
2414
+ artifact: buildArtifactIdentity
2229
2415
  }
2230
2416
  }),
2231
2417
  request("build.sync", {
@@ -2462,6 +2648,15 @@ function protocolJsonSchema() {
2462
2648
  }),
2463
2649
  request("build.cancel", buildJob),
2464
2650
  request("build.artifact", buildJob),
2651
+ request("build.cached-artifact", {
2652
+ type: "object",
2653
+ required: ["repo", "artifact"],
2654
+ additionalProperties: false,
2655
+ properties: {
2656
+ repo: buildRepo,
2657
+ artifact: buildArtifactIdentity
2658
+ }
2659
+ }),
2465
2660
  request("build.attach", buildJob),
2466
2661
  request("server.update.status"),
2467
2662
  request("device-host.sessions"),
@@ -2566,6 +2761,7 @@ function protocolJsonSchema() {
2566
2761
  { $ref: "#/$defs/ServerUpdateProgress" },
2567
2762
  { $ref: "#/$defs/MachineUpdateStatus" },
2568
2763
  { $ref: "#/$defs/HelloResult" },
2764
+ { $ref: "#/$defs/DesktopAuthenticateResult" },
2569
2765
  { $ref: "#/$defs/ControlBeginResult" },
2570
2766
  { $ref: "#/$defs/SimulatorOptions" },
2571
2767
  { $ref: "#/$defs/ActionResult" },
@@ -2714,6 +2910,56 @@ function protocolJsonSchema() {
2714
2910
  }
2715
2911
  }] },
2716
2912
  ServerEvent: { oneOf: [
2913
+ {
2914
+ type: "object",
2915
+ required: [
2916
+ "event",
2917
+ "subscription",
2918
+ "stream",
2919
+ "message"
2920
+ ],
2921
+ additionalProperties: false,
2922
+ properties: {
2923
+ event: { enum: ["desktop-stop-progress", "desktop-reload-progress"] },
2924
+ subscription: { type: "string" },
2925
+ stream: { enum: ["stdout", "stderr"] },
2926
+ message: { type: "string" }
2927
+ }
2928
+ },
2929
+ {
2930
+ type: "object",
2931
+ required: [
2932
+ "event",
2933
+ "subscription",
2934
+ "exitCode",
2935
+ "stdout",
2936
+ "message"
2937
+ ],
2938
+ additionalProperties: false,
2939
+ properties: {
2940
+ event: { enum: ["desktop-stop-ended", "desktop-reload-ended"] },
2941
+ subscription: { type: "string" },
2942
+ exitCode: { enum: [0, 1] },
2943
+ stdout: { type: "string" },
2944
+ message: { type: "string" }
2945
+ }
2946
+ },
2947
+ {
2948
+ type: "object",
2949
+ required: [
2950
+ "event",
2951
+ "subscription",
2952
+ "target",
2953
+ "snapshot"
2954
+ ],
2955
+ additionalProperties: false,
2956
+ properties: {
2957
+ event: { const: "desktop-report" },
2958
+ subscription: { type: "string" },
2959
+ target: { $ref: "#/$defs/DesktopReportTarget" },
2960
+ snapshot: { $ref: "#/$defs/DesktopReportSnapshot" }
2961
+ }
2962
+ },
2717
2963
  {
2718
2964
  type: "object",
2719
2965
  required: [
@@ -2804,6 +3050,95 @@ function protocolJsonSchema() {
2804
3050
  }
2805
3051
  }
2806
3052
  },
3053
+ {
3054
+ type: "object",
3055
+ required: [
3056
+ "event",
3057
+ "subscription",
3058
+ "seq"
3059
+ ],
3060
+ additionalProperties: false,
3061
+ properties: {
3062
+ event: { const: "workspaces" },
3063
+ subscription: { type: "string" },
3064
+ seq: {
3065
+ type: "integer",
3066
+ minimum: 0
3067
+ },
3068
+ snapshot: {
3069
+ type: "object",
3070
+ required: [
3071
+ "workspaces",
3072
+ "worktrees",
3073
+ "archived"
3074
+ ],
3075
+ additionalProperties: false,
3076
+ properties: {
3077
+ workspaces: {
3078
+ type: "array",
3079
+ items: { type: "object" }
3080
+ },
3081
+ worktrees: {
3082
+ type: "array",
3083
+ items: { type: "object" }
3084
+ },
3085
+ archived: { type: "object" }
3086
+ }
3087
+ },
3088
+ workspaces: keyedDelta("Workspace summaries to insert or replace by path."),
3089
+ worktrees: keyedDelta("Unprovisioned worktree rows to insert or replace by path."),
3090
+ archived: {
3091
+ type: "object",
3092
+ description: "The archives summary, when it changed."
3093
+ }
3094
+ }
3095
+ },
3096
+ {
3097
+ type: "object",
3098
+ required: [
3099
+ "event",
3100
+ "subscription",
3101
+ "seq",
3102
+ "environment"
3103
+ ],
3104
+ additionalProperties: false,
3105
+ properties: {
3106
+ event: { const: "workspace" },
3107
+ subscription: { type: "string" },
3108
+ seq: {
3109
+ type: "integer",
3110
+ minimum: 0
3111
+ },
3112
+ environment: {
3113
+ oneOf: [{ type: "null" }, { type: "object" }],
3114
+ description: "The environment, as `stim status --json` prints it."
3115
+ }
3116
+ }
3117
+ },
3118
+ {
3119
+ type: "object",
3120
+ required: [
3121
+ "event",
3122
+ "subscription",
3123
+ "seq",
3124
+ "machine"
3125
+ ],
3126
+ additionalProperties: false,
3127
+ properties: {
3128
+ event: { const: "machine" },
3129
+ subscription: { type: "string" },
3130
+ seq: {
3131
+ type: "integer",
3132
+ minimum: 0
3133
+ },
3134
+ machine: { type: "object" },
3135
+ usage: { $ref: "#/$defs/UsageHistory" },
3136
+ ownLeases: {
3137
+ type: "array",
3138
+ items: { type: "string" }
3139
+ }
3140
+ }
3141
+ },
2807
3142
  {
2808
3143
  type: "object",
2809
3144
  required: [
package/dist/protocol.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { t as protocolJsonSchema } from "./protocol-CjUChTWJ.mjs";
1
+ import { t as protocolJsonSchema } from "./protocol-D21Ab4EI.mjs";
2
2
  export * from "@stim-cli/core/protocol";
3
3
  export { protocolJsonSchema };