palmier 0.8.1 → 0.8.4

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 (133) hide show
  1. package/CLAUDE.md +13 -0
  2. package/README.md +16 -14
  3. package/dist/agents/agent.d.ts +0 -4
  4. package/dist/agents/claude.js +1 -1
  5. package/dist/agents/codex.js +2 -2
  6. package/dist/agents/cursor.js +1 -1
  7. package/dist/agents/deepagents.js +1 -1
  8. package/dist/agents/gemini.js +3 -2
  9. package/dist/agents/goose.js +1 -1
  10. package/dist/agents/hermes.js +1 -1
  11. package/dist/agents/kiro.js +1 -1
  12. package/dist/agents/opencode.js +1 -1
  13. package/dist/agents/qoder.js +1 -1
  14. package/dist/agents/shared-prompt.d.ts +0 -3
  15. package/dist/agents/shared-prompt.js +0 -3
  16. package/dist/commands/info.d.ts +0 -3
  17. package/dist/commands/info.js +0 -5
  18. package/dist/commands/init.d.ts +0 -3
  19. package/dist/commands/init.js +2 -11
  20. package/dist/commands/pair.d.ts +1 -4
  21. package/dist/commands/pair.js +3 -12
  22. package/dist/commands/restart.d.ts +0 -3
  23. package/dist/commands/restart.js +0 -3
  24. package/dist/commands/run.d.ts +1 -14
  25. package/dist/commands/run.js +18 -61
  26. package/dist/commands/serve.d.ts +0 -3
  27. package/dist/commands/serve.js +29 -27
  28. package/dist/config.d.ts +0 -8
  29. package/dist/config.js +0 -8
  30. package/dist/device-capabilities.d.ts +1 -1
  31. package/dist/event-queues.d.ts +6 -21
  32. package/dist/event-queues.js +6 -21
  33. package/dist/events.d.ts +0 -6
  34. package/dist/events.js +1 -9
  35. package/dist/index.js +0 -1
  36. package/dist/mcp-handler.js +1 -2
  37. package/dist/mcp-tools.d.ts +0 -3
  38. package/dist/mcp-tools.js +12 -16
  39. package/dist/nats-client.d.ts +0 -3
  40. package/dist/nats-client.js +1 -4
  41. package/dist/pending-requests.d.ts +4 -18
  42. package/dist/pending-requests.js +4 -18
  43. package/dist/platform/index.d.ts +1 -4
  44. package/dist/platform/index.js +8 -7
  45. package/dist/platform/linux.d.ts +3 -9
  46. package/dist/platform/linux.js +9 -20
  47. package/dist/platform/macos.d.ts +32 -0
  48. package/dist/platform/macos.js +287 -0
  49. package/dist/platform/platform.d.ts +1 -4
  50. package/dist/platform/windows.d.ts +2 -5
  51. package/dist/platform/windows.js +19 -39
  52. package/dist/pwa/assets/index-499vYQvR.js +120 -0
  53. package/dist/pwa/assets/{index-CQxcuDhM.css → index-UaZFu6XL.css} +1 -1
  54. package/dist/pwa/assets/{web-DOyOiwsW.js → web-Bp48ONY3.js} +1 -1
  55. package/dist/pwa/assets/{web-D7Kq3Nvk.js → web-CyJutAy4.js} +1 -1
  56. package/dist/pwa/index.html +2 -2
  57. package/dist/pwa/service-worker.js +1 -1
  58. package/dist/rpc-handler.d.ts +0 -6
  59. package/dist/rpc-handler.js +14 -47
  60. package/dist/spawn-command.d.ts +10 -25
  61. package/dist/spawn-command.js +7 -15
  62. package/dist/task.d.ts +6 -64
  63. package/dist/task.js +7 -70
  64. package/dist/transports/http-transport.d.ts +0 -4
  65. package/dist/transports/http-transport.js +7 -28
  66. package/dist/transports/nats-transport.d.ts +0 -4
  67. package/dist/transports/nats-transport.js +3 -9
  68. package/dist/types.d.ts +3 -7
  69. package/dist/update-checker.d.ts +1 -4
  70. package/dist/update-checker.js +2 -5
  71. package/package.json +1 -1
  72. package/palmier-server/pwa/src/App.css +325 -22
  73. package/palmier-server/pwa/src/App.tsx +2 -0
  74. package/palmier-server/pwa/src/components/CapabilityToggles.tsx +288 -0
  75. package/palmier-server/pwa/src/components/HostMenu.tsx +20 -207
  76. package/palmier-server/pwa/src/components/RunDetailView.tsx +3 -3
  77. package/palmier-server/pwa/src/components/SessionComposer.tsx +11 -2
  78. package/palmier-server/pwa/src/components/SessionsView.tsx +60 -32
  79. package/palmier-server/pwa/src/components/SwipeToDeleteRow.tsx +160 -0
  80. package/palmier-server/pwa/src/components/TaskCard.tsx +1 -1
  81. package/palmier-server/pwa/src/components/TaskForm.tsx +207 -5
  82. package/palmier-server/pwa/src/components/TasksView.tsx +3 -1
  83. package/palmier-server/pwa/src/constants.ts +1 -1
  84. package/palmier-server/pwa/src/native/Device.ts +18 -2
  85. package/palmier-server/pwa/src/pages/Dashboard.tsx +13 -6
  86. package/palmier-server/pwa/src/pages/PairHost.tsx +3 -1
  87. package/palmier-server/pwa/src/pages/PairSetup.tsx +70 -0
  88. package/palmier-server/server/src/index.ts +7 -7
  89. package/palmier-server/server/src/routes/device.ts +4 -4
  90. package/palmier-server/spec.md +38 -7
  91. package/src/agents/agent.ts +0 -4
  92. package/src/agents/claude.ts +1 -1
  93. package/src/agents/codex.ts +2 -2
  94. package/src/agents/cursor.ts +1 -1
  95. package/src/agents/deepagents.ts +1 -1
  96. package/src/agents/gemini.ts +3 -2
  97. package/src/agents/goose.ts +1 -1
  98. package/src/agents/hermes.ts +1 -1
  99. package/src/agents/kiro.ts +1 -1
  100. package/src/agents/opencode.ts +1 -1
  101. package/src/agents/qoder.ts +1 -1
  102. package/src/agents/shared-prompt.ts +0 -3
  103. package/src/commands/info.ts +0 -5
  104. package/src/commands/init.ts +2 -11
  105. package/src/commands/pair.ts +3 -12
  106. package/src/commands/restart.ts +0 -3
  107. package/src/commands/run.ts +18 -65
  108. package/src/commands/serve.ts +28 -27
  109. package/src/config.ts +0 -8
  110. package/src/device-capabilities.ts +3 -2
  111. package/src/event-queues.ts +6 -21
  112. package/src/events.ts +1 -9
  113. package/src/index.ts +0 -1
  114. package/src/mcp-handler.ts +1 -2
  115. package/src/mcp-tools.ts +12 -18
  116. package/src/nats-client.ts +1 -4
  117. package/src/pending-requests.ts +4 -18
  118. package/src/platform/index.ts +5 -7
  119. package/src/platform/linux.ts +9 -20
  120. package/src/platform/macos.ts +310 -0
  121. package/src/platform/platform.ts +1 -4
  122. package/src/platform/windows.ts +19 -40
  123. package/src/rpc-handler.ts +14 -47
  124. package/src/spawn-command.ts +11 -27
  125. package/src/task.ts +7 -70
  126. package/src/transports/http-transport.ts +7 -39
  127. package/src/transports/nats-transport.ts +3 -9
  128. package/src/types.ts +3 -10
  129. package/src/update-checker.ts +2 -5
  130. package/test/macos-plist.test.ts +112 -0
  131. package/test/task-parsing.test.ts +2 -3
  132. package/test/windows-xml.test.ts +11 -12
  133. package/dist/pwa/assets/index-DQfOEB03.js +0 -120
package/CLAUDE.md CHANGED
@@ -7,3 +7,16 @@ Always read `README.md` first before starting any task.
7
7
  ## Documentation
8
8
 
9
9
  When making architectural changes, update `README.md` to reflect the new state.
10
+
11
+ ## Code comments
12
+
13
+ Default: write no comments. Well-named identifiers already explain WHAT.
14
+
15
+ Only add a comment when the WHY is non-obvious and would confuse a future reader without it — a hidden constraint, a subtle invariant, a workaround for a specific bug, or behavior that would surprise someone reading the code cold.
16
+
17
+ Keep comments timeless:
18
+ - Don't reference callers, task names, PRs, issue numbers, or "used by X". That context belongs in commit messages and PR descriptions, and rots as the codebase evolves.
19
+ - Don't narrate the current change ("added for the Y flow", "removed ...").
20
+ - Don't restate type signatures or function names in prose.
21
+
22
+ When a comment earns its place, keep it short — one or two lines is almost always enough. If a block of code needs a paragraph to explain, consider whether the code itself should be clearer.
package/README.md CHANGED
@@ -29,12 +29,12 @@ It runs on your machine as a background daemon and connects to a mobile-friendly
29
29
  ### Prerequisites
30
30
 
31
31
  - **Node.js 24+**
32
- - **Linux with systemd** or **Windows 10/11** (macOS coming soon)
32
+ - **Linux with systemd**, **macOS 13+**, or **Windows 10/11**
33
33
  - At least one supported agent CLI
34
34
 
35
35
  ## How It Works
36
36
 
37
- Palmier runs as a background daemon (systemd on Linux, Task Scheduler on Windows). It invokes your agent CLIs directly, schedules tasks via native OS timers, and exposes an API that the PWA connects to — either directly over HTTP or remotely through a relay server. Agents can interact with the user's mobile device during execution — requesting input, sending push notifications, reading SMS/notifications, managing contacts and calendar, setting alarms, and more.
37
+ Palmier runs as a background daemon (systemd on Linux, launchd on macOS, Task Scheduler on Windows). It invokes your agent CLIs directly, schedules tasks via native OS timers, and exposes an API that the PWA connects to — either directly over HTTP or remotely through a relay server. Agents can interact with the user's mobile device during execution — requesting input, sending push notifications and full-screen alarms, reading SMS/notifications, managing contacts and calendar, and more.
38
38
 
39
39
  ### MCP Server
40
40
 
@@ -48,21 +48,21 @@ Palmier exposes an [MCP](https://modelcontextprotocol.io) server at `http://loca
48
48
  | `notify` | Send a push notification to the user's device | None |
49
49
  | `request-input` | Request input from the user (blocks until response) | None |
50
50
  | `request-confirmation` | Request confirmation from the user (blocks until response) | None |
51
- | `device-geolocation` | Get GPS location of the user's mobile device | Location Access |
52
- | `read-contacts` | Read the contact list from the user's device | Contacts Access |
53
- | `create-contact` | Create a new contact on the user's device | Contacts Access |
54
- | `read-calendar` | Read calendar events (with time range filter) | Calendar Access |
55
- | `create-calendar-event` | Create a calendar event on the user's device | Calendar Access |
56
- | `send-sms-message` | Send an SMS message from the user's device | SMS Access |
57
- | `set-alarm` | Set an alarm on the user's device | None |
51
+ | `device-geolocation` | Get GPS location of the user's mobile device | Get Location |
52
+ | `read-contacts` | Read the contact list from the user's device | Manage Contacts |
53
+ | `create-contact` | Create a new contact on the user's device | Manage Contacts |
54
+ | `read-calendar` | Read calendar events (with time range filter) | Manage Calendar |
55
+ | `create-calendar-event` | Create a calendar event on the user's device | Manage Calendar |
56
+ | `send-sms-message` | Send an SMS message from the user's device | Send SMS |
57
+ | `send-alarm` | Trigger a full-screen alarm popup with ringtone on the user's device (pierces DND) | Trigger Alarms |
58
58
  | `read-battery` | Get battery level and charging status | None |
59
- | `set-ringer-mode` | Set ringer mode (normal/vibrate/silent) | Do Not Disturb Control |
59
+ | `set-ringer-mode` | Set ringer mode (normal/vibrate/silent) | Set Ringer Mode |
60
60
 
61
61
  **Available resources:**
62
62
  | Resource | URI | Permission | Description |
63
63
  |----------|-----|------------|-------------|
64
- | Device Notifications | `notifications://device` | Notification Access | Recent notifications from the user's Android device |
65
- | Device SMS | `sms-messages://device` | SMS Access | Recent SMS messages from the user's Android device |
64
+ | Device Notifications | `notifications://device` | Read Notifications | Recent notifications from the user's Android device |
65
+ | Device SMS | `sms-messages://device` | Read SMS | Recent SMS messages from the user's Android device |
66
66
 
67
67
  Resources support MCP subscriptions — clients can subscribe via `resources/subscribe` and receive real-time `notifications/resources/updated` events via the streamable HTTP transport when the resource changes.
68
68
 
@@ -148,11 +148,13 @@ The wizard:
148
148
  - Configures access modes (HTTP port, LAN access)
149
149
  - Shows a summary (including any existing scheduled tasks to recover) and asks for confirmation
150
150
  - Registers with the Palmier server, saves configuration to `~/.config/palmier/host.json`
151
- - Installs a background daemon (systemd user service on Linux, Task Scheduler on Windows)
151
+ - Installs a background daemon (systemd user service on Linux, LaunchAgent on macOS, Task Scheduler on Windows)
152
152
  - Auto-enters pair mode to connect your first device
153
153
 
154
154
  The daemon automatically recovers existing tasks by reinstalling their system timers on startup.
155
155
 
156
+ > **macOS note:** Palmier installs as a user-level LaunchAgent, so it runs without `sudo`. LaunchAgents only run while the user is logged into the GUI session — after a reboot, scheduled tasks stay dormant until you log in at least once. Enable auto-login in System Settings → Users & Groups if you need unattended operation across reboots.
157
+
156
158
  Agents are re-detected on every daemon start. Run `palmier restart` after installing or removing a CLI.
157
159
 
158
160
  ## CLI Reference
@@ -190,7 +192,7 @@ To fully remove Palmier from a machine:
190
192
 
191
193
  4. **(Optional) Remove configuration and task data:**
192
194
 
193
- **Linux:**
195
+ **Linux / macOS:**
194
196
  ```bash
195
197
  rm -rf ~/.config/palmier
196
198
  rm -rf ~/palmier # or wherever your Palmier root directory is
@@ -7,10 +7,6 @@ export interface CommandLine {
7
7
  /** Additional environment variables to set for the spawned process. */
8
8
  env?: Record<string, string>;
9
9
  }
10
- /**
11
- * Interface that each agent tool must implement.
12
- * Abstracts how plans are generated and tasks are executed across different AI agents.
13
- */
14
10
  export interface AgentTool {
15
11
  /** Return the command and args for a short, non-interactive prompt (e.g. generating a task name). */
16
12
  getPromptCommandLine(prompt: string): CommandLine;
@@ -20,7 +20,7 @@ export class ClaudeAgent {
20
20
  }
21
21
  if (followupPrompt) {
22
22
  args.push("-c");
23
- } // continue mode for followups
23
+ }
24
24
  return { command: "claude", args, stdin: prompt };
25
25
  }
26
26
  async init() {
@@ -20,8 +20,8 @@ export class CodexAgent {
20
20
  }
21
21
  if (followupPrompt) {
22
22
  args.push("resume", "--last");
23
- } // continue mode for followups
24
- args.push("-"); // read prompt from stdin
23
+ }
24
+ args.push("-");
25
25
  return { command: "codex", args, stdin: prompt };
26
26
  }
27
27
  async init() {
@@ -16,7 +16,7 @@ export class Cursor {
16
16
  }
17
17
  if (followupPrompt) {
18
18
  args.push("--continue");
19
- } // continue mode for followups
19
+ }
20
20
  args.push("-p", prompt);
21
21
  return { command: "cursor", args };
22
22
  }
@@ -16,7 +16,7 @@ export class DeepAgents {
16
16
  }
17
17
  if (followupPrompt) {
18
18
  args.push("--resume");
19
- } // continue mode for followups
19
+ }
20
20
  args.push("--non-interactive", prompt);
21
21
  return { command: "deepagents", args };
22
22
  }
@@ -21,8 +21,9 @@ export class GeminiAgent {
21
21
  }
22
22
  if (followupPrompt) {
23
23
  args.push("--resume");
24
- } // continue mode for followups
25
- args.push("--prompt", "-"); // read prompt from stdin to avoid command line length limits
24
+ }
25
+ // Read prompt from stdin to avoid command-line length limits.
26
+ args.push("--prompt", "-");
26
27
  return { command: "gemini", args, stdin: prompt };
27
28
  }
28
29
  async init() {
@@ -13,7 +13,7 @@ export class GooseAgent {
13
13
  const args = ["run"];
14
14
  if (followupPrompt) {
15
15
  args.push("--resume");
16
- } // continue mode for followups
16
+ }
17
17
  args.push("--text", prompt);
18
18
  return { command: "goose", args, ...(yolo ? { env: { GOOSE_MODE: "auto" } } : {}) };
19
19
  }
@@ -16,7 +16,7 @@ export class Hermes {
16
16
  }
17
17
  if (followupPrompt) {
18
18
  args.push("--continue");
19
- } // continue mode for followups
19
+ }
20
20
  args.push("-q", prompt);
21
21
  return { command: "hermes", args };
22
22
  }
@@ -16,7 +16,7 @@ export class Kiro {
16
16
  }
17
17
  if (followupPrompt) {
18
18
  args.push("--resume");
19
- } // continue mode for followups
19
+ }
20
20
  args.push("--no-interactive", prompt);
21
21
  return { command: "kiro-cli", args };
22
22
  }
@@ -16,7 +16,7 @@ export class OpenCodeAgent {
16
16
  }
17
17
  if (followupPrompt) {
18
18
  args.push("--continue");
19
- } // continue mode for followups
19
+ }
20
20
  args.push(prompt);
21
21
  return { command: "opencode", args };
22
22
  }
@@ -16,7 +16,7 @@ export class Qoder {
16
16
  }
17
17
  if (followupPrompt) {
18
18
  args.push("-c");
19
- } // continue mode for followups
19
+ }
20
20
  args.push("-p", prompt);
21
21
  return { command: "qodercli", args };
22
22
  }
@@ -1,7 +1,4 @@
1
1
  import type { ParsedTask } from "../types.js";
2
- /**
3
- * Build the full agent prompt: instructions + endpoint docs + task description.
4
- */
5
2
  export declare function getAgentInstructions(task: ParsedTask, skipPermissions?: boolean): string;
6
3
  export declare const TASK_SUCCESS_MARKER = "[PALMIER_TASK_SUCCESS]";
7
4
  export declare const TASK_FAILURE_MARKER = "[PALMIER_TASK_FAILURE]";
@@ -5,9 +5,6 @@ import { loadConfig } from "../config.js";
5
5
  import { generateEndpointDocs } from "../mcp-tools.js";
6
6
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
7
  const AGENT_INSTRUCTIONS_TEMPLATE = fs.readFileSync(path.join(__dirname, "agent-instructions.md"), "utf-8");
8
- /**
9
- * Build the full agent prompt: instructions + endpoint docs + task description.
10
- */
11
8
  export function getAgentInstructions(task, skipPermissions) {
12
9
  const port = loadConfig().httpPort ?? 7256;
13
10
  const taskDescription = task.frontmatter.user_prompt;
@@ -1,5 +1,2 @@
1
- /**
2
- * Print host connection info for setting up clients.
3
- */
4
1
  export declare function infoCommand(): Promise<void>;
5
2
  //# sourceMappingURL=info.d.ts.map
@@ -1,21 +1,16 @@
1
1
  import { loadConfig } from "../config.js";
2
2
  import { loadClients } from "../client-store.js";
3
- /**
4
- * Print host connection info for setting up clients.
5
- */
6
3
  export async function infoCommand() {
7
4
  const config = loadConfig();
8
5
  const clients = loadClients();
9
6
  console.log(`Host ID: ${config.hostId}`);
10
7
  console.log(`Project root: ${config.projectRoot}`);
11
- // Detected agents
12
8
  if (config.agents && config.agents.length > 0) {
13
9
  console.log(`Agents: ${config.agents.map((a) => a.label).join(", ")}`);
14
10
  }
15
11
  else {
16
12
  console.log(`Agents: (none detected — run \`palmier agents\`)`);
17
13
  }
18
- // Clients
19
14
  console.log(`Clients: ${clients.length} active`);
20
15
  if (clients.length === 0) {
21
16
  console.log("");
@@ -1,5 +1,2 @@
1
- /**
2
- * Interactive wizard to provision this host.
3
- */
4
1
  export declare function initCommand(): Promise<void>;
5
2
  //# sourceMappingURL=init.d.ts.map
@@ -10,9 +10,6 @@ const dim = (s) => `\x1b[2m${s}\x1b[0m`;
10
10
  const green = (s) => `\x1b[32m${s}\x1b[0m`;
11
11
  const cyan = (s) => `\x1b[36m${s}\x1b[0m`;
12
12
  const red = (s) => `\x1b[31m${s}\x1b[0m`;
13
- /**
14
- * Interactive wizard to provision this host.
15
- */
16
13
  export async function initCommand() {
17
14
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
18
15
  const ask = (q) => new Promise((resolve) => rl.question(q, resolve));
@@ -20,7 +17,6 @@ export async function initCommand() {
20
17
  console.log(`\n${bold("=== Palmier Host Setup ===")}\n`);
21
18
  console.log(`By continuing, you agree to the ${cyan("Terms of Service")} (https://www.palmier.me/terms)`);
22
19
  console.log(`and ${cyan("Privacy Policy")} (https://www.palmier.me/privacy).\n`);
23
- // Detect agents first — abort if none found
24
20
  console.log("Detecting installed agents...");
25
21
  const agents = await detectAgents();
26
22
  if (agents.length === 0) {
@@ -31,7 +27,6 @@ export async function initCommand() {
31
27
  process.exit(1);
32
28
  }
33
29
  console.log(` Found: ${green(agents.map((a) => a.label).join(", "))}\n`);
34
- // LAN mode
35
30
  const lanAnswer = await ask("Enable LAN access (direct HTTP from local network)? (y/N): ");
36
31
  const lanEnabled = lanAnswer.trim().toLowerCase() === "y";
37
32
  let httpPort = 7256;
@@ -40,7 +35,6 @@ export async function initCommand() {
40
35
  const parsed = parseInt(portAnswer.trim(), 10);
41
36
  if (parsed > 0 && parsed < 65536)
42
37
  httpPort = parsed;
43
- // Display summary and ask for confirmation before making any changes
44
38
  console.log(`\n${bold("Setup summary:")}\n`);
45
39
  console.log(` ${dim("Task storage:")} ${bold(process.cwd())}`);
46
40
  console.log(` All tasks and execution data will be stored here.\n`);
@@ -52,7 +46,6 @@ export async function initCommand() {
52
46
  console.log(` Accessible from other devices on your local network. Pairing required.\n`);
53
47
  }
54
48
  console.log(` ${dim("Agents:")} ${agents.map((a) => a.label).join(", ")}\n`);
55
- // Check for existing tasks to recover
56
49
  const existingTasks = listTasks(process.cwd());
57
50
  if (existingTasks.length > 0) {
58
51
  console.log(` ${dim("Recover tasks:")} ${existingTasks.length} existing task(s) found:`);
@@ -67,7 +60,6 @@ export async function initCommand() {
67
60
  rl.close();
68
61
  return;
69
62
  }
70
- // Register with server
71
63
  let existingHostId;
72
64
  try {
73
65
  existingHostId = loadConfig().hostId;
@@ -92,7 +84,6 @@ export async function initCommand() {
92
84
  }
93
85
  }
94
86
  }
95
- // Build and save config
96
87
  const config = {
97
88
  hostId: registerResponse.hostId,
98
89
  projectRoot: process.cwd(),
@@ -107,8 +98,8 @@ export async function initCommand() {
107
98
  saveConfig(config);
108
99
  console.log(`Config saved to ${dim("~/.config/palmier/host.json")}`);
109
100
  getPlatform().installDaemon(config);
110
- // Task recovery happens in the daemon (palmier serve) on startup,
111
- // since the daemon runs elevated and can create S4U scheduled tasks.
101
+ // Task recovery runs in the daemon (palmier serve) because that process
102
+ // is elevated and can create S4U scheduled tasks.
112
103
  console.log("\nStarting pairing...");
113
104
  rl.close();
114
105
  await pairCommand();
@@ -1,8 +1,5 @@
1
1
  export declare const PAIRING_EXPIRY_MS: number;
2
2
  export declare function generatePairingCode(): string;
3
- /**
4
- * Generate a pairing code and wait for a PWA client to pair.
5
- * Listens on NATS (server mode) and HTTP (via serve daemon) in parallel.
6
- */
3
+ /** Listens on NATS (server mode) and HTTP (via serve daemon) in parallel. */
7
4
  export declare function pairCommand(): Promise<void>;
8
5
  //# sourceMappingURL=pair.d.ts.map
@@ -1,4 +1,5 @@
1
1
  import * as http from "node:http";
2
+ import * as os from "node:os";
2
3
  import { StringCodec } from "nats";
3
4
  import { loadConfig } from "../config.js";
4
5
  import { connectNats } from "../nats-client.js";
@@ -16,11 +17,9 @@ function buildPairResponse(config, label) {
16
17
  return {
17
18
  hostId: config.hostId,
18
19
  clientToken: client.token,
20
+ hostName: os.hostname(),
19
21
  };
20
22
  }
21
- /**
22
- * POST to the running serve daemon and long-poll until paired or expired.
23
- */
24
23
  function httpPairRegister(port, code) {
25
24
  const body = JSON.stringify({ code, expiryMs: PAIRING_EXPIRY_MS });
26
25
  return new Promise((resolve) => {
@@ -49,10 +48,7 @@ function httpPairRegister(port, code) {
49
48
  req.end(body);
50
49
  });
51
50
  }
52
- /**
53
- * Generate a pairing code and wait for a PWA client to pair.
54
- * Listens on NATS (server mode) and HTTP (via serve daemon) in parallel.
55
- */
51
+ /** Listens on NATS (server mode) and HTTP (via serve daemon) in parallel. */
56
52
  export async function pairCommand() {
57
53
  const config = loadConfig();
58
54
  const code = generatePairingCode();
@@ -63,14 +59,12 @@ export async function pairCommand() {
63
59
  console.log("Paired successfully!");
64
60
  }
65
61
  const cleanups = [];
66
- // Display pairing info
67
62
  console.log("");
68
63
  console.log("Enter this code in your Palmier app:");
69
64
  console.log("");
70
65
  console.log(` ${code}`);
71
66
  console.log("");
72
67
  console.log("Code expires in 1 minute.");
73
- // NATS pairing (server mode)
74
68
  const nc = await connectNats(config);
75
69
  const sc = StringCodec();
76
70
  const subject = `pair.${code}`;
@@ -98,13 +92,11 @@ export async function pairCommand() {
98
92
  onPaired();
99
93
  }
100
94
  })();
101
- // HTTP pairing — register with serve daemon's /pair-register endpoint
102
95
  (async () => {
103
96
  const result = await httpPairRegister(httpPort, code);
104
97
  if (result)
105
98
  onPaired();
106
99
  })();
107
- // Wait for pairing or timeout
108
100
  const start = Date.now();
109
101
  await new Promise((resolve) => {
110
102
  const interval = setInterval(() => {
@@ -114,7 +106,6 @@ export async function pairCommand() {
114
106
  }
115
107
  }, 500);
116
108
  });
117
- // Cleanup
118
109
  for (const cleanup of cleanups) {
119
110
  await cleanup();
120
111
  }
@@ -1,5 +1,2 @@
1
- /**
2
- * Restart the palmier serve daemon.
3
- */
4
1
  export declare function restartCommand(): Promise<void>;
5
2
  //# sourceMappingURL=restart.d.ts.map
@@ -1,7 +1,4 @@
1
1
  import { getPlatform } from "../platform/index.js";
2
- /**
3
- * Restart the palmier serve daemon.
4
- */
5
2
  export async function restartCommand() {
6
3
  const platform = getPlatform();
7
4
  await platform.restartDaemon();
@@ -1,21 +1,8 @@
1
1
  import type { TaskRunningState, RequiredPermission } from "../types.js";
2
- /**
3
- * Strip [PALMIER_*] marker lines from agent output.
4
- */
5
2
  export declare function stripPalmierMarkers(output: string): string;
6
- /**
7
- * Execute a task by ID.
8
- */
9
3
  export declare function runCommand(taskId: string): Promise<void>;
10
4
  export declare function parseReportFiles(output: string): string[];
11
- /**
12
- * Extract required permissions from agent output.
13
- * Looks for lines matching: [PALMIER_PERMISSION] <tool> | <description>
14
- */
15
5
  export declare function parsePermissions(output: string): RequiredPermission[];
16
- /**
17
- * Parse the agent's output for success/failure markers.
18
- * Falls back to "finished" if no marker is found.
19
- */
6
+ /** Falls back to "finished" if no success/failure marker is found. */
20
7
  export declare function parseTaskOutcome(output: string): TaskRunningState;
21
8
  //# sourceMappingURL=run.d.ts.map