@bytetrue/byspace 0.14.6 → 0.16.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.
Files changed (90) hide show
  1. package/dist/commands/daemon/index.js +16 -0
  2. package/dist/commands/daemon/install-service.d.ts +15 -0
  3. package/dist/commands/daemon/install-service.js +69 -0
  4. package/dist/commands/daemon/local-daemon.d.ts +1 -0
  5. package/dist/commands/daemon/local-daemon.js +1 -1
  6. package/dist/commands/daemon/service/backend.d.ts +16 -0
  7. package/dist/commands/daemon/service/backend.js +50 -0
  8. package/dist/commands/daemon/service/launchd.d.ts +15 -0
  9. package/dist/commands/daemon/service/launchd.js +101 -0
  10. package/dist/commands/daemon/service/service-spec.d.ts +54 -0
  11. package/dist/commands/daemon/service/service-spec.js +95 -0
  12. package/dist/commands/daemon/service/service-status.d.ts +28 -0
  13. package/dist/commands/daemon/service/service-status.js +32 -0
  14. package/dist/commands/daemon/service/systemd.d.ts +22 -0
  15. package/dist/commands/daemon/service/systemd.js +90 -0
  16. package/dist/commands/daemon/service/windows-task.d.ts +12 -0
  17. package/dist/commands/daemon/service/windows-task.js +75 -0
  18. package/dist/commands/daemon/service-status.d.ts +13 -0
  19. package/dist/commands/daemon/service-status.js +30 -0
  20. package/dist/commands/daemon/uninstall-service.d.ts +11 -0
  21. package/dist/commands/daemon/uninstall-service.js +53 -0
  22. package/node_modules/@bytetrue/client/package.json +3 -3
  23. package/node_modules/@bytetrue/highlight/package.json +1 -1
  24. package/node_modules/@bytetrue/protocol/dist/generated/validation/ws-outbound.aot.js +10901 -10861
  25. package/node_modules/@bytetrue/protocol/dist/messages.d.ts +231 -92
  26. package/node_modules/@bytetrue/protocol/dist/messages.js +29 -0
  27. package/node_modules/@bytetrue/protocol/dist/validation/ws-outbound-schema-metadata.d.ts +44 -22
  28. package/node_modules/@bytetrue/protocol/package.json +1 -1
  29. package/node_modules/@bytetrue/relay/package.json +1 -1
  30. package/node_modules/@bytetrue/server/dist/server/server/byspace-env.d.ts +1 -0
  31. package/node_modules/@bytetrue/server/dist/server/server/byspace-env.js +9 -0
  32. package/node_modules/@bytetrue/server/dist/server/server/daemon-config-store.d.ts +11 -0
  33. package/node_modules/@bytetrue/server/dist/server/server/daemon-config-store.js +71 -1
  34. package/node_modules/@bytetrue/server/dist/server/server/session/daemon/daemon-service-install.d.ts +25 -0
  35. package/node_modules/@bytetrue/server/dist/server/server/session/daemon/daemon-service-install.js +182 -0
  36. package/node_modules/@bytetrue/server/dist/server/server/session/daemon/daemon-service-manager.d.ts +21 -0
  37. package/node_modules/@bytetrue/server/dist/server/server/session/daemon/daemon-service-manager.js +154 -0
  38. package/node_modules/@bytetrue/server/dist/server/server/websocket-server.js +2 -0
  39. package/node_modules/@bytetrue/server/dist/server/terminal/agent-hooks/pi/pi-extension.d.ts +1 -1
  40. package/node_modules/@bytetrue/server/dist/server/terminal/agent-hooks/pi/pi-extension.js +16 -1
  41. package/node_modules/@bytetrue/server/dist/server/terminal/terminal.js +6 -0
  42. package/node_modules/@bytetrue/server/dist/server/web-ui/_expo/static/js/web/{index-679e8946b965f52a7a27dc9c54f59a4c.js → index-eade2661e21bbc08a50d56f1c6b0917a.js} +537 -535
  43. package/node_modules/@bytetrue/server/dist/server/web-ui/_expo/static/js/web/index-eade2661e21bbc08a50d56f1c6b0917a.js.br +0 -0
  44. package/node_modules/@bytetrue/server/dist/server/web-ui/_expo/static/js/web/index-eade2661e21bbc08a50d56f1c6b0917a.js.gz +0 -0
  45. package/node_modules/@bytetrue/server/dist/server/web-ui/_expo/static/js/web/{indexeddb-attachment-store-d61d5dd974e90216cec99e62c343ffc7.js → indexeddb-attachment-store-a2e8491be0374dc2a52abfe002ecabe9.js} +1 -1
  46. package/node_modules/@bytetrue/server/dist/server/web-ui/_expo/static/js/web/{indexeddb-attachment-store-d61d5dd974e90216cec99e62c343ffc7.js.br → indexeddb-attachment-store-a2e8491be0374dc2a52abfe002ecabe9.js.br} +0 -0
  47. package/node_modules/@bytetrue/server/dist/server/web-ui/_expo/static/js/web/indexeddb-attachment-store-a2e8491be0374dc2a52abfe002ecabe9.js.gz +0 -0
  48. package/node_modules/@bytetrue/server/dist/server/web-ui/_expo/static/js/web/{native-file-attachment-store-df0c0ebe8d233a5a74eddb59a110f00b.js → native-file-attachment-store-6ba28513708667bbad7dd5434a0f8d5b.js} +3 -3
  49. package/node_modules/@bytetrue/server/dist/server/web-ui/_expo/static/js/web/native-file-attachment-store-6ba28513708667bbad7dd5434a0f8d5b.js.br +0 -0
  50. package/node_modules/@bytetrue/server/dist/server/web-ui/_expo/static/js/web/native-file-attachment-store-6ba28513708667bbad7dd5434a0f8d5b.js.gz +0 -0
  51. package/node_modules/@bytetrue/server/dist/server/web-ui/apple-touch-icon.png +0 -0
  52. package/node_modules/@bytetrue/server/dist/server/web-ui/assets/assets/images/favicon-dark-attention.9c2d51faf93468f68840811c0d9a8c6f.png +0 -0
  53. package/node_modules/@bytetrue/server/dist/server/web-ui/assets/assets/images/favicon-dark-running.a52155010955dca55546513b60bb2e2b.png +0 -0
  54. package/node_modules/@bytetrue/server/dist/server/web-ui/assets/assets/images/favicon-dark.ee7787d5c6bd1ad67c31b9949a832f7a.png +0 -0
  55. package/node_modules/@bytetrue/server/dist/server/web-ui/assets/assets/images/favicon-light-attention.9c2d51faf93468f68840811c0d9a8c6f.png +0 -0
  56. package/node_modules/@bytetrue/server/dist/server/web-ui/assets/assets/images/favicon-light-running.a52155010955dca55546513b60bb2e2b.png +0 -0
  57. package/node_modules/@bytetrue/server/dist/server/web-ui/assets/assets/images/favicon-light.ee7787d5c6bd1ad67c31b9949a832f7a.png +0 -0
  58. package/node_modules/@bytetrue/server/dist/server/web-ui/assets/assets/images/notification-icon.ba5a7dce236a7febe5d803b16f027b70.png +0 -0
  59. package/node_modules/@bytetrue/server/dist/server/web-ui/favicon.ico +0 -0
  60. package/node_modules/@bytetrue/server/dist/server/web-ui/index.html +1 -1
  61. package/node_modules/@bytetrue/server/dist/server/web-ui/index.html.br +0 -0
  62. package/node_modules/@bytetrue/server/dist/server/web-ui/index.html.gz +0 -0
  63. package/node_modules/@bytetrue/server/dist/server/web-ui/manifest.json +14 -2
  64. package/node_modules/@bytetrue/server/dist/server/web-ui/manifest.json.br +0 -0
  65. package/node_modules/@bytetrue/server/dist/server/web-ui/manifest.json.gz +0 -0
  66. package/node_modules/@bytetrue/server/dist/server/web-ui/pwa-icon-192.png +0 -0
  67. package/node_modules/@bytetrue/server/dist/server/web-ui/pwa-icon-512.png +0 -0
  68. package/node_modules/@bytetrue/server/dist/server/web-ui/pwa-maskable-192.png +0 -0
  69. package/node_modules/@bytetrue/server/dist/server/web-ui/pwa-maskable-512.png +0 -0
  70. package/node_modules/@bytetrue/server/dist/src/server/byspace-env.js +9 -0
  71. package/node_modules/@bytetrue/server/dist/src/server/daemon-config-store.js +71 -1
  72. package/node_modules/@bytetrue/server/dist/src/server/session/daemon/daemon-service-install.js +182 -0
  73. package/node_modules/@bytetrue/server/dist/src/server/session/daemon/daemon-service-manager.js +154 -0
  74. package/node_modules/@bytetrue/server/dist/src/server/session/daemon/install-origin.js +64 -0
  75. package/node_modules/@bytetrue/server/dist/src/server/session/daemon/npm-global-cli.js +98 -0
  76. package/node_modules/@bytetrue/server/dist/src/terminal/terminal.js +6 -0
  77. package/node_modules/@bytetrue/server/package.json +15 -5
  78. package/package.json +7 -7
  79. package/node_modules/@bytetrue/server/dist/server/web-ui/_expo/static/js/web/index-679e8946b965f52a7a27dc9c54f59a4c.js.br +0 -0
  80. package/node_modules/@bytetrue/server/dist/server/web-ui/_expo/static/js/web/index-679e8946b965f52a7a27dc9c54f59a4c.js.gz +0 -0
  81. package/node_modules/@bytetrue/server/dist/server/web-ui/_expo/static/js/web/indexeddb-attachment-store-d61d5dd974e90216cec99e62c343ffc7.js.gz +0 -0
  82. package/node_modules/@bytetrue/server/dist/server/web-ui/_expo/static/js/web/native-file-attachment-store-df0c0ebe8d233a5a74eddb59a110f00b.js.br +0 -0
  83. package/node_modules/@bytetrue/server/dist/server/web-ui/_expo/static/js/web/native-file-attachment-store-df0c0ebe8d233a5a74eddb59a110f00b.js.gz +0 -0
  84. package/node_modules/@bytetrue/server/dist/server/web-ui/assets/assets/images/favicon-dark-attention.882b3a27dcb2073e9e31b334f9ed9728.png +0 -0
  85. package/node_modules/@bytetrue/server/dist/server/web-ui/assets/assets/images/favicon-dark-running.8112342ff0d39e047a7f8d4fad9402f3.png +0 -0
  86. package/node_modules/@bytetrue/server/dist/server/web-ui/assets/assets/images/favicon-dark.8005ed36ac07a5a7c60de25780897bd4.png +0 -0
  87. package/node_modules/@bytetrue/server/dist/server/web-ui/assets/assets/images/favicon-light-attention.882b3a27dcb2073e9e31b334f9ed9728.png +0 -0
  88. package/node_modules/@bytetrue/server/dist/server/web-ui/assets/assets/images/favicon-light-running.8112342ff0d39e047a7f8d4fad9402f3.png +0 -0
  89. package/node_modules/@bytetrue/server/dist/server/web-ui/assets/assets/images/favicon-light.8005ed36ac07a5a7c60de25780897bd4.png +0 -0
  90. package/node_modules/@bytetrue/server/dist/server/web-ui/assets/assets/images/notification-icon.3bf81d33ddbf380606bdd248ba83e158.png +0 -0
@@ -191,6 +191,22 @@ export const MutableDaemonConfigSchema = z
191
191
  })
192
192
  .passthrough()
193
193
  .optional(),
194
+ // COMPAT(daemonServiceInstall): added in v0.14.7. Derived view of the OS service
195
+ // manager state; the daemon re-queries it lazily, never caches a stale verdict.
196
+ service: z
197
+ .object({
198
+ state: z.enum([
199
+ "not-installed",
200
+ "installed-stopped",
201
+ "installed-running-not-this-process",
202
+ "managed-by-service",
203
+ "unknown",
204
+ ]),
205
+ label: z.string(),
206
+ linger: z.boolean().optional(),
207
+ })
208
+ .passthrough()
209
+ .optional(),
194
210
  })
195
211
  .passthrough();
196
212
  export const MutableDaemonConfigPatchSchema = z
@@ -232,6 +248,15 @@ export const MutableDaemonConfigPatchSchema = z
232
248
  })
233
249
  .passthrough()
234
250
  .optional(),
251
+ // COMPAT(daemonServiceInstall): added in v0.14.7; old daemons drop these patches.
252
+ // Install/uninstall execute in the daemon process and need its install-origin
253
+ // context, so they ride the same config-patch pipe instead of a separate RPC.
254
+ service: z
255
+ .object({
256
+ install: z.boolean().optional(),
257
+ })
258
+ .passthrough()
259
+ .optional(),
235
260
  })
236
261
  .partial()
237
262
  .passthrough();
@@ -3207,6 +3232,10 @@ export const ServerInfoStatusPayloadSchema = z
3207
3232
  // Old daemons drop network/auth config patches silently, so clients must
3208
3233
  // hide the network settings instead of letting a save appear to succeed.
3209
3234
  daemonNetworkConfig: z.boolean().optional(),
3235
+ // COMPAT(daemonServiceInstall): added in v0.14.7. When false (or absent on
3236
+ // an older daemon), the app hides the service-management switch instead of
3237
+ // letting an install appear to succeed.
3238
+ daemonServiceInstall: z.boolean().optional(),
3210
3239
  })
3211
3240
  .optional(),
3212
3241
  })
@@ -1091,8 +1091,8 @@ export declare const WSOutboundMessageSchema: {
1091
1091
  scripts: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
1092
1092
  scriptName: import("zod").ZodString;
1093
1093
  type: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodEnum<{
1094
- script: "script";
1095
1094
  service: "service";
1095
+ script: "script";
1096
1096
  }>>>;
1097
1097
  hostname: import("zod").ZodString;
1098
1098
  port: import("zod").ZodNullable<import("zod").ZodNumber>;
@@ -1267,7 +1267,7 @@ export declare const WSOutboundMessageSchema: {
1267
1267
  activityAt: string | null;
1268
1268
  scripts: {
1269
1269
  scriptName: string;
1270
- type: "script" | "service";
1270
+ type: "service" | "script";
1271
1271
  hostname: string;
1272
1272
  port: number | null;
1273
1273
  proxyUrl: string | null;
@@ -1377,7 +1377,7 @@ export declare const WSOutboundMessageSchema: {
1377
1377
  activityAt: string | null;
1378
1378
  scripts: {
1379
1379
  scriptName: string;
1380
- type: "script" | "service";
1380
+ type: "service" | "script";
1381
1381
  hostname: string;
1382
1382
  port: number | null;
1383
1383
  proxyUrl: string | null;
@@ -1685,8 +1685,8 @@ export declare const WSOutboundMessageSchema: {
1685
1685
  scripts: import("zod").ZodArray<import("zod").ZodObject<{
1686
1686
  scriptName: import("zod").ZodString;
1687
1687
  type: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodEnum<{
1688
- script: "script";
1689
1688
  service: "service";
1689
+ script: "script";
1690
1690
  }>>>;
1691
1691
  hostname: import("zod").ZodString;
1692
1692
  port: import("zod").ZodNullable<import("zod").ZodNumber>;
@@ -2362,8 +2362,8 @@ export declare const WSOutboundMessageSchema: {
2362
2362
  scripts: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
2363
2363
  scriptName: import("zod").ZodString;
2364
2364
  type: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodEnum<{
2365
- script: "script";
2366
2365
  service: "service";
2366
+ script: "script";
2367
2367
  }>>>;
2368
2368
  hostname: import("zod").ZodString;
2369
2369
  port: import("zod").ZodNullable<import("zod").ZodNumber>;
@@ -2538,7 +2538,7 @@ export declare const WSOutboundMessageSchema: {
2538
2538
  activityAt: string | null;
2539
2539
  scripts: {
2540
2540
  scriptName: string;
2541
- type: "script" | "service";
2541
+ type: "service" | "script";
2542
2542
  hostname: string;
2543
2543
  port: number | null;
2544
2544
  proxyUrl: string | null;
@@ -2648,7 +2648,7 @@ export declare const WSOutboundMessageSchema: {
2648
2648
  activityAt: string | null;
2649
2649
  scripts: {
2650
2650
  scriptName: string;
2651
- type: "script" | "service";
2651
+ type: "service" | "script";
2652
2652
  hostname: string;
2653
2653
  port: number | null;
2654
2654
  proxyUrl: string | null;
@@ -2877,8 +2877,8 @@ export declare const WSOutboundMessageSchema: {
2877
2877
  scripts: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
2878
2878
  scriptName: import("zod").ZodString;
2879
2879
  type: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodEnum<{
2880
- script: "script";
2881
2880
  service: "service";
2881
+ script: "script";
2882
2882
  }>>>;
2883
2883
  hostname: import("zod").ZodString;
2884
2884
  port: import("zod").ZodNullable<import("zod").ZodNumber>;
@@ -3053,7 +3053,7 @@ export declare const WSOutboundMessageSchema: {
3053
3053
  activityAt: string | null;
3054
3054
  scripts: {
3055
3055
  scriptName: string;
3056
- type: "script" | "service";
3056
+ type: "service" | "script";
3057
3057
  hostname: string;
3058
3058
  port: number | null;
3059
3059
  proxyUrl: string | null;
@@ -3163,7 +3163,7 @@ export declare const WSOutboundMessageSchema: {
3163
3163
  activityAt: string | null;
3164
3164
  scripts: {
3165
3165
  scriptName: string;
3166
- type: "script" | "service";
3166
+ type: "service" | "script";
3167
3167
  hostname: string;
3168
3168
  port: number | null;
3169
3169
  proxyUrl: string | null;
@@ -3383,8 +3383,8 @@ export declare const WSOutboundMessageSchema: {
3383
3383
  script: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
3384
3384
  scriptName: import("zod").ZodString;
3385
3385
  type: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodEnum<{
3386
- script: "script";
3387
3386
  service: "service";
3387
+ script: "script";
3388
3388
  }>>>;
3389
3389
  hostname: import("zod").ZodString;
3390
3390
  port: import("zod").ZodNullable<import("zod").ZodNumber>;
@@ -3405,8 +3405,8 @@ export declare const WSOutboundMessageSchema: {
3405
3405
  scripts: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
3406
3406
  scriptName: import("zod").ZodString;
3407
3407
  type: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodEnum<{
3408
- script: "script";
3409
3408
  service: "service";
3409
+ script: "script";
3410
3410
  }>>>;
3411
3411
  hostname: import("zod").ZodString;
3412
3412
  port: import("zod").ZodNullable<import("zod").ZodNumber>;
@@ -3435,8 +3435,8 @@ export declare const WSOutboundMessageSchema: {
3435
3435
  script: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
3436
3436
  scriptName: import("zod").ZodString;
3437
3437
  type: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodEnum<{
3438
- script: "script";
3439
3438
  service: "service";
3439
+ script: "script";
3440
3440
  }>>>;
3441
3441
  hostname: import("zod").ZodString;
3442
3442
  port: import("zod").ZodNullable<import("zod").ZodNumber>;
@@ -3457,8 +3457,8 @@ export declare const WSOutboundMessageSchema: {
3457
3457
  scripts: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
3458
3458
  scriptName: import("zod").ZodString;
3459
3459
  type: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodEnum<{
3460
- script: "script";
3461
3460
  service: "service";
3461
+ script: "script";
3462
3462
  }>>>;
3463
3463
  hostname: import("zod").ZodString;
3464
3464
  port: import("zod").ZodNullable<import("zod").ZodNumber>;
@@ -3487,8 +3487,8 @@ export declare const WSOutboundMessageSchema: {
3487
3487
  script: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
3488
3488
  scriptName: import("zod").ZodString;
3489
3489
  type: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodEnum<{
3490
- script: "script";
3491
3490
  service: "service";
3491
+ script: "script";
3492
3492
  }>>>;
3493
3493
  hostname: import("zod").ZodString;
3494
3494
  port: import("zod").ZodNullable<import("zod").ZodNumber>;
@@ -3509,8 +3509,8 @@ export declare const WSOutboundMessageSchema: {
3509
3509
  scripts: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
3510
3510
  scriptName: import("zod").ZodString;
3511
3511
  type: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodEnum<{
3512
- script: "script";
3513
3512
  service: "service";
3513
+ script: "script";
3514
3514
  }>>>;
3515
3515
  hostname: import("zod").ZodString;
3516
3516
  port: import("zod").ZodNullable<import("zod").ZodNumber>;
@@ -4216,8 +4216,8 @@ export declare const WSOutboundMessageSchema: {
4216
4216
  scripts: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
4217
4217
  scriptName: import("zod").ZodString;
4218
4218
  type: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodEnum<{
4219
- script: "script";
4220
4219
  service: "service";
4220
+ script: "script";
4221
4221
  }>>>;
4222
4222
  hostname: import("zod").ZodString;
4223
4223
  port: import("zod").ZodNullable<import("zod").ZodNumber>;
@@ -4392,7 +4392,7 @@ export declare const WSOutboundMessageSchema: {
4392
4392
  activityAt: string | null;
4393
4393
  scripts: {
4394
4394
  scriptName: string;
4395
- type: "script" | "service";
4395
+ type: "service" | "script";
4396
4396
  hostname: string;
4397
4397
  port: number | null;
4398
4398
  proxyUrl: string | null;
@@ -4502,7 +4502,7 @@ export declare const WSOutboundMessageSchema: {
4502
4502
  activityAt: string | null;
4503
4503
  scripts: {
4504
4504
  scriptName: string;
4505
- type: "script" | "service";
4505
+ type: "service" | "script";
4506
4506
  hostname: string;
4507
4507
  port: number | null;
4508
4508
  proxyUrl: string | null;
@@ -4913,6 +4913,17 @@ export declare const WSOutboundMessageSchema: {
4913
4913
  auth: import("zod").ZodOptional<import("zod").ZodObject<{
4914
4914
  passwordSet: import("zod").ZodBoolean;
4915
4915
  }, import("zod/v4/core").$loose>>;
4916
+ service: import("zod").ZodOptional<import("zod").ZodObject<{
4917
+ state: import("zod").ZodEnum<{
4918
+ unknown: "unknown";
4919
+ "not-installed": "not-installed";
4920
+ "installed-stopped": "installed-stopped";
4921
+ "installed-running-not-this-process": "installed-running-not-this-process";
4922
+ "managed-by-service": "managed-by-service";
4923
+ }>;
4924
+ label: import("zod").ZodString;
4925
+ linger: import("zod").ZodOptional<import("zod").ZodBoolean>;
4926
+ }, import("zod/v4/core").$loose>>;
4916
4927
  }, import("zod/v4/core").$loose>;
4917
4928
  }, import("zod/v4/core").$loose>;
4918
4929
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
@@ -5008,6 +5019,17 @@ export declare const WSOutboundMessageSchema: {
5008
5019
  auth: import("zod").ZodOptional<import("zod").ZodObject<{
5009
5020
  passwordSet: import("zod").ZodBoolean;
5010
5021
  }, import("zod/v4/core").$loose>>;
5022
+ service: import("zod").ZodOptional<import("zod").ZodObject<{
5023
+ state: import("zod").ZodEnum<{
5024
+ unknown: "unknown";
5025
+ "not-installed": "not-installed";
5026
+ "installed-stopped": "installed-stopped";
5027
+ "installed-running-not-this-process": "installed-running-not-this-process";
5028
+ "managed-by-service": "managed-by-service";
5029
+ }>;
5030
+ label: import("zod").ZodString;
5031
+ linger: import("zod").ZodOptional<import("zod").ZodBoolean>;
5032
+ }, import("zod/v4/core").$loose>>;
5011
5033
  }, import("zod/v4/core").$loose>;
5012
5034
  }, import("zod/v4/core").$loose>;
5013
5035
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
@@ -6480,8 +6502,8 @@ export declare const WSOutboundMessageSchema: {
6480
6502
  scripts: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
6481
6503
  scriptName: import("zod").ZodString;
6482
6504
  type: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodEnum<{
6483
- script: "script";
6484
6505
  service: "service";
6506
+ script: "script";
6485
6507
  }>>>;
6486
6508
  hostname: import("zod").ZodString;
6487
6509
  port: import("zod").ZodNullable<import("zod").ZodNumber>;
@@ -6656,7 +6678,7 @@ export declare const WSOutboundMessageSchema: {
6656
6678
  activityAt: string | null;
6657
6679
  scripts: {
6658
6680
  scriptName: string;
6659
- type: "script" | "service";
6681
+ type: "service" | "script";
6660
6682
  hostname: string;
6661
6683
  port: number | null;
6662
6684
  proxyUrl: string | null;
@@ -6766,7 +6788,7 @@ export declare const WSOutboundMessageSchema: {
6766
6788
  activityAt: string | null;
6767
6789
  scripts: {
6768
6790
  scriptName: string;
6769
- type: "script" | "service";
6791
+ type: "service" | "script";
6770
6792
  hostname: string;
6771
6793
  port: number | null;
6772
6794
  proxyUrl: string | null;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytetrue/protocol",
3
- "version": "0.14.6",
3
+ "version": "0.16.0",
4
4
  "description": "BySpace shared protocol schemas and wire types",
5
5
  "files": [
6
6
  "dist",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytetrue/relay",
3
- "version": "0.14.6",
3
+ "version": "0.16.0",
4
4
  "description": "BySpace relay for bridging daemon and client connections",
5
5
  "files": [
6
6
  "dist",
@@ -1,3 +1,4 @@
1
+ export declare const PI_TERMINAL_HOOK_OWNER_PID_ENV_KEY = "BYSPACE_PI_TERMINAL_HOOK_OWNER_PID";
1
2
  export type BySpaceNodeEnv = "development" | "production" | "test";
2
3
  export type ProcessEnvRecord = Record<string, string | undefined>;
3
4
  export type ExternalProcessEnv = NodeJS.ProcessEnv & Record<string, string>;
@@ -1,5 +1,7 @@
1
1
  const BYSPACE_NODE_ENV = "BYSPACE_NODE_ENV";
2
2
  const ELECTRON_RUN_AS_NODE = "ELECTRON_RUN_AS_NODE";
3
+ // Shared with the installed Pi extension (which cannot import from here).
4
+ export const PI_TERMINAL_HOOK_OWNER_PID_ENV_KEY = "BYSPACE_PI_TERMINAL_HOOK_OWNER_PID";
3
5
  const RUNTIME_CONTROL_ENV_KEYS = [
4
6
  BYSPACE_NODE_ENV,
5
7
  "BYSPACE_DESKTOP_MANAGED",
@@ -7,6 +9,13 @@ const RUNTIME_CONTROL_ENV_KEYS = [
7
9
  ELECTRON_RUN_AS_NODE,
8
10
  "ELECTRON_NO_ATTACH_CONSOLE",
9
11
  "ESBUILD_BINARY_PATH",
12
+ // Written into `process.env` by the Pi terminal-activity extension so child Pi
13
+ // processes do not register a second reporter for the same terminal. If it
14
+ // survives into a fresh terminal or agent, that Pi process sees a marker whose
15
+ // value is a stale pid, concludes it is an inherited child, and registers no
16
+ // handlers at all — the terminal then never reports running/idle. It is
17
+ // per-process state, never inherited. See docs/terminal-activity.md.
18
+ PI_TERMINAL_HOOK_OWNER_PID_ENV_KEY,
10
19
  ];
11
20
  function buildInternalProcessEnv(baseEnv) {
12
21
  return { ...baseEnv };
@@ -71,6 +71,17 @@ export declare class DaemonConfigStore {
71
71
  tcpPort: number | null;
72
72
  allowLanAccess: boolean;
73
73
  }): void;
74
+ /**
75
+ * Re-probe the OS service manager and refresh the derived service view. Never
76
+ * persists: the service state is a property of the host, not of config.json.
77
+ */
78
+ refreshServiceRuntimeState(): void;
79
+ /**
80
+ * Execute a service install/uninstall (issue 043). Install/uninstall are side
81
+ * effects on the OS service manager, never config state: the mutable view stays
82
+ * untouched and the service view is re-probed on demand.
83
+ */
84
+ private applyServicePatch;
74
85
  reload(): DaemonConfigReloadResult;
75
86
  private applyReplacement;
76
87
  onFieldChange(path: string, handler: FieldChangeHandler): () => void;
@@ -1,5 +1,7 @@
1
1
  import { loadPersistedConfig, savePersistedConfig, } from "./persisted-config.js";
2
2
  import { hashDaemonPassword } from "./auth.js";
3
+ import { DAEMON_SERVICE_LABEL, queryDaemonServiceView, validateServiceOriginSync, } from "./session/daemon/daemon-service-manager.js";
4
+ import { buildServerServiceSpec, installLaunchdServiceServer, installSystemdServiceServer, uninstallLaunchdServiceServer, uninstallSystemdServiceServer, uninstallWindowsTaskServer, } from "./session/daemon/daemon-service-install.js";
3
5
  import { isLanListenString } from "./hostnames.js";
4
6
  import { ProviderOverrideSchema } from "./agent/provider-launch-config.js";
5
7
  import { MutableDaemonConfigSchema, MutableDaemonConfigPatchSchema, TERMINAL_AGENT_HOOK_LEGACY_GLOBAL_PROVIDER_IDS, TERMINAL_AGENT_HOOK_PROVIDER_IDS, } from "@bytetrue/protocol/messages";
@@ -183,6 +185,7 @@ function pickSupportedPatchFields(patch) {
183
185
  ...(patch.pluginsEnabled !== undefined ? { pluginsEnabled: patch.pluginsEnabled } : {}),
184
186
  ...(patch.plugins !== undefined ? { plugins: patch.plugins } : {}),
185
187
  ...pickNetworkAuthPatchFields(patch),
188
+ ...(patch.service !== undefined ? { service: patch.service } : {}),
186
189
  };
187
190
  }
188
191
  function pickNetworkAuthPatchFields(patch) {
@@ -285,6 +288,9 @@ export class DaemonConfigStore {
285
288
  this.startupPersisted =
286
289
  options.startupPersisted ?? loadPersistedConfig(byspaceHome, this.logger);
287
290
  this.lastKnownPersisted = this.startupPersisted;
291
+ // Service view is probed, not persisted: refresh it once at construction so the
292
+ // first server_info carries a real state, then again after each service patch.
293
+ this.refreshServiceRuntimeState();
288
294
  }
289
295
  get() {
290
296
  return this.current;
@@ -303,7 +309,14 @@ export class DaemonConfigStore {
303
309
  // The network/auth patch never lands in the mutable view verbatim: the
304
310
  // plaintext password and listen semantics are translated below, and only
305
311
  // the derived view fields (allowLanAccess / passwordSet) surface to clients.
306
- const { removeProviders = [], network: networkPatch, auth: authPatch, ...rawConfigPatch } = parsedPatch;
312
+ const { removeProviders = [], network: networkPatch, auth: authPatch, service: servicePatch, ...rawConfigPatch } = parsedPatch;
313
+ // Service install is a side effect, not config state: it runs the OS service
314
+ // registration and the resulting view refresh arrives via the service probe.
315
+ if (servicePatch?.install !== undefined) {
316
+ this.applyServicePatch(servicePatch.install);
317
+ // Re-probe after the side effect so the response carries the new state.
318
+ this.refreshServiceRuntimeState();
319
+ }
307
320
  let daemonPersistedPatch = null;
308
321
  let networkViewPatch = {};
309
322
  const resolved = this.resolveDaemonNetworkPatch(networkPatch, authPatch);
@@ -417,6 +430,63 @@ export class DaemonConfigStore {
417
430
  });
418
431
  this.applyReplacement(next, { removedProviders: [] });
419
432
  }
433
+ /**
434
+ * Re-probe the OS service manager and refresh the derived service view. Never
435
+ * persists: the service state is a property of the host, not of config.json.
436
+ */
437
+ refreshServiceRuntimeState() {
438
+ let view;
439
+ try {
440
+ view = queryDaemonServiceView();
441
+ }
442
+ catch {
443
+ // The service-manager probe is host-dependent (launchctl/systemctl may be
444
+ // absent, e.g. unit tests or containers); leave the view out rather than
445
+ // failing every config operation.
446
+ return;
447
+ }
448
+ const next = MutableDaemonConfigSchema.parse({
449
+ ...this.current,
450
+ service: view,
451
+ });
452
+ if (JSON.stringify(next) === JSON.stringify(this.current))
453
+ return;
454
+ this.applyReplacement(next, { removedProviders: [] });
455
+ }
456
+ /**
457
+ * Execute a service install/uninstall (issue 043). Install/uninstall are side
458
+ * effects on the OS service manager, never config state: the mutable view stays
459
+ * untouched and the service view is re-probed on demand.
460
+ */
461
+ applyServicePatch(install) {
462
+ if (install) {
463
+ // The same npm-global guard the CLI enforces: a service must point at the
464
+ // published install, not a dev checkout or container filesystem. The daemon
465
+ // process runs the check because it owns the install-origin context.
466
+ const originError = validateServiceOriginSync();
467
+ if (originError)
468
+ throw new Error(originError);
469
+ const spec = buildServerServiceSpec(this.byspaceHome);
470
+ if (process.platform === "darwin") {
471
+ installLaunchdServiceServer(spec);
472
+ }
473
+ else if (process.platform === "linux") {
474
+ installSystemdServiceServer(spec);
475
+ }
476
+ else {
477
+ throw new Error("Service installation is not supported on this platform (expected macOS or Linux).");
478
+ }
479
+ }
480
+ else if (process.platform === "darwin") {
481
+ uninstallLaunchdServiceServer(DAEMON_SERVICE_LABEL);
482
+ }
483
+ else if (process.platform === "linux") {
484
+ uninstallSystemdServiceServer(DAEMON_SERVICE_LABEL);
485
+ }
486
+ else if (process.platform === "win32") {
487
+ uninstallWindowsTaskServer(DAEMON_SERVICE_LABEL);
488
+ }
489
+ }
420
490
  reload() {
421
491
  if (!this.reloadSource) {
422
492
  throw new Error("Daemon config reload is unavailable for this daemon instance");
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Server-side service install (issue 043). The daemon installs *itself*: it knows its
3
+ * own node executable, runner entry, and environment. This deliberately does not
4
+ * import the CLI's service layer — the server bundle cannot depend on the CLI, and
5
+ * the CLI command covers the same ground from the outside.
6
+ *
7
+ * KeepAlive is false so `byspace daemon stop` stays a real stop.
8
+ */
9
+ export interface ServerServiceSpec {
10
+ label: string;
11
+ nodePath: string;
12
+ runnerEntry: string;
13
+ logPath: string;
14
+ env: Record<string, string>;
15
+ }
16
+ export declare function buildServerServiceSpec(home: string): ServerServiceSpec;
17
+ export declare function renderLaunchdPlist(spec: ServerServiceSpec): string;
18
+ /** Write the plist and load it. The daemon exits after install; launchd takes over. */
19
+ export declare function installLaunchdServiceServer(spec: ServerServiceSpec): void;
20
+ /** Stop and remove the service definition. The daemon keeps running until stopped. */
21
+ export declare function uninstallLaunchdServiceServer(label: string): void;
22
+ export declare function installSystemdServiceServer(spec: ServerServiceSpec): void;
23
+ export declare function uninstallSystemdServiceServer(label: string): void;
24
+ export declare function uninstallWindowsTaskServer(label: string): void;
25
+ //# sourceMappingURL=daemon-service-install.d.ts.map