palmier 0.2.3 → 0.2.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/README.md +9 -14
- package/dist/commands/pair.js +3 -3
- package/package.json +1 -1
- package/src/commands/pair.ts +4 -3
package/README.md
CHANGED
|
@@ -112,20 +112,15 @@ cat ~/.config/palmier/host.json
|
|
|
112
112
|
|
|
113
113
|
## How It Works
|
|
114
114
|
|
|
115
|
-
- The host runs as a **systemd user service**, staying alive in the background
|
|
116
|
-
-
|
|
117
|
-
- **
|
|
118
|
-
- **
|
|
119
|
-
-
|
|
120
|
-
- **
|
|
121
|
-
- **Run history** — each
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
- **Triggers can be enabled/disabled** via the `triggers_enabled` frontmatter field (default `true`). When disabled, systemd timers are removed; when re-enabled, they are reinstalled. Tasks can still be run manually regardless.
|
|
125
|
-
- Incoming tasks are stored as `TASK.md` files in a local `tasks/` directory.
|
|
126
|
-
- Task execution is abstracted through an **`AgentTool` interface** (`src/agents/agent.ts`). Each task stores an `agent` field (e.g., `"claude"`) that selects which agent implementation constructs the full command line and arguments. The agent's `getTaskRunCommandLine(task)` method builds the appropriate flags (e.g., `--allowedTools` for Claude based on task permissions). The process is spawned without a shell, and stdin is closed to prevent tools from hanging on an open pipe. The spawned process inherits the default physical GUI session environment (`DISPLAY=:0`) so commands that launch graphical applications (e.g., headed browsers) run within the user's desktop session. Task lifecycle status (`start`, `finish`, `abort`, `fail`) is persisted to a `status.json` file in the task directory. Status changes are broadcast on a unified `host-event.<host_id>.<task_id>` subject via NATS pub/sub (when available) and/or pushed through SSE (in LAN/auto mode) by `run.ts` POSTing to the serve process's `/internal/event` endpoint. All events carry an `event_type` field (`"running-state"`, `"confirm-request"`, or `"confirm-resolved"`) with the same payload shape on both transports. Consumers (PWA, Web Server) subscribe to these notifications and fetch full status from the host via the `task.status` RPC.
|
|
127
|
-
- **Task confirmation** — tasks with `requires_confirmation: true` set `pending_confirmation: true` in `status.json` before execution. A `confirm-request` event is published on `host-event` so the Web Server can send push notifications and connected PWA clients show a confirmation dialog. The user confirms or aborts via the PWA, which calls the `task.user_input` RPC on the host. The `serve` process sets `user_input` to the user's response (e.g., `"confirmed"` or `"aborted"`), and `run` watches the file for `user_input` to become defined, then updates `running_state` accordingly.
|
|
128
|
-
- **MCP server** (`palmier mcpserver`) — starts an MCP server over stdio that exposes platform tools to AI agents (e.g., Claude Code). In NATS/auto mode, connects to NATS on startup. Currently exposes a `send-email` tool that relays email requests to the Web Server via NATS (`host.<host_id>.email.send`).
|
|
115
|
+
- The host runs as a **systemd user service**, staying alive in the background via `palmier serve`.
|
|
116
|
+
- **Paired devices** communicate with the host via NATS (cloud-routed) and/or direct HTTP (LAN), depending on the connection mode. Each paired device gets a session token that authenticates all requests.
|
|
117
|
+
- **Tasks** are stored locally as Markdown files in a `tasks/` directory. Each task has a name, prompt, execution plan, and optional triggers (cron schedules or one-time dates).
|
|
118
|
+
- **Plan generation** is automatic — when you create or update a task, the host invokes your chosen agent CLI to generate an execution plan and name.
|
|
119
|
+
- **Triggers** are backed by systemd timers. You can enable/disable them without deleting the task, and any task can still be run manually at any time.
|
|
120
|
+
- **Task confirmation** — tasks can optionally require your approval before running. You'll get a push notification (NATS mode) or a prompt in the PWA to confirm or abort.
|
|
121
|
+
- **Run history** — each run produces a timestamped result file. You can view results and reports from the PWA.
|
|
122
|
+
- **Real-time updates** — task status changes (started, finished, failed) are pushed to connected PWA clients via NATS pub/sub or SSE.
|
|
123
|
+
- **MCP server** (`palmier mcpserver`) exposes platform tools (e.g., `send-email`) to AI agents like Claude Code over stdio.
|
|
129
124
|
|
|
130
125
|
## Project Structure
|
|
131
126
|
|
package/dist/commands/pair.js
CHANGED
|
@@ -92,9 +92,9 @@ export async function pairCommand() {
|
|
|
92
92
|
const sc = StringCodec();
|
|
93
93
|
const subject = `pair.${code}`;
|
|
94
94
|
const sub = nc.subscribe(subject, { max: 1 });
|
|
95
|
-
cleanups.push(
|
|
95
|
+
cleanups.push(() => {
|
|
96
96
|
sub.unsubscribe();
|
|
97
|
-
|
|
97
|
+
nc.close();
|
|
98
98
|
});
|
|
99
99
|
(async () => {
|
|
100
100
|
for await (const msg of sub) {
|
|
@@ -141,7 +141,7 @@ export async function pairCommand() {
|
|
|
141
141
|
}
|
|
142
142
|
if (!paired) {
|
|
143
143
|
console.log("Code expired. Run `palmier pair` to try again.");
|
|
144
|
-
process.exit(1);
|
|
145
144
|
}
|
|
145
|
+
process.exit(paired ? 0 : 1);
|
|
146
146
|
}
|
|
147
147
|
//# sourceMappingURL=pair.js.map
|
package/package.json
CHANGED
package/src/commands/pair.ts
CHANGED
|
@@ -115,9 +115,9 @@ export async function pairCommand(): Promise<void> {
|
|
|
115
115
|
const subject = `pair.${code}`;
|
|
116
116
|
const sub = nc.subscribe(subject, { max: 1 });
|
|
117
117
|
|
|
118
|
-
cleanups.push(
|
|
118
|
+
cleanups.push(() => {
|
|
119
119
|
sub.unsubscribe();
|
|
120
|
-
|
|
120
|
+
nc.close();
|
|
121
121
|
});
|
|
122
122
|
|
|
123
123
|
(async () => {
|
|
@@ -167,6 +167,7 @@ export async function pairCommand(): Promise<void> {
|
|
|
167
167
|
|
|
168
168
|
if (!paired) {
|
|
169
169
|
console.log("Code expired. Run `palmier pair` to try again.");
|
|
170
|
-
process.exit(1);
|
|
171
170
|
}
|
|
171
|
+
|
|
172
|
+
process.exit(paired ? 0 : 1);
|
|
172
173
|
}
|