@bytetrue/byspace 0.2.0-beta.4 → 0.2.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 (39) hide show
  1. package/dist/commands/daemon/local-daemon.d.ts +2 -0
  2. package/dist/commands/daemon/local-daemon.js +21 -1
  3. package/dist/commands/daemon/start.js +11 -1
  4. package/node_modules/@bytetrue/byspace-client/dist/daemon-client.d.ts +3 -1
  5. package/node_modules/@bytetrue/byspace-client/dist/daemon-client.js +12 -0
  6. package/node_modules/@bytetrue/byspace-client/package.json +1 -1
  7. package/node_modules/@bytetrue/byspace-highlight/package.json +1 -1
  8. package/node_modules/@bytetrue/byspace-protocol/dist/generated/validation/ws-outbound.aot.js +9447 -9399
  9. package/node_modules/@bytetrue/byspace-protocol/dist/messages.d.ts +123 -0
  10. package/node_modules/@bytetrue/byspace-protocol/dist/messages.js +30 -0
  11. package/node_modules/@bytetrue/byspace-protocol/dist/validation/ws-outbound-schema-metadata.d.ts +20 -0
  12. package/node_modules/@bytetrue/byspace-protocol/package.json +1 -1
  13. package/node_modules/@bytetrue/byspace-relay/package.json +1 -1
  14. package/node_modules/@bytetrue/byspace-server/dist/server/server/config.js +1 -1
  15. package/node_modules/@bytetrue/byspace-server/dist/server/server/orchestration-skills.d.ts +11 -0
  16. package/node_modules/@bytetrue/byspace-server/dist/server/server/orchestration-skills.js +197 -0
  17. package/node_modules/@bytetrue/byspace-server/dist/server/server/session/daemon/daemon-session.d.ts +6 -0
  18. package/node_modules/@bytetrue/byspace-server/dist/server/server/session/daemon/daemon-session.js +15 -0
  19. package/node_modules/@bytetrue/byspace-server/dist/server/server/session.js +4 -0
  20. package/node_modules/@bytetrue/byspace-server/dist/server/server/websocket-server.js +2 -0
  21. package/node_modules/@bytetrue/byspace-server/dist/server/terminal/terminal-worker-process.js +8 -1
  22. package/node_modules/@bytetrue/byspace-server/dist/server/terminal/terminal.d.ts +1 -0
  23. package/node_modules/@bytetrue/byspace-server/dist/server/terminal/terminal.js +33 -10
  24. package/node_modules/@bytetrue/byspace-server/dist/server/terminal/worker-terminal-manager.js +3 -0
  25. package/node_modules/@bytetrue/byspace-server/dist/server/web-ui/_expo/static/js/web/{index-38ca1829d34e8fa57f6076abc4391d37.js → index-ba698ed4743a3ed98c16928de3e54cb1.js} +33 -33
  26. package/node_modules/@bytetrue/byspace-server/dist/server/web-ui/_expo/static/js/web/index-ba698ed4743a3ed98c16928de3e54cb1.js.br +0 -0
  27. package/node_modules/@bytetrue/byspace-server/dist/server/web-ui/_expo/static/js/web/index-ba698ed4743a3ed98c16928de3e54cb1.js.gz +0 -0
  28. package/node_modules/@bytetrue/byspace-server/dist/server/web-ui/index.html +1 -1
  29. package/node_modules/@bytetrue/byspace-server/dist/server/web-ui/index.html.br +0 -0
  30. package/node_modules/@bytetrue/byspace-server/dist/server/web-ui/index.html.gz +0 -0
  31. package/node_modules/@bytetrue/byspace-server/dist/skills/byspace/SKILL.md +147 -0
  32. package/node_modules/@bytetrue/byspace-server/dist/skills/byspace-advisor/SKILL.md +64 -0
  33. package/node_modules/@bytetrue/byspace-server/dist/skills/byspace-committee/SKILL.md +83 -0
  34. package/node_modules/@bytetrue/byspace-server/dist/skills/byspace-handoff/SKILL.md +71 -0
  35. package/node_modules/@bytetrue/byspace-server/dist/skills/byspace-loop/SKILL.md +45 -0
  36. package/node_modules/@bytetrue/byspace-server/package.json +3 -2
  37. package/package.json +6 -6
  38. package/node_modules/@bytetrue/byspace-server/dist/server/web-ui/_expo/static/js/web/index-38ca1829d34e8fa57f6076abc4391d37.js.br +0 -0
  39. package/node_modules/@bytetrue/byspace-server/dist/server/web-ui/_expo/static/js/web/index-38ca1829d34e8fa57f6076abc4391d37.js.gz +0 -0
@@ -1393,6 +1393,15 @@ export declare const DaemonUpdateRequestMessageSchema: z.ZodObject<{
1393
1393
  type: z.ZodLiteral<"daemon.update.request">;
1394
1394
  requestId: z.ZodString;
1395
1395
  }, z.core.$strip>;
1396
+ export declare const DaemonOrchestrationSkillsGetStatusRequestSchema: z.ZodObject<{
1397
+ type: z.ZodLiteral<"daemon.orchestration_skills.get_status.request">;
1398
+ requestId: z.ZodString;
1399
+ }, z.core.$strip>;
1400
+ export declare const DaemonOrchestrationSkillsSetInstalledRequestSchema: z.ZodObject<{
1401
+ type: z.ZodLiteral<"daemon.orchestration_skills.set_installed.request">;
1402
+ installed: z.ZodBoolean;
1403
+ requestId: z.ZodString;
1404
+ }, z.core.$strip>;
1396
1405
  export declare const AgentTimelineCursorSchema: z.ZodObject<{
1397
1406
  epoch: z.ZodString;
1398
1407
  seq: z.ZodNumber;
@@ -3306,6 +3315,13 @@ export declare const SessionInboundMessageSchema: z.ZodDiscriminatedUnion<[z.Zod
3306
3315
  }, z.core.$strip>, z.ZodObject<{
3307
3316
  type: z.ZodLiteral<"daemon.update.request">;
3308
3317
  requestId: z.ZodString;
3318
+ }, z.core.$strip>, z.ZodObject<{
3319
+ type: z.ZodLiteral<"daemon.orchestration_skills.get_status.request">;
3320
+ requestId: z.ZodString;
3321
+ }, z.core.$strip>, z.ZodObject<{
3322
+ type: z.ZodLiteral<"daemon.orchestration_skills.set_installed.request">;
3323
+ installed: z.ZodBoolean;
3324
+ requestId: z.ZodString;
3309
3325
  }, z.core.$strip>, z.ZodObject<{
3310
3326
  type: z.ZodLiteral<"fetch_agent_timeline_request">;
3311
3327
  agentId: z.ZodString;
@@ -4435,6 +4451,7 @@ export declare const ServerInfoStatusPayloadSchema: z.ZodPipe<z.ZodObject<{
4435
4451
  daemonStatusRpc: z.ZodOptional<z.ZodBoolean>;
4436
4452
  "terminal-restore-modes": z.ZodOptional<z.ZodBoolean>;
4437
4453
  terminalAgentHookProviders: z.ZodOptional<z.ZodBoolean>;
4454
+ orchestrationSkills: z.ZodOptional<z.ZodBoolean>;
4438
4455
  rewind: z.ZodOptional<z.ZodBoolean>;
4439
4456
  checkoutRefresh: z.ZodOptional<z.ZodBoolean>;
4440
4457
  workspaceMultiplicity: z.ZodOptional<z.ZodBoolean>;
@@ -4486,6 +4503,7 @@ export declare const ServerInfoStatusPayloadSchema: z.ZodPipe<z.ZodObject<{
4486
4503
  daemonStatusRpc?: boolean | undefined;
4487
4504
  "terminal-restore-modes"?: boolean | undefined;
4488
4505
  terminalAgentHookProviders?: boolean | undefined;
4506
+ orchestrationSkills?: boolean | undefined;
4489
4507
  rewind?: boolean | undefined;
4490
4508
  checkoutRefresh?: boolean | undefined;
4491
4509
  workspaceMultiplicity?: boolean | undefined;
@@ -4538,6 +4556,7 @@ export declare const ServerInfoStatusPayloadSchema: z.ZodPipe<z.ZodObject<{
4538
4556
  daemonStatusRpc?: boolean | undefined;
4539
4557
  "terminal-restore-modes"?: boolean | undefined;
4540
4558
  terminalAgentHookProviders?: boolean | undefined;
4559
+ orchestrationSkills?: boolean | undefined;
4541
4560
  rewind?: boolean | undefined;
4542
4561
  checkoutRefresh?: boolean | undefined;
4543
4562
  workspaceMultiplicity?: boolean | undefined;
@@ -11646,6 +11665,36 @@ export declare const DaemonUpdateResponseSchema: z.ZodObject<{
11646
11665
  }, z.core.$strip>;
11647
11666
  }, z.core.$strip>;
11648
11667
  export type DaemonUpdateResponse = z.infer<typeof DaemonUpdateResponseSchema>;
11668
+ export declare const OrchestrationSkillsStateSchema: z.ZodEnum<{
11669
+ "not-installed": "not-installed";
11670
+ "up-to-date": "up-to-date";
11671
+ drift: "drift";
11672
+ }>;
11673
+ export type OrchestrationSkillsState = z.infer<typeof OrchestrationSkillsStateSchema>;
11674
+ export declare const DaemonOrchestrationSkillsGetStatusResponseSchema: z.ZodObject<{
11675
+ type: z.ZodLiteral<"daemon.orchestration_skills.get_status.response">;
11676
+ payload: z.ZodObject<{
11677
+ requestId: z.ZodString;
11678
+ state: z.ZodEnum<{
11679
+ "not-installed": "not-installed";
11680
+ "up-to-date": "up-to-date";
11681
+ drift: "drift";
11682
+ }>;
11683
+ }, z.core.$strip>;
11684
+ }, z.core.$strip>;
11685
+ export type DaemonOrchestrationSkillsGetStatusResponse = z.infer<typeof DaemonOrchestrationSkillsGetStatusResponseSchema>;
11686
+ export declare const DaemonOrchestrationSkillsSetInstalledResponseSchema: z.ZodObject<{
11687
+ type: z.ZodLiteral<"daemon.orchestration_skills.set_installed.response">;
11688
+ payload: z.ZodObject<{
11689
+ requestId: z.ZodString;
11690
+ state: z.ZodEnum<{
11691
+ "not-installed": "not-installed";
11692
+ "up-to-date": "up-to-date";
11693
+ drift: "drift";
11694
+ }>;
11695
+ }, z.core.$strip>;
11696
+ }, z.core.$strip>;
11697
+ export type DaemonOrchestrationSkillsSetInstalledResponse = z.infer<typeof DaemonOrchestrationSkillsSetInstalledResponseSchema>;
11649
11698
  export declare const DaemonUpdateProgressMessageSchema: z.ZodObject<{
11650
11699
  type: z.ZodLiteral<"daemon.update.progress">;
11651
11700
  payload: z.ZodObject<{
@@ -14929,6 +14978,26 @@ export declare const SessionOutboundMessageSchema: z.ZodDiscriminatedUnion<[z.Zo
14929
14978
  requestId: z.ZodString;
14930
14979
  diagnostic: z.ZodString;
14931
14980
  }, z.core.$loose>;
14981
+ }, z.core.$strip>, z.ZodObject<{
14982
+ type: z.ZodLiteral<"daemon.orchestration_skills.get_status.response">;
14983
+ payload: z.ZodObject<{
14984
+ requestId: z.ZodString;
14985
+ state: z.ZodEnum<{
14986
+ "not-installed": "not-installed";
14987
+ "up-to-date": "up-to-date";
14988
+ drift: "drift";
14989
+ }>;
14990
+ }, z.core.$strip>;
14991
+ }, z.core.$strip>, z.ZodObject<{
14992
+ type: z.ZodLiteral<"daemon.orchestration_skills.set_installed.response">;
14993
+ payload: z.ZodObject<{
14994
+ requestId: z.ZodString;
14995
+ state: z.ZodEnum<{
14996
+ "not-installed": "not-installed";
14997
+ "up-to-date": "up-to-date";
14998
+ drift: "drift";
14999
+ }>;
15000
+ }, z.core.$strip>;
14932
15001
  }, z.core.$strip>, z.ZodObject<{
14933
15002
  type: z.ZodLiteral<"get_daemon_config_response">;
14934
15003
  payload: z.ZodObject<{
@@ -19207,6 +19276,13 @@ export declare const WSSessionInboundSchema: z.ZodObject<{
19207
19276
  }, z.core.$strip>, z.ZodObject<{
19208
19277
  type: z.ZodLiteral<"daemon.update.request">;
19209
19278
  requestId: z.ZodString;
19279
+ }, z.core.$strip>, z.ZodObject<{
19280
+ type: z.ZodLiteral<"daemon.orchestration_skills.get_status.request">;
19281
+ requestId: z.ZodString;
19282
+ }, z.core.$strip>, z.ZodObject<{
19283
+ type: z.ZodLiteral<"daemon.orchestration_skills.set_installed.request">;
19284
+ installed: z.ZodBoolean;
19285
+ requestId: z.ZodString;
19210
19286
  }, z.core.$strip>, z.ZodObject<{
19211
19287
  type: z.ZodLiteral<"fetch_agent_timeline_request">;
19212
19288
  agentId: z.ZodString;
@@ -23445,6 +23521,26 @@ export declare const WSSessionOutboundSchema: z.ZodObject<{
23445
23521
  requestId: z.ZodString;
23446
23522
  diagnostic: z.ZodString;
23447
23523
  }, z.core.$loose>;
23524
+ }, z.core.$strip>, z.ZodObject<{
23525
+ type: z.ZodLiteral<"daemon.orchestration_skills.get_status.response">;
23526
+ payload: z.ZodObject<{
23527
+ requestId: z.ZodString;
23528
+ state: z.ZodEnum<{
23529
+ "not-installed": "not-installed";
23530
+ "up-to-date": "up-to-date";
23531
+ drift: "drift";
23532
+ }>;
23533
+ }, z.core.$strip>;
23534
+ }, z.core.$strip>, z.ZodObject<{
23535
+ type: z.ZodLiteral<"daemon.orchestration_skills.set_installed.response">;
23536
+ payload: z.ZodObject<{
23537
+ requestId: z.ZodString;
23538
+ state: z.ZodEnum<{
23539
+ "not-installed": "not-installed";
23540
+ "up-to-date": "up-to-date";
23541
+ drift: "drift";
23542
+ }>;
23543
+ }, z.core.$strip>;
23448
23544
  }, z.core.$strip>, z.ZodObject<{
23449
23545
  type: z.ZodLiteral<"get_daemon_config_response">;
23450
23546
  payload: z.ZodObject<{
@@ -27408,6 +27504,13 @@ export declare const WSInboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
27408
27504
  }, z.core.$strip>, z.ZodObject<{
27409
27505
  type: z.ZodLiteral<"daemon.update.request">;
27410
27506
  requestId: z.ZodString;
27507
+ }, z.core.$strip>, z.ZodObject<{
27508
+ type: z.ZodLiteral<"daemon.orchestration_skills.get_status.request">;
27509
+ requestId: z.ZodString;
27510
+ }, z.core.$strip>, z.ZodObject<{
27511
+ type: z.ZodLiteral<"daemon.orchestration_skills.set_installed.request">;
27512
+ installed: z.ZodBoolean;
27513
+ requestId: z.ZodString;
27411
27514
  }, z.core.$strip>, z.ZodObject<{
27412
27515
  type: z.ZodLiteral<"fetch_agent_timeline_request">;
27413
27516
  agentId: z.ZodString;
@@ -31648,6 +31751,26 @@ export declare const WSOutboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
31648
31751
  requestId: z.ZodString;
31649
31752
  diagnostic: z.ZodString;
31650
31753
  }, z.core.$loose>;
31754
+ }, z.core.$strip>, z.ZodObject<{
31755
+ type: z.ZodLiteral<"daemon.orchestration_skills.get_status.response">;
31756
+ payload: z.ZodObject<{
31757
+ requestId: z.ZodString;
31758
+ state: z.ZodEnum<{
31759
+ "not-installed": "not-installed";
31760
+ "up-to-date": "up-to-date";
31761
+ drift: "drift";
31762
+ }>;
31763
+ }, z.core.$strip>;
31764
+ }, z.core.$strip>, z.ZodObject<{
31765
+ type: z.ZodLiteral<"daemon.orchestration_skills.set_installed.response">;
31766
+ payload: z.ZodObject<{
31767
+ requestId: z.ZodString;
31768
+ state: z.ZodEnum<{
31769
+ "not-installed": "not-installed";
31770
+ "up-to-date": "up-to-date";
31771
+ drift: "drift";
31772
+ }>;
31773
+ }, z.core.$strip>;
31651
31774
  }, z.core.$strip>, z.ZodObject<{
31652
31775
  type: z.ZodLiteral<"get_daemon_config_response">;
31653
31776
  payload: z.ZodObject<{
@@ -1094,6 +1094,15 @@ export const DaemonUpdateRequestMessageSchema = z.object({
1094
1094
  type: z.literal("daemon.update.request"),
1095
1095
  requestId: z.string(),
1096
1096
  });
1097
+ export const DaemonOrchestrationSkillsGetStatusRequestSchema = z.object({
1098
+ type: z.literal("daemon.orchestration_skills.get_status.request"),
1099
+ requestId: z.string(),
1100
+ });
1101
+ export const DaemonOrchestrationSkillsSetInstalledRequestSchema = z.object({
1102
+ type: z.literal("daemon.orchestration_skills.set_installed.request"),
1103
+ installed: z.boolean(),
1104
+ requestId: z.string(),
1105
+ });
1097
1106
  export const AgentTimelineCursorSchema = z.object({
1098
1107
  epoch: z.string(),
1099
1108
  seq: z.number().int().nonnegative(),
@@ -1989,6 +1998,8 @@ export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
1989
1998
  ShutdownServerRequestMessageSchema,
1990
1999
  RestartServerRequestMessageSchema,
1991
2000
  DaemonUpdateRequestMessageSchema,
2001
+ DaemonOrchestrationSkillsGetStatusRequestSchema,
2002
+ DaemonOrchestrationSkillsSetInstalledRequestSchema,
1992
2003
  FetchAgentTimelineRequestMessageSchema,
1993
2004
  ProviderSubagentListRequestMessageSchema,
1994
2005
  ProviderSubagentTimelineRequestMessageSchema,
@@ -2244,6 +2255,8 @@ export const ServerInfoStatusPayloadSchema = z
2244
2255
  "terminal-restore-modes": z.boolean().optional(),
2245
2256
  // COMPAT(terminalAgentHookProviders): added in v0.2.0, remove gate after 2027-01-21.
2246
2257
  terminalAgentHookProviders: z.boolean().optional(),
2258
+ // COMPAT(orchestrationSkills): added in v0.2.0-beta.5, remove gate after 2027-01-22.
2259
+ orchestrationSkills: z.boolean().optional(),
2247
2260
  // COMPAT(rewind): added in v0.1.X, drop the gate when floor >= v0.1.X.
2248
2261
  rewind: z.boolean().optional(),
2249
2262
  // COMPAT(checkoutRefresh): added in v0.1.86, remove gate after 2026-11-29.
@@ -4174,6 +4187,21 @@ export const DaemonUpdateResponseSchema = z.object({
4174
4187
  newVersion: z.string().nullable(),
4175
4188
  }),
4176
4189
  });
4190
+ export const OrchestrationSkillsStateSchema = z.enum(["not-installed", "up-to-date", "drift"]);
4191
+ export const DaemonOrchestrationSkillsGetStatusResponseSchema = z.object({
4192
+ type: z.literal("daemon.orchestration_skills.get_status.response"),
4193
+ payload: z.object({
4194
+ requestId: z.string(),
4195
+ state: OrchestrationSkillsStateSchema,
4196
+ }),
4197
+ });
4198
+ export const DaemonOrchestrationSkillsSetInstalledResponseSchema = z.object({
4199
+ type: z.literal("daemon.orchestration_skills.set_installed.response"),
4200
+ payload: z.object({
4201
+ requestId: z.string(),
4202
+ state: OrchestrationSkillsStateSchema,
4203
+ }),
4204
+ });
4177
4205
  export const DaemonUpdateProgressMessageSchema = z.object({
4178
4206
  type: z.literal("daemon.update.progress"),
4179
4207
  payload: z.object({
@@ -4231,6 +4259,8 @@ export const SessionOutboundMessageSchema = z.discriminatedUnion("type", [
4231
4259
  DaemonGetStatusResponseSchema,
4232
4260
  DaemonGetPairingOfferResponseSchema,
4233
4261
  DiagnosticsResponseSchema,
4262
+ DaemonOrchestrationSkillsGetStatusResponseSchema,
4263
+ DaemonOrchestrationSkillsSetInstalledResponseSchema,
4234
4264
  GetDaemonConfigResponseMessageSchema,
4235
4265
  SetDaemonConfigResponseMessageSchema,
4236
4266
  ReadProjectConfigResponseMessageSchema,
@@ -3273,6 +3273,26 @@ export declare const WSOutboundMessageSchema: {
3273
3273
  requestId: import("zod").ZodString;
3274
3274
  diagnostic: import("zod").ZodString;
3275
3275
  }, import("zod/v4/core").$loose>;
3276
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
3277
+ type: import("zod").ZodLiteral<"daemon.orchestration_skills.get_status.response">;
3278
+ payload: import("zod").ZodObject<{
3279
+ requestId: import("zod").ZodString;
3280
+ state: import("zod").ZodEnum<{
3281
+ "not-installed": "not-installed";
3282
+ "up-to-date": "up-to-date";
3283
+ drift: "drift";
3284
+ }>;
3285
+ }, import("zod/v4/core").$strip>;
3286
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
3287
+ type: import("zod").ZodLiteral<"daemon.orchestration_skills.set_installed.response">;
3288
+ payload: import("zod").ZodObject<{
3289
+ requestId: import("zod").ZodString;
3290
+ state: import("zod").ZodEnum<{
3291
+ "not-installed": "not-installed";
3292
+ "up-to-date": "up-to-date";
3293
+ drift: "drift";
3294
+ }>;
3295
+ }, import("zod/v4/core").$strip>;
3276
3296
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
3277
3297
  type: import("zod").ZodLiteral<"get_daemon_config_response">;
3278
3298
  payload: import("zod").ZodObject<{
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytetrue/byspace-protocol",
3
- "version": "0.2.0-beta.4",
3
+ "version": "0.2.0",
4
4
  "private": true,
5
5
  "description": "BySpace shared protocol schemas and wire types",
6
6
  "files": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytetrue/byspace-relay",
3
- "version": "0.2.0-beta.4",
3
+ "version": "0.2.0",
4
4
  "private": true,
5
5
  "description": "BySpace relay for bridging daemon and client connections",
6
6
  "files": [
@@ -176,7 +176,7 @@ function resolveWebUiConfig(byspaceHome, env, cli, persisted) {
176
176
  const enabled = cli?.webUiEnabled ??
177
177
  parseBooleanEnv(env.BYSPACE_WEB_UI_ENABLED) ??
178
178
  persisted.features?.webUi?.enabled ??
179
- false;
179
+ true;
180
180
  const rawDistDir = env.BYSPACE_WEB_UI_DIST_DIR ?? persisted.features?.webUi?.distDir;
181
181
  const trimmedDistDir = rawDistDir?.trim();
182
182
  const distDir = trimmedDistDir
@@ -0,0 +1,11 @@
1
+ export declare const BYSPACE_ORCHESTRATION_SKILL_NAMES: readonly ["byspace", "byspace-advisor", "byspace-committee", "byspace-handoff", "byspace-loop"];
2
+ export type OrchestrationSkillsState = "not-installed" | "up-to-date" | "drift";
3
+ export interface OrchestrationSkillsTargets {
4
+ sourceDir: string;
5
+ installDirs: readonly string[];
6
+ manifestPath: string;
7
+ }
8
+ export declare function resolveOrchestrationSkillsTargets(byspaceHome: string): OrchestrationSkillsTargets;
9
+ export declare function getOrchestrationSkillsStatus(targets: OrchestrationSkillsTargets): Promise<OrchestrationSkillsState>;
10
+ export declare function setOrchestrationSkillsInstalled(installed: boolean, targets: OrchestrationSkillsTargets): Promise<OrchestrationSkillsState>;
11
+ //# sourceMappingURL=orchestration-skills.d.ts.map
@@ -0,0 +1,197 @@
1
+ import { createHash, randomUUID } from "node:crypto";
2
+ import { promises as fs } from "node:fs";
3
+ import os from "node:os";
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { writeJsonFileAtomic } from "./atomic-file.js";
7
+ export const BYSPACE_ORCHESTRATION_SKILL_NAMES = [
8
+ "byspace",
9
+ "byspace-advisor",
10
+ "byspace-committee",
11
+ "byspace-handoff",
12
+ "byspace-loop",
13
+ ];
14
+ export function resolveOrchestrationSkillsTargets(byspaceHome) {
15
+ const moduleDir = path.dirname(fileURLToPath(import.meta.url));
16
+ const packagedSourceDir = path.resolve(moduleDir, "../../skills");
17
+ const checkoutSourceDir = path.resolve(moduleDir, "../../../../skills");
18
+ const home = os.homedir();
19
+ return {
20
+ sourceDir: process.env.BYSPACE_NODE_ENV === "development" ? checkoutSourceDir : packagedSourceDir,
21
+ installDirs: [path.join(home, ".agents", "skills"), path.join(home, ".claude", "skills")],
22
+ manifestPath: path.join(byspaceHome, "managed-orchestration-skills.json"),
23
+ };
24
+ }
25
+ async function hashDirectory(directory) {
26
+ const stat = await fs.lstat(directory).catch(() => null);
27
+ if (!stat)
28
+ return null;
29
+ if (!stat.isDirectory() || stat.isSymbolicLink()) {
30
+ throw new Error(`Orchestration skill path must be a directory: ${directory}`);
31
+ }
32
+ const hash = createHash("sha256");
33
+ async function walk(current) {
34
+ const entries = await fs.readdir(current, { withFileTypes: true });
35
+ entries.sort((a, b) => a.name.localeCompare(b.name));
36
+ for (const entry of entries) {
37
+ const fullPath = path.join(current, entry.name);
38
+ const relativePath = path.relative(directory, fullPath).split(path.sep).join("/");
39
+ if (entry.isDirectory()) {
40
+ await walk(fullPath);
41
+ }
42
+ else if (entry.isFile()) {
43
+ hash.update(relativePath);
44
+ hash.update("\0");
45
+ hash.update(await fs.readFile(fullPath));
46
+ hash.update("\0");
47
+ }
48
+ else {
49
+ throw new Error(`Unsupported file in orchestration skill: ${fullPath}`);
50
+ }
51
+ }
52
+ }
53
+ await walk(directory);
54
+ return hash.digest("hex");
55
+ }
56
+ async function readManifest(manifestPath) {
57
+ const raw = await fs.readFile(manifestPath, "utf8").catch((error) => {
58
+ if (error.code === "ENOENT")
59
+ return null;
60
+ throw error;
61
+ });
62
+ if (raw === null)
63
+ return { version: 1, managed: {} };
64
+ const parsed = JSON.parse(raw);
65
+ if (typeof parsed !== "object" ||
66
+ parsed === null ||
67
+ parsed.version !== 1 ||
68
+ typeof parsed.managed !== "object" ||
69
+ parsed.managed === null) {
70
+ throw new Error(`Invalid orchestration skills manifest: ${manifestPath}`);
71
+ }
72
+ const managed = parsed.managed;
73
+ if (Object.values(managed).some((digest) => typeof digest !== "string")) {
74
+ throw new Error(`Invalid orchestration skills manifest: ${manifestPath}`);
75
+ }
76
+ return { version: 1, managed: managed };
77
+ }
78
+ async function writeManifest(manifestPath, manifest) {
79
+ await writeJsonFileAtomic(manifestPath, manifest);
80
+ await fs.chmod(manifestPath, 0o600);
81
+ }
82
+ export async function getOrchestrationSkillsStatus(targets) {
83
+ let installedCount = 0;
84
+ let hasDrift = false;
85
+ for (const name of BYSPACE_ORCHESTRATION_SKILL_NAMES) {
86
+ const sourceHash = await hashDirectory(path.join(targets.sourceDir, name));
87
+ if (!sourceHash)
88
+ throw new Error(`Bundled orchestration skill is missing: ${name}`);
89
+ const installedHashes = await Promise.all(targets.installDirs.map((directory) => hashDirectory(path.join(directory, name))));
90
+ installedCount += installedHashes.filter((hash) => hash !== null).length;
91
+ hasDrift || (hasDrift = installedHashes.some((hash) => hash !== sourceHash));
92
+ }
93
+ if (installedCount === 0)
94
+ return "not-installed";
95
+ return hasDrift ? "drift" : "up-to-date";
96
+ }
97
+ async function replaceDirectory(source, destination) {
98
+ const parent = path.dirname(destination);
99
+ const suffix = `${process.pid}-${randomUUID()}`;
100
+ const staged = path.join(parent, `.${path.basename(destination)}.${suffix}.tmp`);
101
+ const backup = path.join(parent, `.${path.basename(destination)}.${suffix}.bak`);
102
+ await fs.mkdir(parent, { recursive: true });
103
+ await fs.cp(source, staged, { recursive: true, errorOnExist: true, force: false });
104
+ const destinationExists = (await fs.lstat(destination).catch(() => null)) !== null;
105
+ let originalMoved = false;
106
+ let installed = false;
107
+ try {
108
+ if (destinationExists) {
109
+ await fs.rename(destination, backup);
110
+ originalMoved = true;
111
+ }
112
+ await fs.rename(staged, destination);
113
+ installed = true;
114
+ }
115
+ catch (error) {
116
+ if (originalMoved && !installed) {
117
+ try {
118
+ await fs.rename(backup, destination);
119
+ }
120
+ catch (rollbackError) {
121
+ throw new Error(`Failed to replace orchestration skill and restore backup: ${destination}. Replacement error: ${error instanceof Error ? error.message : String(error)}`, { cause: rollbackError });
122
+ }
123
+ }
124
+ throw error;
125
+ }
126
+ finally {
127
+ if (!installed)
128
+ await fs.rm(staged, { recursive: true, force: true }).catch(() => undefined);
129
+ }
130
+ if (originalMoved)
131
+ await fs.rm(backup, { recursive: true, force: true });
132
+ }
133
+ async function installOrUpdateOrchestrationSkills(targets) {
134
+ const manifest = await readManifest(targets.manifestPath);
135
+ const nextManaged = {};
136
+ const pending = [];
137
+ for (const name of BYSPACE_ORCHESTRATION_SKILL_NAMES) {
138
+ const source = path.join(targets.sourceDir, name);
139
+ const digest = await hashDirectory(source);
140
+ if (!digest)
141
+ throw new Error(`Bundled orchestration skill is missing: ${name}`);
142
+ for (const installDir of targets.installDirs) {
143
+ const destination = path.join(installDir, name);
144
+ const installedDigest = await hashDirectory(destination);
145
+ if (installedDigest !== null &&
146
+ installedDigest !== digest &&
147
+ !manifest.managed[destination]) {
148
+ throw new Error(`Refusing to overwrite non-BySpace orchestration skill: ${destination}`);
149
+ }
150
+ pending.push({ source, destination, digest });
151
+ nextManaged[destination] = digest;
152
+ }
153
+ }
154
+ for (const item of pending) {
155
+ if ((await hashDirectory(item.destination)) !== item.digest) {
156
+ await replaceDirectory(item.source, item.destination);
157
+ }
158
+ }
159
+ await writeManifest(targets.manifestPath, { version: 1, managed: nextManaged });
160
+ }
161
+ async function uninstallOrchestrationSkills(targets) {
162
+ const manifest = await readManifest(targets.manifestPath);
163
+ const pending = [];
164
+ for (const name of BYSPACE_ORCHESTRATION_SKILL_NAMES) {
165
+ const sourceDigest = await hashDirectory(path.join(targets.sourceDir, name));
166
+ if (!sourceDigest)
167
+ throw new Error(`Bundled orchestration skill is missing: ${name}`);
168
+ for (const installDir of targets.installDirs) {
169
+ const destination = path.join(installDir, name);
170
+ const installedDigest = await hashDirectory(destination);
171
+ if (installedDigest === null)
172
+ continue;
173
+ if (installedDigest !== sourceDigest) {
174
+ throw new Error(`Refusing to remove modified orchestration skill: ${destination}`);
175
+ }
176
+ if (manifest.managed[destination] || installedDigest === sourceDigest)
177
+ pending.push(destination);
178
+ }
179
+ }
180
+ for (const destination of pending) {
181
+ await fs.rm(destination, { recursive: true, force: true });
182
+ }
183
+ await fs.rm(targets.manifestPath, { force: true });
184
+ }
185
+ let mutationQueue = Promise.resolve();
186
+ export function setOrchestrationSkillsInstalled(installed, targets) {
187
+ const operation = mutationQueue.then(async () => {
188
+ if (installed)
189
+ await installOrUpdateOrchestrationSkills(targets);
190
+ else
191
+ await uninstallOrchestrationSkills(targets);
192
+ return getOrchestrationSkillsStatus(targets);
193
+ });
194
+ mutationQueue = operation.then(() => undefined, () => undefined);
195
+ return operation;
196
+ }
197
+ //# sourceMappingURL=orchestration-skills.js.map
@@ -70,6 +70,12 @@ export declare class DaemonSession {
70
70
  handleDiagnosticsRequest(msg: Extract<SessionInboundMessage, {
71
71
  type: "diagnostics.request";
72
72
  }>): Promise<void>;
73
+ handleOrchestrationSkillsGetStatusRequest(msg: Extract<SessionInboundMessage, {
74
+ type: "daemon.orchestration_skills.get_status.request";
75
+ }>): Promise<void>;
76
+ handleOrchestrationSkillsSetInstalledRequest(msg: Extract<SessionInboundMessage, {
77
+ type: "daemon.orchestration_skills.set_installed.request";
78
+ }>): Promise<void>;
73
79
  handleUpdateRequest(msg: Extract<SessionInboundMessage, {
74
80
  type: "daemon.update.request";
75
81
  }>): Promise<void>;
@@ -2,6 +2,7 @@ import { getPidLockInfo } from "../../pid-lock.js";
2
2
  import { generateLocalPairingOffer } from "../../pairing-offer.js";
3
3
  import { collectDaemonDiagnostics, } from "./diagnostics.js";
4
4
  import { DaemonSelfUpdateSessionController } from "./daemon-self-update-session-controller.js";
5
+ import { getOrchestrationSkillsStatus, resolveOrchestrationSkillsTargets, setOrchestrationSkillsInstalled, } from "../../orchestration-skills.js";
5
6
  /**
6
7
  * A client's read surface for the daemon process itself: its runtime status
7
8
  * (pid-lock start time, listen address, relay config, provider availability) and
@@ -142,6 +143,20 @@ export class DaemonSession {
142
143
  });
143
144
  }
144
145
  }
146
+ async handleOrchestrationSkillsGetStatusRequest(msg) {
147
+ const state = await getOrchestrationSkillsStatus(resolveOrchestrationSkillsTargets(this.byspaceHome));
148
+ this.host.emit({
149
+ type: "daemon.orchestration_skills.get_status.response",
150
+ payload: { requestId: msg.requestId, state },
151
+ });
152
+ }
153
+ async handleOrchestrationSkillsSetInstalledRequest(msg) {
154
+ const state = await setOrchestrationSkillsInstalled(msg.installed, resolveOrchestrationSkillsTargets(this.byspaceHome));
155
+ this.host.emit({
156
+ type: "daemon.orchestration_skills.set_installed.response",
157
+ payload: { requestId: msg.requestId, state },
158
+ });
159
+ }
145
160
  async handleUpdateRequest(msg) {
146
161
  await this.selfUpdate.dispatch(msg);
147
162
  }
@@ -1017,6 +1017,10 @@ export class Session {
1017
1017
  return this.daemonSession.handleGetStatusRequest(msg);
1018
1018
  case "daemon.get_pairing_offer.request":
1019
1019
  return this.daemonSession.handleGetPairingOfferRequest(msg);
1020
+ case "daemon.orchestration_skills.get_status.request":
1021
+ return this.daemonSession.handleOrchestrationSkillsGetStatusRequest(msg);
1022
+ case "daemon.orchestration_skills.set_installed.request":
1023
+ return this.daemonSession.handleOrchestrationSkillsSetInstalledRequest(msg);
1020
1024
  case "diagnostics.request":
1021
1025
  return this.daemonSession.handleDiagnosticsRequest(msg);
1022
1026
  case "daemon.update.request":
@@ -842,6 +842,8 @@ export class VoiceAssistantWebSocketServer {
842
842
  "terminal-restore-modes": true,
843
843
  // COMPAT(terminalAgentHookProviders): added in v0.2.0, remove gate after 2027-01-21.
844
844
  terminalAgentHookProviders: true,
845
+ // COMPAT(orchestrationSkills): added in v0.2.0-beta.5, remove gate after 2027-01-22.
846
+ orchestrationSkills: true,
845
847
  // COMPAT(rewind): added in v0.1.X, drop the gate when floor >= v0.1.X.
846
848
  rewind: true,
847
849
  // COMPAT(checkoutRefresh): added in v0.1.86, remove gate after 2026-11-29.
@@ -246,11 +246,18 @@ async function handleRequest(message) {
246
246
  // snapshot's) the controller's revision dedup wouldn't drop it and the client would
247
247
  // see the bytes twice. Flushing first sends them with a revision <= the snapshot's.
248
248
  outputCoalescerByTerminalId.get(message.terminalId)?.flush();
249
+ // Drain the headless xterm so snapshotRevision catches up with emitRevision.
250
+ // Without this, the snapshot could lag behind already-emitted output and
251
+ // the controller would replay bytes the client already received.
252
+ const stateSession = manager.getTerminal(message.terminalId);
253
+ if (stateSession) {
254
+ await stateSession.drainHeadlessXterm();
255
+ }
249
256
  sendToParent({
250
257
  type: "response",
251
258
  requestId: message.requestId,
252
259
  ok: true,
253
- result: buildTerminalStateResult(manager.getTerminal(message.terminalId), message.options),
260
+ result: buildTerminalStateResult(stateSession, message.options),
254
261
  });
255
262
  return;
256
263
  }
@@ -71,6 +71,7 @@ export interface TerminalSession {
71
71
  };
72
72
  getState(): TerminalState;
73
73
  getStateSnapshot(options?: TerminalStateSnapshotOptions): TerminalStateSnapshot;
74
+ drainHeadlessXterm(): Promise<void>;
74
75
  getReplayPreamble(): string;
75
76
  getTitle(): string | undefined;
76
77
  getActivity(): TerminalActivity | null;