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.
- package/CLAUDE.md +13 -0
- package/README.md +16 -14
- package/dist/agents/agent.d.ts +0 -4
- package/dist/agents/claude.js +1 -1
- package/dist/agents/codex.js +2 -2
- package/dist/agents/cursor.js +1 -1
- package/dist/agents/deepagents.js +1 -1
- package/dist/agents/gemini.js +3 -2
- package/dist/agents/goose.js +1 -1
- package/dist/agents/hermes.js +1 -1
- package/dist/agents/kiro.js +1 -1
- package/dist/agents/opencode.js +1 -1
- package/dist/agents/qoder.js +1 -1
- package/dist/agents/shared-prompt.d.ts +0 -3
- package/dist/agents/shared-prompt.js +0 -3
- package/dist/commands/info.d.ts +0 -3
- package/dist/commands/info.js +0 -5
- package/dist/commands/init.d.ts +0 -3
- package/dist/commands/init.js +2 -11
- package/dist/commands/pair.d.ts +1 -4
- package/dist/commands/pair.js +3 -12
- package/dist/commands/restart.d.ts +0 -3
- package/dist/commands/restart.js +0 -3
- package/dist/commands/run.d.ts +1 -14
- package/dist/commands/run.js +18 -61
- package/dist/commands/serve.d.ts +0 -3
- package/dist/commands/serve.js +29 -27
- package/dist/config.d.ts +0 -8
- package/dist/config.js +0 -8
- package/dist/device-capabilities.d.ts +1 -1
- package/dist/event-queues.d.ts +6 -21
- package/dist/event-queues.js +6 -21
- package/dist/events.d.ts +0 -6
- package/dist/events.js +1 -9
- package/dist/index.js +0 -1
- package/dist/mcp-handler.js +1 -2
- package/dist/mcp-tools.d.ts +0 -3
- package/dist/mcp-tools.js +12 -16
- package/dist/nats-client.d.ts +0 -3
- package/dist/nats-client.js +1 -4
- package/dist/pending-requests.d.ts +4 -18
- package/dist/pending-requests.js +4 -18
- package/dist/platform/index.d.ts +1 -4
- package/dist/platform/index.js +8 -7
- package/dist/platform/linux.d.ts +3 -9
- package/dist/platform/linux.js +9 -20
- package/dist/platform/macos.d.ts +32 -0
- package/dist/platform/macos.js +287 -0
- package/dist/platform/platform.d.ts +1 -4
- package/dist/platform/windows.d.ts +2 -5
- package/dist/platform/windows.js +19 -39
- package/dist/pwa/assets/index-499vYQvR.js +120 -0
- package/dist/pwa/assets/{index-CQxcuDhM.css → index-UaZFu6XL.css} +1 -1
- package/dist/pwa/assets/{web-DOyOiwsW.js → web-Bp48ONY3.js} +1 -1
- package/dist/pwa/assets/{web-D7Kq3Nvk.js → web-CyJutAy4.js} +1 -1
- package/dist/pwa/index.html +2 -2
- package/dist/pwa/service-worker.js +1 -1
- package/dist/rpc-handler.d.ts +0 -6
- package/dist/rpc-handler.js +14 -47
- package/dist/spawn-command.d.ts +10 -25
- package/dist/spawn-command.js +7 -15
- package/dist/task.d.ts +6 -64
- package/dist/task.js +7 -70
- package/dist/transports/http-transport.d.ts +0 -4
- package/dist/transports/http-transport.js +7 -28
- package/dist/transports/nats-transport.d.ts +0 -4
- package/dist/transports/nats-transport.js +3 -9
- package/dist/types.d.ts +3 -7
- package/dist/update-checker.d.ts +1 -4
- package/dist/update-checker.js +2 -5
- package/package.json +1 -1
- package/palmier-server/pwa/src/App.css +325 -22
- package/palmier-server/pwa/src/App.tsx +2 -0
- package/palmier-server/pwa/src/components/CapabilityToggles.tsx +288 -0
- package/palmier-server/pwa/src/components/HostMenu.tsx +20 -207
- package/palmier-server/pwa/src/components/RunDetailView.tsx +3 -3
- package/palmier-server/pwa/src/components/SessionComposer.tsx +11 -2
- package/palmier-server/pwa/src/components/SessionsView.tsx +60 -32
- package/palmier-server/pwa/src/components/SwipeToDeleteRow.tsx +160 -0
- package/palmier-server/pwa/src/components/TaskCard.tsx +1 -1
- package/palmier-server/pwa/src/components/TaskForm.tsx +207 -5
- package/palmier-server/pwa/src/components/TasksView.tsx +3 -1
- package/palmier-server/pwa/src/constants.ts +1 -1
- package/palmier-server/pwa/src/native/Device.ts +18 -2
- package/palmier-server/pwa/src/pages/Dashboard.tsx +13 -6
- package/palmier-server/pwa/src/pages/PairHost.tsx +3 -1
- package/palmier-server/pwa/src/pages/PairSetup.tsx +70 -0
- package/palmier-server/server/src/index.ts +7 -7
- package/palmier-server/server/src/routes/device.ts +4 -4
- package/palmier-server/spec.md +38 -7
- package/src/agents/agent.ts +0 -4
- package/src/agents/claude.ts +1 -1
- package/src/agents/codex.ts +2 -2
- package/src/agents/cursor.ts +1 -1
- package/src/agents/deepagents.ts +1 -1
- package/src/agents/gemini.ts +3 -2
- package/src/agents/goose.ts +1 -1
- package/src/agents/hermes.ts +1 -1
- package/src/agents/kiro.ts +1 -1
- package/src/agents/opencode.ts +1 -1
- package/src/agents/qoder.ts +1 -1
- package/src/agents/shared-prompt.ts +0 -3
- package/src/commands/info.ts +0 -5
- package/src/commands/init.ts +2 -11
- package/src/commands/pair.ts +3 -12
- package/src/commands/restart.ts +0 -3
- package/src/commands/run.ts +18 -65
- package/src/commands/serve.ts +28 -27
- package/src/config.ts +0 -8
- package/src/device-capabilities.ts +3 -2
- package/src/event-queues.ts +6 -21
- package/src/events.ts +1 -9
- package/src/index.ts +0 -1
- package/src/mcp-handler.ts +1 -2
- package/src/mcp-tools.ts +12 -18
- package/src/nats-client.ts +1 -4
- package/src/pending-requests.ts +4 -18
- package/src/platform/index.ts +5 -7
- package/src/platform/linux.ts +9 -20
- package/src/platform/macos.ts +310 -0
- package/src/platform/platform.ts +1 -4
- package/src/platform/windows.ts +19 -40
- package/src/rpc-handler.ts +14 -47
- package/src/spawn-command.ts +11 -27
- package/src/task.ts +7 -70
- package/src/transports/http-transport.ts +7 -39
- package/src/transports/nats-transport.ts +3 -9
- package/src/types.ts +3 -10
- package/src/update-checker.ts +2 -5
- package/test/macos-plist.test.ts +112 -0
- package/test/task-parsing.test.ts +2 -3
- package/test/windows-xml.test.ts +11 -12
- 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**
|
|
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,
|
|
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
|
|
52
|
-
| `read-contacts` | Read the contact list from the user's device | Contacts
|
|
53
|
-
| `create-contact` | Create a new contact on the user's device | Contacts
|
|
54
|
-
| `read-calendar` | Read calendar events (with time range filter) | Calendar
|
|
55
|
-
| `create-calendar-event` | Create a calendar event on the user's device | Calendar
|
|
56
|
-
| `send-sms-message` | Send an SMS message from the user's device | SMS
|
|
57
|
-
| `
|
|
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) |
|
|
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` |
|
|
65
|
-
| Device SMS | `sms-messages://device` | SMS
|
|
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
|
package/dist/agents/agent.d.ts
CHANGED
|
@@ -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;
|
package/dist/agents/claude.js
CHANGED
package/dist/agents/codex.js
CHANGED
|
@@ -20,8 +20,8 @@ export class CodexAgent {
|
|
|
20
20
|
}
|
|
21
21
|
if (followupPrompt) {
|
|
22
22
|
args.push("resume", "--last");
|
|
23
|
-
}
|
|
24
|
-
args.push("-");
|
|
23
|
+
}
|
|
24
|
+
args.push("-");
|
|
25
25
|
return { command: "codex", args, stdin: prompt };
|
|
26
26
|
}
|
|
27
27
|
async init() {
|
package/dist/agents/cursor.js
CHANGED
package/dist/agents/gemini.js
CHANGED
|
@@ -21,8 +21,9 @@ export class GeminiAgent {
|
|
|
21
21
|
}
|
|
22
22
|
if (followupPrompt) {
|
|
23
23
|
args.push("--resume");
|
|
24
|
-
}
|
|
25
|
-
|
|
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() {
|
package/dist/agents/goose.js
CHANGED
|
@@ -13,7 +13,7 @@ export class GooseAgent {
|
|
|
13
13
|
const args = ["run"];
|
|
14
14
|
if (followupPrompt) {
|
|
15
15
|
args.push("--resume");
|
|
16
|
-
}
|
|
16
|
+
}
|
|
17
17
|
args.push("--text", prompt);
|
|
18
18
|
return { command: "goose", args, ...(yolo ? { env: { GOOSE_MODE: "auto" } } : {}) };
|
|
19
19
|
}
|
package/dist/agents/hermes.js
CHANGED
package/dist/agents/kiro.js
CHANGED
package/dist/agents/opencode.js
CHANGED
package/dist/agents/qoder.js
CHANGED
|
@@ -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;
|
package/dist/commands/info.d.ts
CHANGED
package/dist/commands/info.js
CHANGED
|
@@ -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("");
|
package/dist/commands/init.d.ts
CHANGED
package/dist/commands/init.js
CHANGED
|
@@ -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
|
|
111
|
-
//
|
|
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();
|
package/dist/commands/pair.d.ts
CHANGED
|
@@ -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
|
package/dist/commands/pair.js
CHANGED
|
@@ -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
|
}
|
package/dist/commands/restart.js
CHANGED
package/dist/commands/run.d.ts
CHANGED
|
@@ -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
|