palmier 0.8.1 → 0.8.3
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 +11 -11
- 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/app-registry.d.ts +10 -0
- package/dist/app-registry.js +44 -0
- 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 +1 -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 +33 -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 +1 -4
- package/dist/platform/linux.d.ts +3 -9
- package/dist/platform/linux.js +9 -20
- 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-CQxcuDhM.css → index-B0F9mtid.css} +1 -1
- package/dist/pwa/assets/index-SYs3mcdJ.js +120 -0
- package/dist/pwa/assets/{web-D7Kq3Nvk.js → web-C6lkQj9J.js} +1 -1
- package/dist/pwa/assets/{web-DOyOiwsW.js → web-Z1623me-.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 +18 -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 +6 -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 +165 -20
- package/palmier-server/pwa/src/components/HostMenu.tsx +159 -49
- package/palmier-server/pwa/src/components/RunDetailView.tsx +3 -3
- package/palmier-server/pwa/src/components/SessionsView.tsx +57 -31
- package/palmier-server/pwa/src/components/SwipeToDeleteRow.tsx +160 -0
- package/palmier-server/pwa/src/components/TaskForm.tsx +152 -2
- package/palmier-server/pwa/src/constants.ts +1 -1
- package/palmier-server/pwa/src/native/Device.ts +20 -2
- package/palmier-server/pwa/src/pages/Dashboard.tsx +11 -6
- 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/app-registry.ts +52 -0
- package/src/commands/info.ts +0 -5
- package/src/commands/init.ts +2 -11
- package/src/commands/pair.ts +1 -12
- package/src/commands/restart.ts +0 -3
- package/src/commands/run.ts +18 -65
- package/src/commands/serve.ts +31 -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 +1 -4
- package/src/platform/linux.ts +9 -20
- package/src/platform/platform.ts +1 -4
- package/src/platform/windows.ts +19 -40
- package/src/rpc-handler.ts +19 -47
- package/src/spawn-command.ts +11 -27
- package/src/task.ts +7 -70
- package/src/transports/http-transport.ts +6 -39
- package/src/transports/nats-transport.ts +3 -9
- package/src/types.ts +3 -10
- package/src/update-checker.ts +2 -5
- 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
|
@@ -34,7 +34,7 @@ It runs on your machine as a background daemon and connects to a mobile-friendly
|
|
|
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, 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
|
|
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;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Persistent cache of packageName → appName pairs seen via device notifications. */
|
|
2
|
+
export interface AppInfo {
|
|
3
|
+
packageName: string;
|
|
4
|
+
appName: string;
|
|
5
|
+
}
|
|
6
|
+
/** Writes only on change so we track the latest label if an app renames itself. */
|
|
7
|
+
export declare function recordApp(packageName: string, appName: string): void;
|
|
8
|
+
export declare function listApps(): AppInfo[];
|
|
9
|
+
export declare function getAppName(packageName: string): string | undefined;
|
|
10
|
+
//# sourceMappingURL=app-registry.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as fs from "fs";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
import { CONFIG_DIR } from "./config.js";
|
|
4
|
+
const REGISTRY_FILE = path.join(CONFIG_DIR, "app-registry.json");
|
|
5
|
+
let cache = null;
|
|
6
|
+
function load() {
|
|
7
|
+
if (cache)
|
|
8
|
+
return cache;
|
|
9
|
+
try {
|
|
10
|
+
if (fs.existsSync(REGISTRY_FILE)) {
|
|
11
|
+
cache = JSON.parse(fs.readFileSync(REGISTRY_FILE, "utf-8"));
|
|
12
|
+
return cache;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
// Corrupt file — start fresh rather than fail notifications.
|
|
17
|
+
}
|
|
18
|
+
cache = {};
|
|
19
|
+
return cache;
|
|
20
|
+
}
|
|
21
|
+
function persist(map) {
|
|
22
|
+
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
23
|
+
fs.writeFileSync(REGISTRY_FILE, JSON.stringify(map, null, 2), "utf-8");
|
|
24
|
+
}
|
|
25
|
+
/** Writes only on change so we track the latest label if an app renames itself. */
|
|
26
|
+
export function recordApp(packageName, appName) {
|
|
27
|
+
if (!packageName || !appName)
|
|
28
|
+
return;
|
|
29
|
+
const map = load();
|
|
30
|
+
if (map[packageName] === appName)
|
|
31
|
+
return;
|
|
32
|
+
map[packageName] = appName;
|
|
33
|
+
persist(map);
|
|
34
|
+
}
|
|
35
|
+
export function listApps() {
|
|
36
|
+
const map = load();
|
|
37
|
+
return Object.entries(map)
|
|
38
|
+
.map(([packageName, appName]) => ({ packageName, appName }))
|
|
39
|
+
.sort((a, b) => a.appName.localeCompare(b.appName));
|
|
40
|
+
}
|
|
41
|
+
export function getAppName(packageName) {
|
|
42
|
+
return load()[packageName];
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=app-registry.js.map
|
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
|
@@ -18,9 +18,6 @@ function buildPairResponse(config, label) {
|
|
|
18
18
|
clientToken: client.token,
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
22
|
-
* POST to the running serve daemon and long-poll until paired or expired.
|
|
23
|
-
*/
|
|
24
21
|
function httpPairRegister(port, code) {
|
|
25
22
|
const body = JSON.stringify({ code, expiryMs: PAIRING_EXPIRY_MS });
|
|
26
23
|
return new Promise((resolve) => {
|
|
@@ -49,10 +46,7 @@ function httpPairRegister(port, code) {
|
|
|
49
46
|
req.end(body);
|
|
50
47
|
});
|
|
51
48
|
}
|
|
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
|
-
*/
|
|
49
|
+
/** Listens on NATS (server mode) and HTTP (via serve daemon) in parallel. */
|
|
56
50
|
export async function pairCommand() {
|
|
57
51
|
const config = loadConfig();
|
|
58
52
|
const code = generatePairingCode();
|
|
@@ -63,14 +57,12 @@ export async function pairCommand() {
|
|
|
63
57
|
console.log("Paired successfully!");
|
|
64
58
|
}
|
|
65
59
|
const cleanups = [];
|
|
66
|
-
// Display pairing info
|
|
67
60
|
console.log("");
|
|
68
61
|
console.log("Enter this code in your Palmier app:");
|
|
69
62
|
console.log("");
|
|
70
63
|
console.log(` ${code}`);
|
|
71
64
|
console.log("");
|
|
72
65
|
console.log("Code expires in 1 minute.");
|
|
73
|
-
// NATS pairing (server mode)
|
|
74
66
|
const nc = await connectNats(config);
|
|
75
67
|
const sc = StringCodec();
|
|
76
68
|
const subject = `pair.${code}`;
|
|
@@ -98,13 +90,11 @@ export async function pairCommand() {
|
|
|
98
90
|
onPaired();
|
|
99
91
|
}
|
|
100
92
|
})();
|
|
101
|
-
// HTTP pairing — register with serve daemon's /pair-register endpoint
|
|
102
93
|
(async () => {
|
|
103
94
|
const result = await httpPairRegister(httpPort, code);
|
|
104
95
|
if (result)
|
|
105
96
|
onPaired();
|
|
106
97
|
})();
|
|
107
|
-
// Wait for pairing or timeout
|
|
108
98
|
const start = Date.now();
|
|
109
99
|
await new Promise((resolve) => {
|
|
110
100
|
const interval = setInterval(() => {
|
|
@@ -114,7 +104,6 @@ export async function pairCommand() {
|
|
|
114
104
|
}
|
|
115
105
|
}, 500);
|
|
116
106
|
});
|
|
117
|
-
// Cleanup
|
|
118
107
|
for (const cleanup of cleanups) {
|
|
119
108
|
await cleanup();
|
|
120
109
|
}
|
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
|