pilotswarm 0.0.1 → 0.4.1

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 (150) hide show
  1. package/README.md +37 -1
  2. package/mcp/README.md +484 -0
  3. package/mcp/dist/bin/pilotswarm-mcp.d.ts +3 -0
  4. package/mcp/dist/bin/pilotswarm-mcp.d.ts.map +1 -0
  5. package/mcp/dist/bin/pilotswarm-mcp.js +367 -0
  6. package/mcp/dist/bin/pilotswarm-mcp.js.map +1 -0
  7. package/mcp/dist/src/auth.d.ts +7 -0
  8. package/mcp/dist/src/auth.d.ts.map +1 -0
  9. package/mcp/dist/src/auth.js +99 -0
  10. package/mcp/dist/src/auth.js.map +1 -0
  11. package/mcp/dist/src/context.d.ts +48 -0
  12. package/mcp/dist/src/context.d.ts.map +1 -0
  13. package/mcp/dist/src/context.js +83 -0
  14. package/mcp/dist/src/context.js.map +1 -0
  15. package/mcp/dist/src/index.d.ts +4 -0
  16. package/mcp/dist/src/index.d.ts.map +1 -0
  17. package/mcp/dist/src/index.js +3 -0
  18. package/mcp/dist/src/index.js.map +1 -0
  19. package/mcp/dist/src/prompts/skills.d.ts +4 -0
  20. package/mcp/dist/src/prompts/skills.d.ts.map +1 -0
  21. package/mcp/dist/src/prompts/skills.js +11 -0
  22. package/mcp/dist/src/prompts/skills.js.map +1 -0
  23. package/mcp/dist/src/resources/agents.d.ts +4 -0
  24. package/mcp/dist/src/resources/agents.d.ts.map +1 -0
  25. package/mcp/dist/src/resources/agents.js +64 -0
  26. package/mcp/dist/src/resources/agents.js.map +1 -0
  27. package/mcp/dist/src/resources/facts.d.ts +4 -0
  28. package/mcp/dist/src/resources/facts.d.ts.map +1 -0
  29. package/mcp/dist/src/resources/facts.js +125 -0
  30. package/mcp/dist/src/resources/facts.js.map +1 -0
  31. package/mcp/dist/src/resources/models.d.ts +4 -0
  32. package/mcp/dist/src/resources/models.d.ts.map +1 -0
  33. package/mcp/dist/src/resources/models.js +43 -0
  34. package/mcp/dist/src/resources/models.js.map +1 -0
  35. package/mcp/dist/src/resources/sessions.d.ts +4 -0
  36. package/mcp/dist/src/resources/sessions.d.ts.map +1 -0
  37. package/mcp/dist/src/resources/sessions.js +190 -0
  38. package/mcp/dist/src/resources/sessions.js.map +1 -0
  39. package/mcp/dist/src/resources/subscriptions.d.ts +9 -0
  40. package/mcp/dist/src/resources/subscriptions.d.ts.map +1 -0
  41. package/mcp/dist/src/resources/subscriptions.js +157 -0
  42. package/mcp/dist/src/resources/subscriptions.js.map +1 -0
  43. package/mcp/dist/src/server.d.ts +4 -0
  44. package/mcp/dist/src/server.d.ts.map +1 -0
  45. package/mcp/dist/src/server.js +59 -0
  46. package/mcp/dist/src/server.js.map +1 -0
  47. package/mcp/dist/src/tools/agents.d.ts +4 -0
  48. package/mcp/dist/src/tools/agents.d.ts.map +1 -0
  49. package/mcp/dist/src/tools/agents.js +317 -0
  50. package/mcp/dist/src/tools/agents.js.map +1 -0
  51. package/mcp/dist/src/tools/facts.d.ts +4 -0
  52. package/mcp/dist/src/tools/facts.d.ts.map +1 -0
  53. package/mcp/dist/src/tools/facts.js +151 -0
  54. package/mcp/dist/src/tools/facts.js.map +1 -0
  55. package/mcp/dist/src/tools/models.d.ts +4 -0
  56. package/mcp/dist/src/tools/models.d.ts.map +1 -0
  57. package/mcp/dist/src/tools/models.js +256 -0
  58. package/mcp/dist/src/tools/models.js.map +1 -0
  59. package/mcp/dist/src/tools/sessions.d.ts +4 -0
  60. package/mcp/dist/src/tools/sessions.d.ts.map +1 -0
  61. package/mcp/dist/src/tools/sessions.js +606 -0
  62. package/mcp/dist/src/tools/sessions.js.map +1 -0
  63. package/mcp/dist/src/util/command.d.ts +52 -0
  64. package/mcp/dist/src/util/command.d.ts.map +1 -0
  65. package/mcp/dist/src/util/command.js +78 -0
  66. package/mcp/dist/src/util/command.js.map +1 -0
  67. package/package.json +82 -6
  68. package/tui/README.md +35 -0
  69. package/tui/bin/tui.js +30 -0
  70. package/tui/plugins/.mcp.json +7 -0
  71. package/tui/plugins/plugin.json +13 -0
  72. package/tui/plugins/session-policy.json +8 -0
  73. package/tui/src/app.js +850 -0
  74. package/tui/src/auth/cli.js +111 -0
  75. package/tui/src/auth/entra-auth.js +218 -0
  76. package/tui/src/bootstrap-env.js +176 -0
  77. package/tui/src/embedded-workers.js +79 -0
  78. package/tui/src/http-transport-host.js +106 -0
  79. package/tui/src/index.js +340 -0
  80. package/tui/src/node-sdk-transport.js +1794 -0
  81. package/tui/src/platform.js +984 -0
  82. package/tui/src/plugin-config.js +273 -0
  83. package/tui/src/portal.js +7 -0
  84. package/tui/src/version.js +7 -0
  85. package/tui/tui-splash-mobile.txt +7 -0
  86. package/tui/tui-splash.txt +11 -0
  87. package/ui/core/README.md +6 -0
  88. package/ui/core/src/commands.js +93 -0
  89. package/ui/core/src/context-usage.js +212 -0
  90. package/ui/core/src/controller.js +6201 -0
  91. package/ui/core/src/formatting.js +1036 -0
  92. package/ui/core/src/history.js +950 -0
  93. package/ui/core/src/index.js +13 -0
  94. package/ui/core/src/layout.js +332 -0
  95. package/ui/core/src/reducer.js +1952 -0
  96. package/ui/core/src/selectors.js +5419 -0
  97. package/ui/core/src/session-errors.js +14 -0
  98. package/ui/core/src/session-tree.js +151 -0
  99. package/ui/core/src/state.js +251 -0
  100. package/ui/core/src/store.js +23 -0
  101. package/ui/core/src/system-titles.js +24 -0
  102. package/ui/core/src/themes/catppuccin-mocha.js +56 -0
  103. package/ui/core/src/themes/cobalt2.js +56 -0
  104. package/ui/core/src/themes/dark-high-contrast.js +56 -0
  105. package/ui/core/src/themes/daylight.js +62 -0
  106. package/ui/core/src/themes/dracula.js +56 -0
  107. package/ui/core/src/themes/github-dark.js +56 -0
  108. package/ui/core/src/themes/github-light.js +59 -0
  109. package/ui/core/src/themes/gruvbox-dark.js +56 -0
  110. package/ui/core/src/themes/hacker-x-matrix.js +56 -0
  111. package/ui/core/src/themes/hacker-x-orion-prime.js +56 -0
  112. package/ui/core/src/themes/helpers.js +79 -0
  113. package/ui/core/src/themes/high-contrast-mono.js +59 -0
  114. package/ui/core/src/themes/index.js +52 -0
  115. package/ui/core/src/themes/light-high-contrast.js +62 -0
  116. package/ui/core/src/themes/noctis-obscuro.js +56 -0
  117. package/ui/core/src/themes/noctis.js +56 -0
  118. package/ui/core/src/themes/paper-ink.js +62 -0
  119. package/ui/core/src/themes/solarized-ops.js +59 -0
  120. package/ui/core/src/themes/terminal-green.js +59 -0
  121. package/ui/core/src/themes/tokyo-night.js +56 -0
  122. package/ui/react/README.md +5 -0
  123. package/ui/react/src/chat-status.js +39 -0
  124. package/ui/react/src/components.js +1989 -0
  125. package/ui/react/src/index.js +4 -0
  126. package/ui/react/src/platform.js +15 -0
  127. package/ui/react/src/use-controller-state.js +38 -0
  128. package/ui/react/src/web-app.js +4457 -0
  129. package/web/README.md +198 -0
  130. package/web/api/router.js +196 -0
  131. package/web/api/ws.js +152 -0
  132. package/web/auth/authz/engine.js +204 -0
  133. package/web/auth/config.js +115 -0
  134. package/web/auth/index.js +175 -0
  135. package/web/auth/normalize/entra.js +22 -0
  136. package/web/auth/providers/entra.js +76 -0
  137. package/web/auth/providers/none.js +24 -0
  138. package/web/auth.js +10 -0
  139. package/web/bin/serve.js +53 -0
  140. package/web/config.js +20 -0
  141. package/web/dist/app.js +469 -0
  142. package/web/dist/assets/index-DmGOcKR-.css +1 -0
  143. package/web/dist/assets/index-xJ8IzIZY.js +24 -0
  144. package/web/dist/assets/msal-CytV9RFv.js +7 -0
  145. package/web/dist/assets/pilotswarm-D9pEmenA.js +90 -0
  146. package/web/dist/assets/react-CEPDSRB6.js +1 -0
  147. package/web/dist/index.html +16 -0
  148. package/web/runtime.js +455 -0
  149. package/web/server.js +276 -0
  150. package/index.js +0 -1
@@ -0,0 +1,52 @@
1
+ import type { CommandResponse, PilotSwarmManagementClient } from "pilotswarm-sdk";
2
+ type CommandResponseLike = CommandResponse & {
3
+ version?: number;
4
+ emittedAt?: number;
5
+ };
6
+ export declare class CommandRejectedError extends Error {
7
+ readonly cmd: string;
8
+ readonly cmdId: string;
9
+ readonly response: CommandResponseLike;
10
+ constructor(response: CommandResponseLike);
11
+ }
12
+ export declare class CommandTimeoutError extends Error {
13
+ readonly cmd: string;
14
+ readonly cmdId: string;
15
+ readonly timeoutMs: number;
16
+ constructor(cmd: string, cmdId: string, timeoutMs: number);
17
+ }
18
+ /**
19
+ * Send a command to a session's orchestration and wait for the orchestration's
20
+ * response.
21
+ *
22
+ * The bare `mgmt.sendCommand(...)` call is fire-and-forget — it returns once the
23
+ * command is enqueued, regardless of whether the orchestration ultimately
24
+ * accepts it. Unknown commands (e.g. anything other than the orchestration's
25
+ * recognized set: `set_model` / `list_models` / `get_info` / `done` /
26
+ * `cancel` / `delete`) are queued, processed, and rejected with
27
+ * `error: "Unknown command: ..."` written to KV — but the caller never sees
28
+ * that error if it doesn't poll.
29
+ *
30
+ * This helper closes the loop: enqueue with a fresh `cmdId`, poll the
31
+ * orchestration's KV-backed response channel until the response shows up,
32
+ * then return the response or throw `CommandRejectedError` /
33
+ * `CommandTimeoutError`.
34
+ *
35
+ * @param mgmt - PilotSwarmManagementClient instance
36
+ * @param sessionId - target session id
37
+ * @param cmd - command name (e.g. "set_model")
38
+ * @param args - command-specific arguments
39
+ * @param opts.timeoutMs - max time to wait for the orchestration's response
40
+ * (default 15s)
41
+ * @param opts.pollIntervalMs - KV poll interval (default 200ms)
42
+ * @param opts.signal - optional abort signal
43
+ * @throws CommandRejectedError if the orchestration writes an `error` response
44
+ * @throws CommandTimeoutError if no response shows up within `timeoutMs`
45
+ */
46
+ export declare function sendCommandAndWait(mgmt: PilotSwarmManagementClient, sessionId: string, cmd: string, args?: Record<string, unknown>, opts?: {
47
+ timeoutMs?: number;
48
+ pollIntervalMs?: number;
49
+ signal?: AbortSignal;
50
+ }): Promise<CommandResponseLike>;
51
+ export {};
52
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/util/command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAKlF,KAAK,mBAAmB,GAAG,eAAe,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtF,qBAAa,oBAAqB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;gBAE3B,QAAQ,EAAE,mBAAmB;CAO5C;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAO5D;AAKD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,kBAAkB,CACpC,IAAI,EAAE,0BAA0B,EAChC,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,IAAI,CAAC,EAAE;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,WAAW,CAAC;CACxB,GACF,OAAO,CAAC,mBAAmB,CAAC,CAqB9B"}
@@ -0,0 +1,78 @@
1
+ import { randomUUID } from "node:crypto";
2
+ export class CommandRejectedError extends Error {
3
+ cmd;
4
+ cmdId;
5
+ response;
6
+ constructor(response) {
7
+ super(response.error ?? `Command "${response.cmd}" was rejected with no error message`);
8
+ this.name = "CommandRejectedError";
9
+ this.cmd = response.cmd;
10
+ this.cmdId = response.id;
11
+ this.response = response;
12
+ }
13
+ }
14
+ export class CommandTimeoutError extends Error {
15
+ cmd;
16
+ cmdId;
17
+ timeoutMs;
18
+ constructor(cmd, cmdId, timeoutMs) {
19
+ super(`Timed out after ${timeoutMs}ms waiting for response to command "${cmd}" (id=${cmdId})`);
20
+ this.name = "CommandTimeoutError";
21
+ this.cmd = cmd;
22
+ this.cmdId = cmdId;
23
+ this.timeoutMs = timeoutMs;
24
+ }
25
+ }
26
+ const DEFAULT_TIMEOUT_MS = 15_000;
27
+ const DEFAULT_POLL_INTERVAL_MS = 200;
28
+ /**
29
+ * Send a command to a session's orchestration and wait for the orchestration's
30
+ * response.
31
+ *
32
+ * The bare `mgmt.sendCommand(...)` call is fire-and-forget — it returns once the
33
+ * command is enqueued, regardless of whether the orchestration ultimately
34
+ * accepts it. Unknown commands (e.g. anything other than the orchestration's
35
+ * recognized set: `set_model` / `list_models` / `get_info` / `done` /
36
+ * `cancel` / `delete`) are queued, processed, and rejected with
37
+ * `error: "Unknown command: ..."` written to KV — but the caller never sees
38
+ * that error if it doesn't poll.
39
+ *
40
+ * This helper closes the loop: enqueue with a fresh `cmdId`, poll the
41
+ * orchestration's KV-backed response channel until the response shows up,
42
+ * then return the response or throw `CommandRejectedError` /
43
+ * `CommandTimeoutError`.
44
+ *
45
+ * @param mgmt - PilotSwarmManagementClient instance
46
+ * @param sessionId - target session id
47
+ * @param cmd - command name (e.g. "set_model")
48
+ * @param args - command-specific arguments
49
+ * @param opts.timeoutMs - max time to wait for the orchestration's response
50
+ * (default 15s)
51
+ * @param opts.pollIntervalMs - KV poll interval (default 200ms)
52
+ * @param opts.signal - optional abort signal
53
+ * @throws CommandRejectedError if the orchestration writes an `error` response
54
+ * @throws CommandTimeoutError if no response shows up within `timeoutMs`
55
+ */
56
+ export async function sendCommandAndWait(mgmt, sessionId, cmd, args, opts) {
57
+ const cmdId = randomUUID();
58
+ const timeoutMs = opts?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
59
+ const pollIntervalMs = opts?.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
60
+ await mgmt.sendCommand(sessionId, { cmd, id: cmdId, ...(args ? { args } : {}) });
61
+ const deadline = Date.now() + timeoutMs;
62
+ while (Date.now() < deadline) {
63
+ if (opts?.signal?.aborted)
64
+ throw opts.signal.reason ?? new Error("Aborted");
65
+ const response = await mgmt.getCommandResponse(sessionId, cmdId);
66
+ if (response) {
67
+ if (response.error)
68
+ throw new CommandRejectedError(response);
69
+ return response;
70
+ }
71
+ const remaining = deadline - Date.now();
72
+ if (remaining <= 0)
73
+ break;
74
+ await new Promise((resolve) => setTimeout(resolve, Math.min(pollIntervalMs, remaining)));
75
+ }
76
+ throw new CommandTimeoutError(cmd, cmdId, timeoutMs);
77
+ }
78
+ //# sourceMappingURL=command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/util/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAQzC,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAClC,GAAG,CAAS;IACZ,KAAK,CAAS;IACd,QAAQ,CAAsB;IAEvC,YAAY,QAA6B;QACrC,KAAK,CAAC,QAAQ,CAAC,KAAK,IAAI,YAAY,QAAQ,CAAC,GAAG,sCAAsC,CAAC,CAAC;QACxF,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,EAAE,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;CACJ;AAED,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACjC,GAAG,CAAS;IACZ,KAAK,CAAS;IACd,SAAS,CAAS;IAE3B,YAAY,GAAW,EAAE,KAAa,EAAE,SAAiB;QACrD,KAAK,CAAC,mBAAmB,SAAS,uCAAuC,GAAG,SAAS,KAAK,GAAG,CAAC,CAAC;QAC/F,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;CACJ;AAED,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACpC,IAAgC,EAChC,SAAiB,EACjB,GAAW,EACX,IAA8B,EAC9B,IAIC;IAED,MAAM,KAAK,GAAG,UAAU,EAAE,CAAC;IAC3B,MAAM,SAAS,GAAG,IAAI,EAAE,SAAS,IAAI,kBAAkB,CAAC;IACxD,MAAM,cAAc,GAAG,IAAI,EAAE,cAAc,IAAI,wBAAwB,CAAC;IAExE,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAEjF,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;IACxC,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;QAC3B,IAAI,IAAI,EAAE,MAAM,EAAE,OAAO;YAAE,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;QAC5E,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QACjE,IAAI,QAAQ,EAAE,CAAC;YACX,IAAI,QAAQ,CAAC,KAAK;gBAAE,MAAM,IAAI,oBAAoB,CAAC,QAAQ,CAAC,CAAC;YAC7D,OAAO,QAAQ,CAAC;QACpB,CAAC;QACD,MAAM,SAAS,GAAG,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACxC,IAAI,SAAS,IAAI,CAAC;YAAE,MAAM;QAC1B,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAC7F,CAAC;IAED,MAAM,IAAI,mBAAmB,CAAC,GAAG,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AACzD,CAAC"}
package/package.json CHANGED
@@ -1,12 +1,88 @@
1
1
  {
2
2
  "name": "pilotswarm",
3
- "version": "0.0.1",
4
- "description": "Placeholder for PilotSwarm. The real package is coming soon.",
5
- "main": "index.js",
6
- "author": "Affan Dar",
3
+ "version": "0.4.1",
4
+ "description": "PilotSwarm application package: terminal UI, browser portal + Web API server, and MCP server — one install, three bins.",
5
+ "type": "module",
7
6
  "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/affandar/pilotswarm.git",
10
+ "directory": "packages/app"
11
+ },
12
+ "homepage": "https://github.com/affandar/pilotswarm#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/affandar/pilotswarm/issues"
15
+ },
16
+ "engines": {
17
+ "node": ">=24"
18
+ },
19
+ "bin": {
20
+ "pilotswarm": "./tui/bin/tui.js",
21
+ "pilotswarm-cli": "./tui/bin/tui.js",
22
+ "pilotswarm-web": "./web/bin/serve.js",
23
+ "pilotswarm-mcp": "./mcp/dist/bin/pilotswarm-mcp.js"
24
+ },
25
+ "exports": {
26
+ ".": "./tui/src/index.js",
27
+ "./host": "./tui/src/portal.js",
28
+ "./web": "./web/server.js",
29
+ "./ui-core": "./ui/core/src/index.js",
30
+ "./ui-react": "./ui/react/src/index.js",
31
+ "./package.json": "./package.json"
32
+ },
8
33
  "files": [
9
- "index.js",
34
+ "tui/bin/**/*",
35
+ "tui/src/**/*",
36
+ "tui/plugins/**/*",
37
+ "tui/tui-splash.txt",
38
+ "tui/tui-splash-mobile.txt",
39
+ "web/auth.js",
40
+ "web/auth/**/*",
41
+ "web/api/**/*",
42
+ "web/bin/**/*",
43
+ "web/config.js",
44
+ "web/dist/**/*",
45
+ "web/runtime.js",
46
+ "web/server.js",
47
+ "mcp/dist/**/*",
48
+ "ui/core/src/**/*",
49
+ "ui/react/src/**/*",
10
50
  "README.md"
11
- ]
51
+ ],
52
+ "scripts": {
53
+ "build": "npm run build:web && npm run build:mcp",
54
+ "build:web": "cd web && node ../node_modules/vite/bin/vite.js build",
55
+ "build:mcp": "cd mcp && tsc",
56
+ "prepack": "npm run build",
57
+ "start": "node ./tui/bin/tui.js local --env ../../.env.remote",
58
+ "start:remote": "node ./tui/bin/tui.js remote --env ../../.env.remote",
59
+ "web:start": "node web/server.js",
60
+ "web:dev": "cd web && node ../node_modules/vite/bin/vite.js --host 0.0.0.0",
61
+ "test": "npm run test:tui && npm run test:web && npm run test:ui && npm run test:mcp",
62
+ "test:tui": "node --test tui/test/*.test.mjs",
63
+ "test:web": "node --test web/test/*.test.mjs",
64
+ "test:ui": "node --test ui/core/test/*.test.mjs",
65
+ "test:mcp": "node mcp/test/unit/sendCommandAndWait.unit.mjs",
66
+ "test:mcp:integration": "node mcp/test/integration/smoke.live.mjs",
67
+ "test:mcp:integration:all": "node mcp/test/integration/smoke.live.mjs && node mcp/test/integration/tools.live.mjs && node mcp/test/integration/edge-cases.live.mjs && node mcp/test/integration/verify.live.mjs",
68
+ "clean": "rm -rf web/dist mcp/dist"
69
+ },
70
+ "dependencies": {
71
+ "@azure/msal-browser": "^4.26.1",
72
+ "@azure/msal-node": "^5.3.1",
73
+ "@hono/node-server": "^1.19.12",
74
+ "@modelcontextprotocol/sdk": "^1.28.0",
75
+ "express": "^5.1.0",
76
+ "hono": "^4.12.10",
77
+ "ink": "^6.8.0",
78
+ "jose": "^6.2.2",
79
+ "pilotswarm-sdk": "^0.4.1",
80
+ "react": "^19.2.4",
81
+ "react-dom": "^19.2.4",
82
+ "ws": "^8.18.2"
83
+ },
84
+ "devDependencies": {
85
+ "@vitejs/plugin-react": "^5.1.0",
86
+ "vite": "^7.2.0"
87
+ }
12
88
  }
package/tui/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # pilotswarm-cli
2
+
3
+ Terminal UI for PilotSwarm.
4
+
5
+ Install:
6
+
7
+ ```bash
8
+ npm install pilotswarm-cli
9
+ ```
10
+
11
+ For app-specific worker modules or direct SDK imports, also add:
12
+
13
+ ```bash
14
+ npm install pilotswarm-sdk
15
+ ```
16
+
17
+ Run locally against a plugin directory:
18
+
19
+ ```bash
20
+ npx pilotswarm local --env .env --plugin ./plugin --worker ./worker-module.js
21
+ ```
22
+
23
+ `pilotswarm-cli` provides the shipped TUI. Your app customizes it with `plugin/plugin.json`, `plugin/agents/*.agent.md`, `plugin/skills/*/SKILL.md`, and optional worker-side tools.
24
+
25
+ The shipped files inspector supports shared artifact browsing, download, local open, and delete flows. Binary artifacts download intact rather than being coerced through UTF-8 text previews.
26
+
27
+ Portal/runtime helpers that are intentionally shared with `pilotswarm-web`
28
+ are exported from `pilotswarm-cli/portal`.
29
+
30
+ Common docs:
31
+
32
+ - CLI apps: `https://github.com/affandar/PilotSwarm/blob/main/docs/developer/building/cli-apps.md`
33
+ - CLI agents: `https://github.com/affandar/PilotSwarm/blob/main/docs/developer/building/cli-agents.md`
34
+ - Keybindings: `https://github.com/affandar/PilotSwarm/blob/main/docs/user-guide/keybindings.md`
35
+ - DevOps sample: `https://github.com/affandar/PilotSwarm/tree/main/examples/devops-command-center`
package/tui/bin/tui.js ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Force the shipped TUI onto production React/Ink unless the caller
4
+ // explicitly opts into another environment for debugging.
5
+ process.env.NODE_ENV ??= "production";
6
+
7
+ const { syncBundledWorkspaceUiPackages } = await import("../src/sync-workspace-ui.js");
8
+ syncBundledWorkspaceUiPackages({ linkWorkspacePackages: true });
9
+
10
+ const argv = process.argv.slice(2);
11
+ if (argv[0] === "auth") {
12
+ const { runAuthCommand } = await import("../src/auth/cli.js");
13
+ process.exitCode = await runAuthCommand(argv.slice(1)).catch((error) => {
14
+ console.error(`[pilotswarm] ${error?.message || error}`);
15
+ return 1;
16
+ });
17
+ } else {
18
+ const { parseCliIntoEnv } = await import("../src/bootstrap-env.js");
19
+ const config = parseCliIntoEnv(argv);
20
+ const { startTuiApp } = await import("../src/index.js");
21
+ try {
22
+ // startTuiApp exits the process on normal quit; a thrown error here is
23
+ // a startup failure (e.g. Web API auth). Show it cleanly instead of an
24
+ // unhandled-rejection stack trace — the Ink screen is not up yet.
25
+ await startTuiApp(config);
26
+ } catch (error) {
27
+ console.error(`[pilotswarm] ${error?.message || error}`);
28
+ process.exitCode = 1;
29
+ }
30
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "context7": {
3
+ "type": "http",
4
+ "url": "https://mcp.context7.com/mcp",
5
+ "tools": ["resolve-library-id", "query-docs"]
6
+ }
7
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "pilotswarm",
3
+ "description": "Durable execution building blocks — skills, agents, and tools for long-running Copilot sessions with timers, dehydration, and worker migration.",
4
+ "version": "1.0.0",
5
+ "author": {
6
+ "name": "affandar",
7
+ "url": "https://github.com/affandar/pilotswarm"
8
+ },
9
+ "license": "MIT",
10
+ "keywords": ["pilotswarm", "durable", "copilot", "timers", "orchestration"],
11
+ "agents": "agents/",
12
+ "skills": "skills/"
13
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 1,
3
+ "creation": {
4
+ "mode": "open",
5
+ "allowGeneric": true,
6
+ "bundledAgents": ["generic-crawler"]
7
+ }
8
+ }