@halcyonlabs/app 0.47.0-halcyon.151 → 0.47.0-halcyon.154

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.
package/README.md CHANGED
@@ -116,7 +116,7 @@ takes precedence. In-place progress updates require a stdout TTY.
116
116
 
117
117
  The same output capture applies to `bb-server` and `bb-host-daemon`.
118
118
 
119
- To stop a Moonlet that runs in another terminal or in the background:
119
+ To stop a Moonlet install that runs in another terminal or in the background:
120
120
 
121
121
  ```bash
122
122
  npx -y -p @halcyonlabs/app bb-app stop
@@ -124,7 +124,7 @@ npx -y -p @halcyonlabs/app bb-app stop
124
124
 
125
125
  `stop` reads `bb-app-runtime.json` from the data directory, confirms that the
126
126
  recorded process really is that launcher, then stops it. Pass `--data-dir` when
127
- the Moonlet you want to stop does not use the default `~/.bb/`.
127
+ the Moonlet install you want to stop does not use the default `~/.bb/`.
128
128
 
129
129
  ### The `bb` command
130
130
 
package/dist/bb-app.js CHANGED
@@ -19664,7 +19664,7 @@ async function writeOwnCliLauncher(context) {
19664
19664
  } catch (error2) {
19665
19665
  log(
19666
19666
  yellow("!"),
19667
- `Could not write the Moonlet command launcher at ${launcherPath}: ${error2 instanceof Error ? error2.message : String(error2)}`
19667
+ `Could not write the bb command launcher at ${launcherPath}: ${error2 instanceof Error ? error2.message : String(error2)}`
19668
19668
  );
19669
19669
  return null;
19670
19670
  }
package/dist/index.d.ts CHANGED
@@ -155,10 +155,10 @@ declare const uiPreferenceDefinitions: {
155
155
  }>>;
156
156
  readonly "sidebar.threadGrouping.environment": UiPreferenceDefinition<z$1.ZodUnion<readonly [z$1.ZodLiteral<"auto">, z$1.ZodBoolean]>>;
157
157
  readonly "sidebar.chronologicalSort": UiPreferenceDefinition<z$1.ZodEnum<{
158
+ none: "none";
158
159
  updated: "updated";
159
160
  created: "created";
160
161
  alpha: "alpha";
161
- none: "none";
162
162
  }>>;
163
163
  readonly "sidebar.sortDirection": UiPreferenceDefinition<z$1.ZodEnum<{
164
164
  default: "default";
@@ -7336,8 +7336,8 @@ declare const hostDaemonCommandRegistry: {
7336
7336
  providerInstallation: z$1.ZodBoolean;
7337
7337
  supportsServiceTier: z$1.ZodBoolean;
7338
7338
  permissionModes: z$1.ZodArray<z$1.ZodEnum<{
7339
- auto: "auto";
7340
7339
  "accept-edits": "accept-edits";
7340
+ auto: "auto";
7341
7341
  full: "full";
7342
7342
  }>>;
7343
7343
  supportsThreadArchive: z$1.ZodBoolean;
@@ -7363,16 +7363,16 @@ declare const hostDaemonCommandRegistry: {
7363
7363
  permissionScope: z$1.ZodLiteral<"workspace">;
7364
7364
  approvalReviewer: z$1.ZodLiteral<"user">;
7365
7365
  permissionEscalation: z$1.ZodEnum<{
7366
- deny: "deny";
7367
7366
  ask: "ask";
7367
+ deny: "deny";
7368
7368
  }>;
7369
7369
  }, z$1.core.$strip>, z$1.ZodObject<{
7370
7370
  permissionMode: z$1.ZodLiteral<"auto">;
7371
7371
  permissionScope: z$1.ZodLiteral<"workspace">;
7372
7372
  approvalReviewer: z$1.ZodLiteral<"automatic">;
7373
7373
  permissionEscalation: z$1.ZodEnum<{
7374
- deny: "deny";
7375
7374
  ask: "ask";
7375
+ deny: "deny";
7376
7376
  }>;
7377
7377
  }, z$1.core.$strip>, z$1.ZodObject<{
7378
7378
  permissionMode: z$1.ZodLiteral<"full">;
@@ -7485,8 +7485,8 @@ declare const hostDaemonCommandRegistry: {
7485
7485
  providerInstallation: z$1.ZodBoolean;
7486
7486
  supportsServiceTier: z$1.ZodBoolean;
7487
7487
  permissionModes: z$1.ZodArray<z$1.ZodEnum<{
7488
- auto: "auto";
7489
7488
  "accept-edits": "accept-edits";
7489
+ auto: "auto";
7490
7490
  full: "full";
7491
7491
  }>>;
7492
7492
  supportsThreadArchive: z$1.ZodBoolean;
@@ -7512,16 +7512,16 @@ declare const hostDaemonCommandRegistry: {
7512
7512
  permissionScope: z$1.ZodLiteral<"workspace">;
7513
7513
  approvalReviewer: z$1.ZodLiteral<"user">;
7514
7514
  permissionEscalation: z$1.ZodEnum<{
7515
- deny: "deny";
7516
7515
  ask: "ask";
7516
+ deny: "deny";
7517
7517
  }>;
7518
7518
  }, z$1.core.$strip>, z$1.ZodObject<{
7519
7519
  permissionMode: z$1.ZodLiteral<"auto">;
7520
7520
  permissionScope: z$1.ZodLiteral<"workspace">;
7521
7521
  approvalReviewer: z$1.ZodLiteral<"automatic">;
7522
7522
  permissionEscalation: z$1.ZodEnum<{
7523
- deny: "deny";
7524
7523
  ask: "ask";
7524
+ deny: "deny";
7525
7525
  }>;
7526
7526
  }, z$1.core.$strip>, z$1.ZodObject<{
7527
7527
  permissionMode: z$1.ZodLiteral<"full">;
@@ -7657,8 +7657,8 @@ declare const hostDaemonCommandRegistry: {
7657
7657
  }>;
7658
7658
  origin: z$1.ZodEnum<{
7659
7659
  builtin: "builtin";
7660
- user: "user";
7661
7660
  project: "project";
7661
+ user: "user";
7662
7662
  }>;
7663
7663
  label: z$1.ZodString;
7664
7664
  argumentHint: z$1.ZodNullable<z$1.ZodString>;
@@ -7747,8 +7747,8 @@ declare const hostDaemonCommandRegistry: {
7747
7747
  }>;
7748
7748
  origin: z$1.ZodEnum<{
7749
7749
  builtin: "builtin";
7750
- user: "user";
7751
7750
  project: "project";
7751
+ user: "user";
7752
7752
  }>;
7753
7753
  label: z$1.ZodString;
7754
7754
  argumentHint: z$1.ZodNullable<z$1.ZodString>;
@@ -7850,8 +7850,8 @@ declare const hostDaemonCommandRegistry: {
7850
7850
  }>;
7851
7851
  origin: z$1.ZodEnum<{
7852
7852
  builtin: "builtin";
7853
- user: "user";
7854
7853
  project: "project";
7854
+ user: "user";
7855
7855
  }>;
7856
7856
  label: z$1.ZodString;
7857
7857
  argumentHint: z$1.ZodNullable<z$1.ZodString>;
@@ -7940,8 +7940,8 @@ declare const hostDaemonCommandRegistry: {
7940
7940
  }>;
7941
7941
  origin: z$1.ZodEnum<{
7942
7942
  builtin: "builtin";
7943
- user: "user";
7944
7943
  project: "project";
7944
+ user: "user";
7945
7945
  }>;
7946
7946
  label: z$1.ZodString;
7947
7947
  argumentHint: z$1.ZodNullable<z$1.ZodString>;
@@ -7995,16 +7995,16 @@ declare const hostDaemonCommandRegistry: {
7995
7995
  permissionScope: z$1.ZodLiteral<"workspace">;
7996
7996
  approvalReviewer: z$1.ZodLiteral<"user">;
7997
7997
  permissionEscalation: z$1.ZodEnum<{
7998
- deny: "deny";
7999
7998
  ask: "ask";
7999
+ deny: "deny";
8000
8000
  }>;
8001
8001
  }, z$1.core.$strip>, z$1.ZodObject<{
8002
8002
  permissionMode: z$1.ZodLiteral<"auto">;
8003
8003
  permissionScope: z$1.ZodLiteral<"workspace">;
8004
8004
  approvalReviewer: z$1.ZodLiteral<"automatic">;
8005
8005
  permissionEscalation: z$1.ZodEnum<{
8006
- deny: "deny";
8007
8006
  ask: "ask";
8007
+ deny: "deny";
8008
8008
  }>;
8009
8009
  }, z$1.core.$strip>, z$1.ZodObject<{
8010
8010
  permissionMode: z$1.ZodLiteral<"full">;
@@ -8023,8 +8023,8 @@ declare const hostDaemonCommandRegistry: {
8023
8023
  providerInstallation: z$1.ZodBoolean;
8024
8024
  supportsServiceTier: z$1.ZodBoolean;
8025
8025
  permissionModes: z$1.ZodArray<z$1.ZodEnum<{
8026
- auto: "auto";
8027
8026
  "accept-edits": "accept-edits";
8027
+ auto: "auto";
8028
8028
  full: "full";
8029
8029
  }>>;
8030
8030
  supportsThreadArchive: z$1.ZodBoolean;
@@ -8042,9 +8042,6 @@ declare const hostDaemonCommandRegistry: {
8042
8042
  workspaceContext: z$1.ZodObject<{
8043
8043
  workspacePath: z$1.ZodString;
8044
8044
  }, z$1.core.$strip>;
8045
- projectId: z$1.ZodString;
8046
- providerThreadId: z$1.ZodString;
8047
- providerId: z$1.ZodString;
8048
8045
  bridgeLaunch: z$1.ZodObject<{
8049
8046
  pluginId: z$1.ZodString;
8050
8047
  source: z$1.ZodObject<{
@@ -8056,8 +8053,8 @@ declare const hostDaemonCommandRegistry: {
8056
8053
  providerInstallation: z$1.ZodBoolean;
8057
8054
  supportsServiceTier: z$1.ZodBoolean;
8058
8055
  permissionModes: z$1.ZodArray<z$1.ZodEnum<{
8059
- auto: "auto";
8060
8056
  "accept-edits": "accept-edits";
8057
+ auto: "auto";
8061
8058
  full: "full";
8062
8059
  }>>;
8063
8060
  supportsThreadArchive: z$1.ZodBoolean;
@@ -8075,6 +8072,8 @@ declare const hostDaemonCommandRegistry: {
8075
8072
  replace: "replace";
8076
8073
  append: "append";
8077
8074
  }>;
8075
+ projectId: z$1.ZodString;
8076
+ providerId: z$1.ZodString;
8078
8077
  instructions: z$1.ZodString;
8079
8078
  dynamicTools: z$1.ZodArray<z$1.ZodObject<{
8080
8079
  name: z$1.ZodString;
@@ -8150,6 +8149,7 @@ declare const hostDaemonCommandRegistry: {
8150
8149
  sourceRootPath: z$1.ZodString;
8151
8150
  skillFilePath: z$1.ZodString;
8152
8151
  }, z$1.core.$strict>], "kind">>;
8152
+ providerThreadId: z$1.ZodString;
8153
8153
  }, z$1.core.$strict>;
8154
8154
  target: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
8155
8155
  mode: z$1.ZodLiteral<"start">;
@@ -8211,16 +8211,16 @@ declare const hostDaemonCommandRegistry: {
8211
8211
  permissionScope: z$1.ZodLiteral<"workspace">;
8212
8212
  approvalReviewer: z$1.ZodLiteral<"user">;
8213
8213
  permissionEscalation: z$1.ZodEnum<{
8214
- deny: "deny";
8215
8214
  ask: "ask";
8215
+ deny: "deny";
8216
8216
  }>;
8217
8217
  }, z$1.core.$strip>, z$1.ZodObject<{
8218
8218
  permissionMode: z$1.ZodLiteral<"auto">;
8219
8219
  permissionScope: z$1.ZodLiteral<"workspace">;
8220
8220
  approvalReviewer: z$1.ZodLiteral<"automatic">;
8221
8221
  permissionEscalation: z$1.ZodEnum<{
8222
- deny: "deny";
8223
8222
  ask: "ask";
8223
+ deny: "deny";
8224
8224
  }>;
8225
8225
  }, z$1.core.$strip>, z$1.ZodObject<{
8226
8226
  permissionMode: z$1.ZodLiteral<"full">;
@@ -8239,8 +8239,8 @@ declare const hostDaemonCommandRegistry: {
8239
8239
  providerInstallation: z$1.ZodBoolean;
8240
8240
  supportsServiceTier: z$1.ZodBoolean;
8241
8241
  permissionModes: z$1.ZodArray<z$1.ZodEnum<{
8242
- auto: "auto";
8243
8242
  "accept-edits": "accept-edits";
8243
+ auto: "auto";
8244
8244
  full: "full";
8245
8245
  }>>;
8246
8246
  supportsThreadArchive: z$1.ZodBoolean;
@@ -8258,9 +8258,6 @@ declare const hostDaemonCommandRegistry: {
8258
8258
  workspaceContext: z$1.ZodObject<{
8259
8259
  workspacePath: z$1.ZodString;
8260
8260
  }, z$1.core.$strip>;
8261
- projectId: z$1.ZodString;
8262
- providerThreadId: z$1.ZodString;
8263
- providerId: z$1.ZodString;
8264
8261
  bridgeLaunch: z$1.ZodObject<{
8265
8262
  pluginId: z$1.ZodString;
8266
8263
  source: z$1.ZodObject<{
@@ -8272,8 +8269,8 @@ declare const hostDaemonCommandRegistry: {
8272
8269
  providerInstallation: z$1.ZodBoolean;
8273
8270
  supportsServiceTier: z$1.ZodBoolean;
8274
8271
  permissionModes: z$1.ZodArray<z$1.ZodEnum<{
8275
- auto: "auto";
8276
8272
  "accept-edits": "accept-edits";
8273
+ auto: "auto";
8277
8274
  full: "full";
8278
8275
  }>>;
8279
8276
  supportsThreadArchive: z$1.ZodBoolean;
@@ -8291,6 +8288,8 @@ declare const hostDaemonCommandRegistry: {
8291
8288
  replace: "replace";
8292
8289
  append: "append";
8293
8290
  }>;
8291
+ projectId: z$1.ZodString;
8292
+ providerId: z$1.ZodString;
8294
8293
  instructions: z$1.ZodString;
8295
8294
  dynamicTools: z$1.ZodArray<z$1.ZodObject<{
8296
8295
  name: z$1.ZodString;
@@ -8366,6 +8365,7 @@ declare const hostDaemonCommandRegistry: {
8366
8365
  sourceRootPath: z$1.ZodString;
8367
8366
  skillFilePath: z$1.ZodString;
8368
8367
  }, z$1.core.$strict>], "kind">>;
8368
+ providerThreadId: z$1.ZodString;
8369
8369
  }, z$1.core.$strict>;
8370
8370
  }, z$1.core.$strict>, z$1.ZodObject<{
8371
8371
  cleared: z$1.ZodBoolean;
@@ -8404,8 +8404,8 @@ declare const hostDaemonCommandRegistry: {
8404
8404
  providerInstallation: z$1.ZodBoolean;
8405
8405
  supportsServiceTier: z$1.ZodBoolean;
8406
8406
  permissionModes: z$1.ZodArray<z$1.ZodEnum<{
8407
- auto: "auto";
8408
8407
  "accept-edits": "accept-edits";
8408
+ auto: "auto";
8409
8409
  full: "full";
8410
8410
  }>>;
8411
8411
  supportsThreadArchive: z$1.ZodBoolean;
@@ -8437,8 +8437,8 @@ declare const hostDaemonCommandRegistry: {
8437
8437
  providerInstallation: z$1.ZodBoolean;
8438
8438
  supportsServiceTier: z$1.ZodBoolean;
8439
8439
  permissionModes: z$1.ZodArray<z$1.ZodEnum<{
8440
- auto: "auto";
8441
8440
  "accept-edits": "accept-edits";
8441
+ auto: "auto";
8442
8442
  full: "full";
8443
8443
  }>>;
8444
8444
  supportsThreadArchive: z$1.ZodBoolean;
@@ -8820,8 +8820,8 @@ declare const hostDaemonCommandRegistry: {
8820
8820
  skills: z$1.ZodArray<z$1.ZodObject<{
8821
8821
  path: z$1.ZodString;
8822
8822
  origin: z$1.ZodEnum<{
8823
- user: "user";
8824
8823
  project: "project";
8824
+ user: "user";
8825
8825
  }>;
8826
8826
  recursive: z$1.ZodBoolean;
8827
8827
  ancestors: z$1.ZodBoolean;
@@ -8839,8 +8839,8 @@ declare const hostDaemonCommandRegistry: {
8839
8839
  commands: z$1.ZodArray<z$1.ZodObject<{
8840
8840
  path: z$1.ZodString;
8841
8841
  origin: z$1.ZodEnum<{
8842
- user: "user";
8843
8842
  project: "project";
8843
+ user: "user";
8844
8844
  }>;
8845
8845
  recursive: z$1.ZodBoolean;
8846
8846
  ancestors: z$1.ZodBoolean;
@@ -8865,8 +8865,8 @@ declare const hostDaemonCommandRegistry: {
8865
8865
  skill: "skill";
8866
8866
  }>;
8867
8867
  origin: z$1.ZodEnum<{
8868
- user: "user";
8869
8868
  project: "project";
8869
+ user: "user";
8870
8870
  }>;
8871
8871
  description: z$1.ZodNullable<z$1.ZodString>;
8872
8872
  argumentHint: z$1.ZodNullable<z$1.ZodString>;
@@ -8913,8 +8913,8 @@ declare const hostDaemonCommandRegistry: {
8913
8913
  skills: z$1.ZodArray<z$1.ZodObject<{
8914
8914
  path: z$1.ZodString;
8915
8915
  origin: z$1.ZodEnum<{
8916
- user: "user";
8917
8916
  project: "project";
8917
+ user: "user";
8918
8918
  }>;
8919
8919
  recursive: z$1.ZodBoolean;
8920
8920
  ancestors: z$1.ZodBoolean;
@@ -8932,8 +8932,8 @@ declare const hostDaemonCommandRegistry: {
8932
8932
  commands: z$1.ZodArray<z$1.ZodObject<{
8933
8933
  path: z$1.ZodString;
8934
8934
  origin: z$1.ZodEnum<{
8935
- user: "user";
8936
8935
  project: "project";
8936
+ user: "user";
8937
8937
  }>;
8938
8938
  recursive: z$1.ZodBoolean;
8939
8939
  ancestors: z$1.ZodBoolean;
@@ -8959,14 +8959,14 @@ declare const hostDaemonCommandRegistry: {
8959
8959
  realPath: z$1.ZodString;
8960
8960
  contentSha256: z$1.ZodString;
8961
8961
  rootKind: z$1.ZodEnum<{
8962
- plugin: "plugin";
8963
8962
  "shared-user": "shared-user";
8964
8963
  "shared-project": "shared-project";
8964
+ plugin: "plugin";
8965
8965
  "bb-project": "bb-project";
8966
+ "provider-user": "provider-user";
8967
+ "provider-project": "provider-project";
8966
8968
  "bb-data-dir": "bb-data-dir";
8967
8969
  "bb-builtin": "bb-builtin";
8968
- "provider-project": "provider-project";
8969
- "provider-user": "provider-user";
8970
8970
  }>;
8971
8971
  linked: z$1.ZodBoolean;
8972
8972
  }, z$1.core.$strip>>;
@@ -9020,14 +9020,14 @@ declare const hostDaemonCommandRegistry: {
9020
9020
  realPath: z$1.ZodString;
9021
9021
  contentSha256: z$1.ZodString;
9022
9022
  rootKind: z$1.ZodEnum<{
9023
- plugin: "plugin";
9024
9023
  "shared-user": "shared-user";
9025
9024
  "shared-project": "shared-project";
9025
+ plugin: "plugin";
9026
9026
  "bb-project": "bb-project";
9027
+ "provider-user": "provider-user";
9028
+ "provider-project": "provider-project";
9027
9029
  "bb-data-dir": "bb-data-dir";
9028
9030
  "bb-builtin": "bb-builtin";
9029
- "provider-project": "provider-project";
9030
- "provider-user": "provider-user";
9031
9031
  }>;
9032
9032
  linked: z$1.ZodBoolean;
9033
9033
  }, z$1.core.$strip>>;
@@ -9035,10 +9035,10 @@ declare const hostDaemonCommandRegistry: {
9035
9035
  "host.delete_skill": HostDaemonCommandDescriptor<"host.delete_skill", z$1.ZodObject<{
9036
9036
  type: z$1.ZodLiteral<"host.delete_skill">;
9037
9037
  scope: z$1.ZodEnum<{
9038
+ "bb-user": "bb-user";
9038
9039
  "bb-project": "bb-project";
9039
- "provider-project": "provider-project";
9040
9040
  "provider-user": "provider-user";
9041
- "bb-user": "bb-user";
9041
+ "provider-project": "provider-project";
9042
9042
  }>;
9043
9043
  name: z$1.ZodString;
9044
9044
  cwd: z$1.ZodNullable<z$1.ZodString>;
@@ -9049,8 +9049,8 @@ declare const hostDaemonCommandRegistry: {
9049
9049
  "host.write_skill": HostDaemonCommandDescriptor<"host.write_skill", z$1.ZodObject<{
9050
9050
  type: z$1.ZodLiteral<"host.write_skill">;
9051
9051
  scope: z$1.ZodEnum<{
9052
- "bb-project": "bb-project";
9053
9052
  "bb-user": "bb-user";
9053
+ "bb-project": "bb-project";
9054
9054
  }>;
9055
9055
  name: z$1.ZodString;
9056
9056
  cwd: z$1.ZodNullable<z$1.ZodString>;
@@ -9147,8 +9147,8 @@ declare const hostDaemonCommandRegistry: {
9147
9147
  selectedBranch: z$1.ZodOptional<z$1.ZodString>;
9148
9148
  limit: z$1.ZodNumber;
9149
9149
  remoteRefresh: z$1.ZodEnum<{
9150
- background: "background";
9151
9150
  none: "none";
9151
+ background: "background";
9152
9152
  }>;
9153
9153
  }, z$1.core.$strict>, z$1.ZodObject<{
9154
9154
  branches: z$1.ZodArray<z$1.ZodString>;
@@ -9269,8 +9269,8 @@ declare const hostDaemonCommandRegistry: {
9269
9269
  providerInstallation: z$1.ZodBoolean;
9270
9270
  supportsServiceTier: z$1.ZodBoolean;
9271
9271
  permissionModes: z$1.ZodArray<z$1.ZodEnum<{
9272
- auto: "auto";
9273
9272
  "accept-edits": "accept-edits";
9273
+ auto: "auto";
9274
9274
  full: "full";
9275
9275
  }>>;
9276
9276
  supportsThreadArchive: z$1.ZodBoolean;
@@ -9399,8 +9399,8 @@ declare const hostDaemonCommandRegistry: {
9399
9399
  providerInstallation: z$1.ZodBoolean;
9400
9400
  supportsServiceTier: z$1.ZodBoolean;
9401
9401
  permissionModes: z$1.ZodArray<z$1.ZodEnum<{
9402
- auto: "auto";
9403
9402
  "accept-edits": "accept-edits";
9403
+ auto: "auto";
9404
9404
  full: "full";
9405
9405
  }>>;
9406
9406
  supportsThreadArchive: z$1.ZodBoolean;
@@ -9436,8 +9436,8 @@ declare const hostDaemonCommandRegistry: {
9436
9436
  providerInstallation: z$1.ZodBoolean;
9437
9437
  supportsServiceTier: z$1.ZodBoolean;
9438
9438
  permissionModes: z$1.ZodArray<z$1.ZodEnum<{
9439
- auto: "auto";
9440
9439
  "accept-edits": "accept-edits";
9440
+ auto: "auto";
9441
9441
  full: "full";
9442
9442
  }>>;
9443
9443
  supportsThreadArchive: z$1.ZodBoolean;
@@ -9490,8 +9490,8 @@ declare const hostDaemonCommandRegistry: {
9490
9490
  providerInstallation: z$1.ZodBoolean;
9491
9491
  supportsServiceTier: z$1.ZodBoolean;
9492
9492
  permissionModes: z$1.ZodArray<z$1.ZodEnum<{
9493
- auto: "auto";
9494
9493
  "accept-edits": "accept-edits";
9494
+ auto: "auto";
9495
9495
  full: "full";
9496
9496
  }>>;
9497
9497
  supportsThreadArchive: z$1.ZodBoolean;
@@ -9551,8 +9551,8 @@ declare const hostDaemonCommandRegistry: {
9551
9551
  providerInstallation: z$1.ZodBoolean;
9552
9552
  supportsServiceTier: z$1.ZodBoolean;
9553
9553
  permissionModes: z$1.ZodArray<z$1.ZodEnum<{
9554
- auto: "auto";
9555
9554
  "accept-edits": "accept-edits";
9555
+ auto: "auto";
9556
9556
  full: "full";
9557
9557
  }>>;
9558
9558
  supportsThreadArchive: z$1.ZodBoolean;
@@ -9605,8 +9605,8 @@ declare const hostDaemonCommandRegistry: {
9605
9605
  providerInstallation: z$1.ZodBoolean;
9606
9606
  supportsServiceTier: z$1.ZodBoolean;
9607
9607
  permissionModes: z$1.ZodArray<z$1.ZodEnum<{
9608
- auto: "auto";
9609
9608
  "accept-edits": "accept-edits";
9609
+ auto: "auto";
9610
9610
  full: "full";
9611
9611
  }>>;
9612
9612
  supportsThreadArchive: z$1.ZodBoolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halcyonlabs/app",
3
- "version": "0.47.0-halcyon.151",
3
+ "version": "0.47.0-halcyon.154",
4
4
  "description": "bb app launcher for npx",
5
5
  "keywords": [
6
6
  "bb",
@@ -1 +1 @@
1
- ddb77093407d3f48442a6c11df8bd5be3046f8b4
1
+ 258c1d580303d01c95b5bd12b782ff70704deed9
@@ -377,7 +377,8 @@ mountpoint -q ${xr} || { systemctl daemon-reload; mount ${xr}; }
377
377
  findmnt -no OPTIONS ${xr} | grep -qw ro`});if(c.code!==0)throw new E(`mounting the host's library folder on ${r.name} failed: ${(c.stderr||c.stdout).trim()}`)}return 0}var st,at,Zn,K,Zp,Rp,M$=P(()=>{"use strict";Ce();Tp();hs();it();ot();st={name:"ubuntu-24.04-20260926.qcow2",url:"https://cloud-images.ubuntu.com/releases/24.04/release-20260926/ubuntu-24.04-server-cloudimg-amd64.img",sha256:"6a81c37564db9b1ee84e141922625e1d7c5b389b99bb3c572e0243607d5bb4d2"},at="orbit",Zn="orbit",K="virsh -c qemu:///system",Zp="org.qemu.guest_agent.0";s(T$,"hypervisor");s(ms,"serverName");s(Me,"onServer");s(Z$,"libvirtInfo");s(Qk,"ensureBaseImage");s(R$,"cloudInit");s(ex,"ensureAgentChannel");Rp=["import io, sys","import xml.etree.ElementTree as ET","view, tag = sys.argv[1], sys.argv[2]","text = sys.stdin.read()","for _, (prefix, uri) in ET.iterparse(io.StringIO(text), events=('start-ns',)):"," ET.register_namespace(prefix, uri)","domain = ET.fromstring(text)","devices = domain.find('devices')","backing = domain.find('memoryBacking')","def attr(parent, child, name):"," found = None if parent is None else parent.find(child)"," return None if found is None else found.get(name)","shares = [f for f in devices.findall('filesystem') if attr(f, 'target', 'dir') == tag]","memory_ok = attr(backing, 'source', 'type') == 'memfd' and attr(backing, 'access', 'mode') == 'shared'","share_ok = len(shares) == 1 and attr(shares[0], 'source', 'dir') == view and attr(shares[0], 'driver', 'type') == 'virtiofs'","if memory_ok and share_ok:"," sys.exit(3)","if backing is None:"," backing = ET.SubElement(domain, 'memoryBacking')","for old in [c for c in backing if c.tag in ('source', 'access')]:"," backing.remove(old)","ET.SubElement(backing, 'source', type='memfd')","ET.SubElement(backing, 'access', mode='shared')","for old in shares:"," devices.remove(old)","share = ET.SubElement(devices, 'filesystem', type='mount', accessmode='passthrough')","ET.SubElement(share, 'driver', type='virtiofs')","ET.SubElement(share, 'source', dir=view)","ET.SubElement(share, 'target', dir=tag)","sys.stdout.write(ET.tostring(domain, encoding='unicode'))"].join(`
378
378
  `);s(D$,"libraryShare");s(tx,"ensureLibraryShare");s(j$,"ensureLibvirtStation");s(L$,"pinLease");s(rx,"buildLinux")});import{dirname as QP,join as nx}from"node:path";function ox(e,t,r){return e.find(n=>n.kind===t&&n.name===r)}function ix(e){return e.filter(t=>t.kind==="station"&&t.table.server!==void 0&&!ox(e,"server",t.table.server)).map(t=>`station ${t.name} runs on server ${t.table.server}, but Orbit has no server record ${t.table.server}: add it with bb orbit station set ${t.table.server} --server --set driver=aws --set region=\u2026 --set vms=true (or correct the station's server with bb orbit station set ${t.name} --set server=<name>)`)}function V$(e){let t=ix(e);if(t.length)throw new Oe(t.join(`
379
379
  `))}var rI,U$=P(()=>{"use strict";Et();it();rI=nx(ce,"machine-records.json");s(ox,"findRecord");s(ix,"missingServerRecords");s(V$,"checkServerRecords")});var H$={};ve(H$,{TERRAFORM_DIR:()=>gs,TFVARS_FILE:()=>J$,awsArgs:()=>W$,awsFirewallRules:()=>dx,awsInfo:()=>q$,awsTfvars:()=>G$,buildAws:()=>fx,provisionAws:()=>px});import{spawn as sx}from"node:child_process";import{existsSync as Lp}from"node:fs";import{mkdir as K$,readFile as ax,writeFile as cx}from"node:fs/promises";import{join as jp}from"node:path";function W$(e){return[...e.region?["--region",e.region]:[],...e.profile?["--profile",e.profile]:[]]}async function Fp(e,t){let r=await ue("aws",[...W$(e),...t,"--output","json"]);if(r.code!==0)throw new E(`aws ${t.slice(0,2).join(" ")} failed: ${r.stderr.trim()||r.stdout.trim()}`);return r.stdout.trim()?ps(r.stdout,"AWS response"):void 0}async function ux(e){let r=(await Fp(e,["ec2","describe-instances","--filters",`Name=tag:Name,Values=${e.name}`,`Name=tag:orbit,Values=${e.role??"station"}`,"Name=instance-state-name,Values=pending,running,stopping,stopped"])).Reservations.flatMap(n=>n.Instances);if(r.length>1)throw new E(`${e.name}: ${r.length} instances in AWS carry its name; expected one (${r.map(n=>n.InstanceId).join(", ")})`);return r[0]}async function q$(e){let t=await ux(e);if(t)return{status:t.State.Name,ipAddress:t.PrivateIpAddress,id:t.InstanceId}}async function lx(e,t){return(await Fp(e,["ssm","describe-instance-information","--filters",`Key=InstanceIds,Values=${t}`])).InstanceInformationList.some(n=>n.PingStatus==="Online")}async function fx(e,t){let r=e.station,n=s(u=>X.log(` ${u}`),"log");if(X.log(`${r.name} (${r.role==="server"?"host, ":""}EC2${r.region?`, ${r.region}`:""})`),await K$(ce,{recursive:!0,mode:448}),!Lp(ae)){let u=await ue("ssh-keygen",["-q","-t","ed25519","-N","","-C","orbit station admin","-f",ae]);if(u.code!==0)throw new E(`ssh-keygen failed: ${u.stderr.trim()}`);n(`made Orbit's station key (${ae}); Terraform puts its public half on new instances`)}let o=await q$(r);if(!o?.id)throw new E(`${r.name} has no instance in AWS; make it first: pnpm orbit station provision (its record: bb orbit station show ${r.name}${r.role==="server"?" --server":""})`);(o.status==="stopped"||o.status==="stopping")&&(n(`starting ${r.name} (${o.id})`),await Fp(r,["ec2","start-instances","--instance-ids",o.id])),n(`waiting for Session Manager to reach ${o.id}`);let i=Date.now()+6e5;for(;!await lx(r,o.id);){if(Date.now()>i)throw new E(`${r.name}'s SSM agent didn't check in within 10 minutes (is its instance profile orbit-${r.name}, and was the agent restarted after a role change?)`);await new Promise(u=>setTimeout(u,5e3))}n("waiting for ssh");let a=await _e.waitFor(r,600);if(!a)throw new E(`${r.name} didn't answer ssh through Session Manager within 10 minutes`);await a.exec({as:"root",script:"cloud-init status --wait >/dev/null 2>&1 || true"});let c=await kr(a,vr(e),!1);return c!==0?c:kr(a,vr(t),!1)}function G$(e,t,r){let n=[...e,...t].filter(p=>p.driver==="aws"),o=new Set(e.filter(p=>p.driver==="aws").map(p=>p.name)),i=t.filter(p=>p.driver==="aws"&&o.has(p.name)).map(p=>p.name);if(i.length>0)throw new E(`a station and a server in AWS can't share a name: each box's security group, role and instance profile are orbit-<name> (${i.join(", ")} is both)`);if(n.some(p=>p.name==="station"))throw new E("a station or server in AWS can't be named station: orbit-station is the shared security group, role and instance profile an account from before each box had its own still has, and the box's own would collide with them");let a=n[0];if(!a)throw new E('no station or server record in Orbit says driver = "aws"; nothing to provision');let c=s(p=>{if(new Set(n.map(m=>m[p]??"")).size>1)throw new E(`the stations in AWS must share one ${p} (${gs} is one account and region): ${n.map(m=>`${m.name}: ${m[p]??"unset"}`).join(", ")}`);return a[p]},"one"),u=c("region"),l=c("profile"),f=s(p=>({...p.instance_type?{instance_type:p.instance_type}:{},...p.disk_gb?{disk_gb:p.disk_gb}:{},...p.vms?{nested_virtualization:!0}:{}}),"size");return{...u?{region:u}:{},...l?{profile:l}:{},admin_user:a.admin_user,admin_public_key:r.trim(),stations:Object.fromEntries(e.filter(p=>p.driver==="aws").map(p=>[p.name,f(p)])),servers:Object.fromEntries(t.filter(p=>p.driver==="aws").map(p=>{let d=e.filter(m=>m.server===p.name).map(m=>m.name);return[p.name,{...f(p),...d.length?{stations:d}:{}}]}))}}function B$(e,t){return new Promise((r,n)=>{let o=sx("terraform",[`-chdir=${e}`,...t],{stdio:["inherit","pipe","pipe"]});k$(o),o.on("error",i=>n(new E(`terraform: ${i.message} (is Terraform installed?)`))),o.on("close",i=>r(i??1))})}async function px(e,t,r){V$(r);let n=await Promise.all(r.filter(l=>l.kind==="station").map(async l=>(await Op(e,"base",[],l.name,l.table)).station)),o=await Promise.all(r.filter(l=>l.kind==="server").map(async l=>(await us(e,l.name,l.table)).station));if(await K$(ce,{recursive:!0,mode:448}),!Lp(ae)){let l=await ue("ssh-keygen",["-q","-t","ed25519","-N","","-C","orbit station admin","-f",ae]);if(l.code!==0)throw new E(`ssh-keygen failed: ${l.stderr.trim()}`);X.log(` made Orbit's station key (${ae}); new instances get its public half`)}let i=G$(n,o,await ax(`${ae}.pub`,"utf8")),a=jp(e,gs);await cx(jp(a,J$),`${JSON.stringify(i,null,2)}
380
- `);let c=Object.keys(i.stations),u=Object.keys(i.servers);if(X.log(`${gs}: ${c.length===1?"1 station":`${c.length} stations`} from Orbit's station records (${c.join(", ")||"none"}), ${u.length===1?"1 host":`${u.length} hosts`} from its server records (${u.join(", ")||"none"})`),!Lp(jp(a,".terraform"))){let l=await B$(a,["init","-input=false"]);if(l!==0)return l}return B$(a,t?["plan","-input=false"]:["apply"])}function dx(e){return[`ip daddr { ${e.replace(/\.0\/24$/,".2")}, 169.254.169.253 } meta l4proto { tcp, udp } th dport 53 accept`,'ip daddr 169.254.169.254 meta skuid "root" accept',"ip daddr 169.254.169.123 udp dport 123 accept",'meta skuid "root" tcp dport 443 accept']}var gs,J$,X$=P(()=>{"use strict";Ce();Ce();Ce();Tp();Et();U$();it();ot();gs="orbit/infra/aws",J$="stations.auto.tfvars.json";s(W$,"awsArgs");s(Fp,"aws");s(ux,"instanceOf");s(q$,"awsInfo");s(lx,"ssmOnline");s(fx,"buildAws");s(G$,"awsTfvars");s(B$,"terraform");s(px,"provisionAws");s(dx,"awsFirewallRules")});import{spawn as Q$}from"node:child_process";import{existsSync as mx}from"node:fs";import{homedir as ey}from"node:os";import{join as ys}from"node:path";function ue(e,t,r="",n){if(Cp(t))throw new E("refusing to put a secret in command arguments");return new Promise((o,i)=>{let a=e==="ssh"&&ty?["-o","StrictHostKeyChecking=yes","-o","UpdateHostKeys=no","-o","ControlMaster=no","-o","ControlPath=none",...t]:t,c=Q$(e,a,{stdio:["pipe","pipe","pipe"],env:n??process.env}),u="",l="";c.stdout.on("data",f=>u+=f),c.stderr.on("data",f=>l+=f),c.on("error",i),c.on("close",f=>o({code:f??1,stdout:u,stderr:l})),c.stdin.on("error",()=>{}),c.stdin.end(r)})}function hx(){let e=ys(ey(),".local","bin","lume");return process.env.LUME??(mx(e)?e:"lume")}async function gx(e){let t=await ue(hx(),["get",e,"--format","json"]);if(t.code!==0){if(/not found|does not exist/i.test(t.stderr+t.stdout))return;throw new E(`lume get ${e} failed (exit ${t.code}); VM output is withheld because it may contain credentials`)}let r=t.stdout.search(/^[[{]/m),n=ps(r>=0?t.stdout.slice(r):t.stdout,`lume get ${e}`),o=Array.isArray(n)?n[0]:n;if(o?.vncUrl){nt(o.vncUrl);let i;try{i=new URL(o.vncUrl)}catch{throw new E(`lume get ${e} returned an invalid VNC address; contents withheld`)}nt(decodeURIComponent(i.password))}return o}async function Sr(e){if(e.driver==="libvirt"){let{libvirtInfo:t}=await Promise.resolve().then(()=>(M$(),F$));return t(e)}if(e.driver==="aws"){let{awsInfo:t}=await Promise.resolve().then(()=>(X$(),H$));return t(e)}return gx(e.name)}async function $x(e){let t=await Sr(e);if(t?.status!=="running"||!t.ipAddress){let r={libvirt:`virsh -c qemu:///system start ${e.name} (on ${e.server??e.hypervisor})`,aws:`orbit station build --station ${e.name}`,lume:`lume run ${e.name} --detach --display none`}[e.driver??"lume"];throw new E(`${e.name} isn't running (status: ${t?.status??"no such VM"}). Start it with: ${r}`)}return{host:t.id??t.ipAddress,address:t.ipAddress}}function yx(e){return["aws",...[...e.region?["--region",e.region]:[],...e.profile?["--profile",e.profile]:[]],"ssm","start-session","--target","%h","--document-name","AWS-StartSSHSession","--parameters","portNumber=%p"].join(" ")}function Mp(e){return e.driver==="libvirt"&&!e.server?{jump:e.hypervisor}:e.driver==="aws"?{proxyCommand:yx(e)}:{}}async function $s(e){if(e.driver!=="libvirt"||!e.server)return Mp(e);let{serverProxyCommand:t}=await Promise.resolve().then(()=>(hs(),ry)),r=await t(e);return r?{proxyCommand:r}:{}}function Y$(e){return`/usr/bin/env XDG_RUNTIME_DIR=/run/user/$(id -u ${e}) DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u ${e})/bus`}function Tt(e={},t=ty){return[...e.jump?["-o",`ProxyJump=${e.jump}`]:[],...e.proxyCommand?["-o",`ProxyCommand=${e.proxyCommand}`]:[],"-i",ae,"-o","IdentitiesOnly=yes","-o","BatchMode=yes","-o","ConnectTimeout=10","-o",t?"StrictHostKeyChecking=yes":"StrictHostKeyChecking=accept-new",...t?["-o","UpdateHostKeys=no","-o","ControlMaster=no","-o","ControlPath=none"]:[],"-o",`UserKnownHostsFile=${ys(ce,"known_hosts")}`]}var ce,ae,E,ty,_e,it=P(()=>{"use strict";Ce();Ce();ot();ce=ys(ey(),".config","orbit"),ae=ys(ce,"station_ed25519"),E=class extends Error{static{s(this,"StationError")}constructor(t){super(we(t))}},ty=!1;s(ue,"run");s(hx,"lume");s(gx,"vmInfo");s(Sr,"vmInfoFor");s($x,"address_");s(yx,"ssmProxyCommand");s(Mp,"sshVia");s($s,"sshViaFor");_e=class e{static{s(this,"Station")}name;host;address;admin;desktopUser;os;via;readOnly=!1;constructor(t,r,n,o){this.name=t.name,this.host=r,this.address=n,this.admin=t.admin_user,this.desktopUser=t.desktop_user,this.os=t.os,this.via=o}static async connect(t,r=!1){let{host:n,address:o}=await $x(t),i=new e(t,n,o,await $s(t));return i.readOnly=r,i}static async waitFor(t,r=180){let n=Date.now()+r*1e3;for(;Date.now()<n;){let o=await Sr(t);if(o?.status==="running"&&o.ipAddress){let i=new e(t,o.id??o.ipAddress,o.ipAddress,await $s(t));if((await i.exec({as:"root",script:"id -u"})).stdout.trim()==="0")return i}await new Promise(i=>setTimeout(i,3e3))}}async exec(t){let r=k(this.desktopUser),n={root:"sudo -n /bin/bash -s",admin:"/bin/bash -l -s",orbit:this.os==="linux"?`sudo -n -u ${r} -H ${Y$(r)} /bin/bash -s`:`if [ "$(stat -f %Su /dev/console)" = ${r} ]; then sudo -n launchctl asuser "$(id -u ${r})" sudo -n -u ${r} -H /bin/bash -s; else sudo -n -u ${r} -H /bin/bash -s; fi`}[t.as];for(let o=1;;o++){let i=await ue("ssh",[...Tt(this.via,this.readOnly),`${this.admin}@${this.host}`,`cd / && ${n}`],t.script);if(!(i.code===255&&i.stdout===""&&/Connection (closed|refused|reset)|timed out/.test(i.stderr))||o>=6)return i;await new Promise(c=>setTimeout(c,1e4))}}run(t){if(Cp(t.argv))throw new E("refusing to put a secret in command arguments");let r=k(this.desktopUser),n=t.argv.map(k).join(" "),o=this.os==="linux"?`cd / && exec sudo -n -u ${r} -H ${Y$(r)} PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin ${n}`:`cd / && if [ "$(stat -f %Su /dev/console)" = ${r} ]; then exec sudo -n launchctl asuser "$(id -u ${r})" sudo -n -u ${r} -H /usr/bin/env PATH=/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin ${n}; else exec sudo -n -u ${r} -H /usr/bin/env PATH=/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin ${n}; fi`;return new Promise((i,a)=>{let c=Q$("ssh",[...Tt(this.via),`${this.admin}@${this.host}`,o],{stdio:["pipe","pipe","pipe"]}),u=s(()=>c.kill("SIGTERM"),"stop"),l=setTimeout(u,t.timeoutMs);t.signal.addEventListener("abort",u,{once:!0});let f=Tn(t.onOutput),p=Tn(t.onOutput);c.stdout.on("data",d=>f.write(d)),c.stderr.on("data",d=>p.write(d)),c.on("error",a),c.on("close",d=>{f.end(),p.end(),clearTimeout(l),t.signal.removeEventListener("abort",u),i(d??1)}),c.stdin.end(t.stdin)})}};s(Y$,"userSession");s(Tt,"sshOptions")});var ry={};ve(ry,{BUCKET_PATH:()=>xr,HOST_LIBRARY_SOURCES:()=>Kp,HOST_MARKER:()=>Up,LIBRARY_ROOT:()=>Dp,LIBRARY_TAG:()=>Nt,SHARE_ROOT:()=>Rn,hostLibrarySource:()=>wx,onHost:()=>jn,onHostItself:()=>bs,repoDir:()=>iy,serverOf:()=>Dn,serverProxyCommand:()=>bx,useServerRecord:()=>Jp});import{existsSync as Vp,readFileSync as oy}from"node:fs";import{join as ny}from"node:path";function iy(){let e=ny(ce,"repo"),t=Vp(e)?oy(e,"utf8").trim():"";if(!t||!Vp(ny(t,"orbit","config")))throw new E("this machine has no Orbit repository on record: run any `pnpm orbit \u2026` command in it once");return t}function Jp(e,t){t?Bp.set(e,t):Bp.delete(e)}async function Dn(e,t=iy){if(!e.server)throw new E(`${e.name}: a station on a host needs \`server\` (a name in orbit/config/servers/)`);let r=(await us(t(),e.server,Bp.get(e.server))).station;if(!r.vms)throw new E(`${e.name}: its server ${r.name} doesn't carry station VMs; set \`vms = true\` in orbit/config/servers/${r.name}.toml and run orbit server build`);return r}function bs(e){return Vp(Up)&&oy(Up,"utf8").trim()===e.name}async function jn(e,t,r=""){if(bs(e))return ue("/bin/bash",["-c",t],r);let n=await _e.connect(e);return ue("ssh",[...Tt(n.via),`${n.admin}@${n.host}`,`bash -c ${k(t)}`],r)}async function bx(e){let t=await Dn(e);if(bs(t))return;let r=await _e.connect(t);return["ssh",...[...r.via.proxyCommand?["-o",`ProxyCommand=${r.via.proxyCommand.replaceAll("%h",r.host).replaceAll("%p","22")}`]:r.via.jump?["-o",`ProxyJump=${r.via.jump}`]:[],...Tt({}),`${r.admin}@${r.host}`,"-W","%h:%p"].map(k)].join(" ")}async function wx(e,t){let r=await Dn(e),n=`${Kp}/${e.name}.conf`,o=(bs(r),"sudo -n");if(!t){let c=await jn(r,`${o} rm -f ${k(n)} && echo removed`);if(c.code!==0)throw new E(`removing ${e.name}'s library source on ${r.name} failed: ${(c.stderr||c.stdout).trim()}`);return`no library source: ${r.name} pulls nothing for ${e.name}`}if(t.item)throw new E(`${e.name}: the library's source names a vault item (${t.item}), which its host can't read yet; use a source the host's instance role or plain options reach`);let i=`# Orbit: ${e.name}'s library source (orbit station policy). Changes here don't last.
380
+ `);let c=Object.keys(i.stations),u=Object.keys(i.servers);if(X.log(`${gs}: ${c.length===1?"1 station":`${c.length} stations`} from Orbit's station records (${c.join(", ")||"none"}), ${u.length===1?"1 host":`${u.length} hosts`} from its server records (${u.join(", ")||"none"})`),!Lp(jp(a,".terraform"))){let l=await B$(a,["init","-input=false"]);if(l!==0)return l}return B$(a,t?["plan","-input=false"]:["apply"])}function dx(e){return[`ip daddr { ${e.replace(/\.0\/24$/,".2")}, 169.254.169.253 } meta l4proto { tcp, udp } th dport 53 accept`,'ip daddr 169.254.169.254 meta skuid "root" accept',"ip daddr 169.254.169.123 udp dport 123 accept",'meta skuid "root" tcp dport 443 accept']}var gs,J$,X$=P(()=>{"use strict";Ce();Ce();Ce();Tp();Et();U$();it();ot();gs="orbit/infra/aws",J$="stations.auto.tfvars.json";s(W$,"awsArgs");s(Fp,"aws");s(ux,"instanceOf");s(q$,"awsInfo");s(lx,"ssmOnline");s(fx,"buildAws");s(G$,"awsTfvars");s(B$,"terraform");s(px,"provisionAws");s(dx,"awsFirewallRules")});import{spawn as Q$}from"node:child_process";import{existsSync as mx}from"node:fs";import{homedir as ey}from"node:os";import{join as ys}from"node:path";function ue(e,t,r="",n){if(Cp(t))throw new E("refusing to put a secret in command arguments");return new Promise((o,i)=>{let a=e==="ssh"&&ty?["-o","StrictHostKeyChecking=yes","-o","UpdateHostKeys=no","-o","ControlMaster=no","-o","ControlPath=none",...t]:t,c=Q$(e,a,{stdio:["pipe","pipe","pipe"],env:n??process.env}),u="",l="";c.stdout.on("data",f=>u+=f),c.stderr.on("data",f=>l+=f),c.on("error",i),c.on("close",f=>o({code:f??1,stdout:u,stderr:l})),c.stdin.on("error",()=>{}),c.stdin.end(r)})}function hx(){let e=ys(ey(),".local","bin","lume");return process.env.LUME??(mx(e)?e:"lume")}async function gx(e){let t=await ue(hx(),["get",e,"--format","json"]);if(t.code!==0){if(/not found|does not exist/i.test(t.stderr+t.stdout))return;throw new E(`lume get ${e} failed (exit ${t.code}); VM output is withheld because it may contain credentials`)}let r=t.stdout.search(/^[[{]/m),n=ps(r>=0?t.stdout.slice(r):t.stdout,`lume get ${e}`),o=Array.isArray(n)?n[0]:n;if(o?.vncUrl){nt(o.vncUrl);let i;try{i=new URL(o.vncUrl)}catch{throw new E(`lume get ${e} returned an invalid VNC address; contents withheld`)}nt(decodeURIComponent(i.password))}return o}async function Sr(e){if(e.driver==="libvirt"){let{libvirtInfo:t}=await Promise.resolve().then(()=>(M$(),F$));return t(e)}if(e.driver==="aws"){let{awsInfo:t}=await Promise.resolve().then(()=>(X$(),H$));return t(e)}return gx(e.name)}async function $x(e){let t=await Sr(e);if(t?.status!=="running"||!t.ipAddress){let r={libvirt:`virsh -c qemu:///system start ${e.name} (on ${e.server??e.hypervisor})`,aws:`orbit station build --station ${e.name}`,lume:`lume run ${e.name} --detach --display none`}[e.driver??"lume"];throw new E(`${e.name} isn't running (status: ${t?.status??"no such VM"}). Start it with: ${r}`)}return{host:t.id??t.ipAddress,address:t.ipAddress}}function yx(e){return["aws",...[...e.region?["--region",e.region]:[],...e.profile?["--profile",e.profile]:[]],"ssm","start-session","--target","%h","--document-name","AWS-StartSSHSession","--parameters","portNumber=%p"].join(" ")}function Mp(e){return e.driver==="libvirt"&&!e.server?{jump:e.hypervisor}:e.driver==="aws"?{proxyCommand:yx(e)}:{}}async function $s(e){if(e.driver!=="libvirt"||!e.server)return Mp(e);let{serverProxyCommand:t}=await Promise.resolve().then(()=>(hs(),ry)),r=await t(e);return r?{proxyCommand:r}:{}}function Y$(e){return`/usr/bin/env XDG_RUNTIME_DIR=/run/user/$(id -u ${e}) DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u ${e})/bus`}function Tt(e={},t=ty){return[...e.jump?["-o",`ProxyJump=${e.jump}`]:[],...e.proxyCommand?["-o",`ProxyCommand=${e.proxyCommand}`]:[],"-i",ae,"-o","IdentitiesOnly=yes","-o","BatchMode=yes","-o","ConnectTimeout=10","-o",t?"StrictHostKeyChecking=yes":"StrictHostKeyChecking=accept-new",...t?["-o","UpdateHostKeys=no","-o","ControlMaster=no","-o","ControlPath=none"]:[],"-o",`UserKnownHostsFile=${ys(ce,"known_hosts")}`]}var ce,ae,E,ty,_e,it=P(()=>{"use strict";Ce();Ce();ot();ce=ys(ey(),".config","orbit"),ae=ys(ce,"station_ed25519"),E=class extends Error{static{s(this,"StationError")}constructor(t){super(we(t))}},ty=!1;s(ue,"run");s(hx,"lume");s(gx,"vmInfo");s(Sr,"vmInfoFor");s($x,"address_");s(yx,"ssmProxyCommand");s(Mp,"sshVia");s($s,"sshViaFor");_e=class e{static{s(this,"Station")}name;host;address;admin;desktopUser;os;via;readOnly=!1;constructor(t,r,n,o){this.name=t.name,this.host=r,this.address=n,this.admin=t.admin_user,this.desktopUser=t.desktop_user,this.os=t.os,this.via=o}static async connect(t,r=!1){let{host:n,address:o}=await $x(t),i=new e(t,n,o,await $s(t));return i.readOnly=r,i}static async waitFor(t,r=180){let n=Date.now()+r*1e3;for(;Date.now()<n;){let o=await Sr(t);if(o?.status==="running"&&o.ipAddress){let i=new e(t,o.id??o.ipAddress,o.ipAddress,await $s(t));if((await i.exec({as:"root",script:"id -u"})).stdout.trim()==="0")return i}await new Promise(i=>setTimeout(i,3e3))}}async exec(t){let r=k(this.desktopUser),n={root:"sudo -n /bin/bash -s",admin:"/bin/bash -l -s",orbit:this.os==="linux"?`sudo -n -u ${r} -H ${Y$(r)} /bin/bash -s`:`if [ "$(stat -f %Su /dev/console)" = ${r} ]; then sudo -n launchctl asuser "$(id -u ${r})" sudo -n -u ${r} -H /bin/bash -s; else sudo -n -u ${r} -H /bin/bash -s; fi`}[t.as],o=t.as==="orbit"&&this.os==="linux"?`if [ -f /etc/profile.d/orbit-outbound.sh ]; then . /etc/profile.d/orbit-outbound.sh || exit $?; fi
381
+ ${t.script}`:t.script;for(let i=1;;i++){let a=await ue("ssh",[...Tt(this.via,this.readOnly),`${this.admin}@${this.host}`,`cd / && ${n}`],o);if(!(a.code===255&&a.stdout===""&&/Connection (closed|refused|reset)|timed out/.test(a.stderr))||i>=6)return a;await new Promise(u=>setTimeout(u,1e4))}}run(t){if(Cp(t.argv))throw new E("refusing to put a secret in command arguments");let r=k(this.desktopUser),n=t.argv.map(k).join(" "),o=this.os==="linux"?`cd / && exec sudo -n -u ${r} -H ${Y$(r)} PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin ${n}`:`cd / && if [ "$(stat -f %Su /dev/console)" = ${r} ]; then exec sudo -n launchctl asuser "$(id -u ${r})" sudo -n -u ${r} -H /usr/bin/env PATH=/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin ${n}; else exec sudo -n -u ${r} -H /usr/bin/env PATH=/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin ${n}; fi`;return new Promise((i,a)=>{let c=Q$("ssh",[...Tt(this.via),`${this.admin}@${this.host}`,o],{stdio:["pipe","pipe","pipe"]}),u=s(()=>c.kill("SIGTERM"),"stop"),l=setTimeout(u,t.timeoutMs);t.signal.addEventListener("abort",u,{once:!0});let f=Tn(t.onOutput),p=Tn(t.onOutput);c.stdout.on("data",d=>f.write(d)),c.stderr.on("data",d=>p.write(d)),c.on("error",a),c.on("close",d=>{f.end(),p.end(),clearTimeout(l),t.signal.removeEventListener("abort",u),i(d??1)}),c.stdin.end(t.stdin)})}};s(Y$,"userSession");s(Tt,"sshOptions")});var ry={};ve(ry,{BUCKET_PATH:()=>xr,HOST_LIBRARY_SOURCES:()=>Kp,HOST_MARKER:()=>Up,LIBRARY_ROOT:()=>Dp,LIBRARY_TAG:()=>Nt,SHARE_ROOT:()=>Rn,hostLibrarySource:()=>wx,onHost:()=>jn,onHostItself:()=>bs,repoDir:()=>iy,serverOf:()=>Dn,serverProxyCommand:()=>bx,useServerRecord:()=>Jp});import{existsSync as Vp,readFileSync as oy}from"node:fs";import{join as ny}from"node:path";function iy(){let e=ny(ce,"repo"),t=Vp(e)?oy(e,"utf8").trim():"";if(!t||!Vp(ny(t,"orbit","config")))throw new E("this machine has no Orbit repository on record: run any `pnpm orbit \u2026` command in it once");return t}function Jp(e,t){t?Bp.set(e,t):Bp.delete(e)}async function Dn(e,t=iy){if(!e.server)throw new E(`${e.name}: a station on a host needs \`server\` (a name in orbit/config/servers/)`);let r=(await us(t(),e.server,Bp.get(e.server))).station;if(!r.vms)throw new E(`${e.name}: its server ${r.name} doesn't carry station VMs; set \`vms = true\` in orbit/config/servers/${r.name}.toml and run orbit server build`);return r}function bs(e){return Vp(Up)&&oy(Up,"utf8").trim()===e.name}async function jn(e,t,r=""){if(bs(e))return ue("/bin/bash",["-c",t],r);let n=await _e.connect(e);return ue("ssh",[...Tt(n.via),`${n.admin}@${n.host}`,`bash -c ${k(t)}`],r)}async function bx(e){let t=await Dn(e);if(bs(t))return;let r=await _e.connect(t);return["ssh",...[...r.via.proxyCommand?["-o",`ProxyCommand=${r.via.proxyCommand.replaceAll("%h",r.host).replaceAll("%p","22")}`]:r.via.jump?["-o",`ProxyJump=${r.via.jump}`]:[],...Tt({}),`${r.admin}@${r.host}`,"-W","%h:%p"].map(k)].join(" ")}async function wx(e,t){let r=await Dn(e),n=`${Kp}/${e.name}.conf`,o=(bs(r),"sudo -n");if(!t){let c=await jn(r,`${o} rm -f ${k(n)} && echo removed`);if(c.code!==0)throw new E(`removing ${e.name}'s library source on ${r.name} failed: ${(c.stderr||c.stdout).trim()}`);return`no library source: ${r.name} pulls nothing for ${e.name}`}if(t.item)throw new E(`${e.name}: the library's source names a vault item (${t.item}), which its host can't read yet; use a source the host's instance role or plain options reach`);let i=`# Orbit: ${e.name}'s library source (orbit station policy). Changes here don't last.
381
382
  # path: ${t.path}
382
383
  ${t.config}`,a=await jn(r,`set -euo pipefail
383
384
  ${o} install -d -o root -g root -m 700 ${Kp}
@@ -8,5 +8,5 @@
8
8
  "bbVersion": "0.47.0",
9
9
  "pluginSdkVersion": "0.6.79"
10
10
  },
11
- "artifactDigest": "ac8d8c074083d9d21bad4264cff9a672dc7a9bd50475b8a31216cf24d7ac0cb5"
11
+ "artifactDigest": "6cdd762dcaaaf490f7f0ac9eb13885315194f4cccff79ee9f70a55d74f500aba"
12
12
  }