palmier 0.6.8 → 0.7.0
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 -2
- package/dist/agents/agent.d.ts +2 -2
- package/dist/agents/aider.d.ts +1 -1
- package/dist/agents/aider.js +2 -5
- package/dist/agents/claude.d.ts +1 -1
- package/dist/agents/claude.js +2 -5
- package/dist/agents/cline.d.ts +1 -1
- package/dist/agents/cline.js +2 -5
- package/dist/agents/codex.d.ts +1 -1
- package/dist/agents/codex.js +2 -5
- package/dist/agents/copilot.d.ts +1 -1
- package/dist/agents/copilot.js +2 -5
- package/dist/agents/cursor.d.ts +1 -1
- package/dist/agents/cursor.js +2 -5
- package/dist/agents/deepagents.d.ts +1 -1
- package/dist/agents/deepagents.js +2 -5
- package/dist/agents/droid.d.ts +1 -1
- package/dist/agents/droid.js +2 -5
- package/dist/agents/gemini.d.ts +1 -1
- package/dist/agents/gemini.js +2 -5
- package/dist/agents/goose.d.ts +1 -1
- package/dist/agents/goose.js +2 -5
- package/dist/agents/hermes.d.ts +1 -1
- package/dist/agents/hermes.js +2 -5
- package/dist/agents/kimi.d.ts +1 -1
- package/dist/agents/kimi.js +2 -5
- package/dist/agents/kiro.d.ts +1 -1
- package/dist/agents/kiro.js +2 -5
- package/dist/agents/openclaw.d.ts +1 -1
- package/dist/agents/openclaw.js +2 -5
- package/dist/agents/opencode.d.ts +1 -1
- package/dist/agents/opencode.js +2 -5
- package/dist/agents/qoder.d.ts +1 -1
- package/dist/agents/qoder.js +2 -5
- package/dist/agents/qwen.d.ts +1 -1
- package/dist/agents/qwen.js +2 -5
- package/dist/agents/shared-prompt.js +1 -1
- package/dist/commands/run.js +1 -2
- package/dist/commands/serve.js +16 -0
- package/dist/mcp-handler.d.ts +3 -0
- package/dist/mcp-handler.js +59 -3
- package/dist/mcp-tools.d.ts +16 -1
- package/dist/mcp-tools.js +24 -2
- package/dist/notification-store.d.ts +13 -0
- package/dist/notification-store.js +19 -0
- package/dist/pwa/assets/{index-C8vJwUNi.js → index-DLxrL0hR.js} +42 -42
- package/dist/pwa/assets/{web-NxTETXZK.js → web-CBI458eN.js} +1 -1
- package/dist/pwa/assets/{web-6UChJFov.js → web-HDs03L2B.js} +1 -1
- package/dist/pwa/index.html +1 -1
- package/dist/pwa/service-worker.js +1 -1
- package/dist/rpc-handler.js +27 -67
- package/dist/task.js +2 -3
- package/dist/transports/http-transport.js +51 -3
- package/dist/types.d.ts +0 -1
- package/package.json +2 -2
- package/palmier-server/README.md +1 -1
- package/palmier-server/pwa/src/components/PlanDialog.tsx +5 -12
- package/palmier-server/pwa/src/components/TaskForm.tsx +6 -15
- package/palmier-server/pwa/src/constants.ts +1 -1
- package/palmier-server/pwa/src/types.ts +0 -1
- package/palmier-server/server/src/index.ts +2 -0
- package/palmier-server/server/src/routes/device.ts +32 -0
- package/palmier-server/spec.md +13 -12
- package/src/agents/agent.ts +2 -2
- package/src/agents/aider.ts +2 -5
- package/src/agents/claude.ts +2 -5
- package/src/agents/cline.ts +2 -5
- package/src/agents/codex.ts +2 -5
- package/src/agents/copilot.ts +2 -5
- package/src/agents/cursor.ts +2 -5
- package/src/agents/deepagents.ts +2 -5
- package/src/agents/droid.ts +2 -5
- package/src/agents/gemini.ts +2 -5
- package/src/agents/goose.ts +2 -5
- package/src/agents/hermes.ts +2 -5
- package/src/agents/kimi.ts +2 -5
- package/src/agents/kiro.ts +2 -5
- package/src/agents/openclaw.ts +2 -5
- package/src/agents/opencode.ts +2 -5
- package/src/agents/qoder.ts +2 -5
- package/src/agents/qwen.ts +2 -5
- package/src/agents/shared-prompt.ts +1 -1
- package/src/commands/run.ts +1 -2
- package/src/commands/serve.ts +16 -1
- package/src/mcp-handler.ts +68 -3
- package/src/mcp-tools.ts +48 -2
- package/src/notification-store.ts +30 -0
- package/src/rpc-handler.ts +29 -71
- package/src/task.ts +2 -3
- package/src/transports/http-transport.ts +49 -3
- package/src/types.ts +0 -1
- package/test/agent-instructions.test.ts +117 -19
- package/test/agent-output-parsing.test.ts +1 -0
- package/test/notification-store.test.ts +57 -0
- package/test/task-parsing.test.ts +3 -3
- package/dist/commands/plan-generation.md +0 -22
- package/src/commands/plan-generation.md +0 -22
- package/test/fixtures/agent-instructions-snapshot.md +0 -58
package/dist/mcp-tools.d.ts
CHANGED
|
@@ -20,8 +20,23 @@ export interface ToolDefinition {
|
|
|
20
20
|
}
|
|
21
21
|
export declare const agentTools: ToolDefinition[];
|
|
22
22
|
export declare const agentToolMap: Map<string, ToolDefinition>;
|
|
23
|
+
export interface ResourceDefinition {
|
|
24
|
+
/** MCP resource URI (e.g. "notifications://device"). */
|
|
25
|
+
uri: string;
|
|
26
|
+
/** Display name. */
|
|
27
|
+
name: string;
|
|
28
|
+
/** First line is the summary (used as REST endpoint header). Remaining lines become bullet points in docs. */
|
|
29
|
+
description: string[];
|
|
30
|
+
mimeType: string;
|
|
31
|
+
/** REST endpoint path (e.g. "/notifications"). Served as GET. */
|
|
32
|
+
restPath: string;
|
|
33
|
+
/** Return the current resource content. */
|
|
34
|
+
read: () => unknown;
|
|
35
|
+
}
|
|
36
|
+
export declare const agentResources: ResourceDefinition[];
|
|
37
|
+
export declare const agentResourceMap: Map<string, ResourceDefinition>;
|
|
23
38
|
/**
|
|
24
39
|
* Generate the HTTP Endpoints markdown section for agent-instructions.md from the tool registry.
|
|
25
40
|
*/
|
|
26
|
-
export declare function generateEndpointDocs(port: number, taskId: string): string;
|
|
41
|
+
export declare function generateEndpointDocs(port: number, taskId: string, tools?: ToolDefinition[], resources?: ResourceDefinition[]): string;
|
|
27
42
|
//# sourceMappingURL=mcp-tools.d.ts.map
|
package/dist/mcp-tools.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StringCodec } from "nats";
|
|
2
2
|
import { registerPending } from "./pending-requests.js";
|
|
3
3
|
import { getLocationDevice } from "./location-device.js";
|
|
4
|
+
import { getNotifications } from "./notification-store.js";
|
|
4
5
|
export class ToolError extends Error {
|
|
5
6
|
statusCode;
|
|
6
7
|
constructor(message, statusCode = 500) {
|
|
@@ -172,16 +173,29 @@ const deviceGeolocationTool = {
|
|
|
172
173
|
};
|
|
173
174
|
export const agentTools = [notifyTool, requestInputTool, requestConfirmationTool, deviceGeolocationTool];
|
|
174
175
|
export const agentToolMap = new Map(agentTools.map((t) => [t.name, t]));
|
|
176
|
+
const deviceNotificationsResource = {
|
|
177
|
+
uri: "notifications://device",
|
|
178
|
+
name: "Device Notifications",
|
|
179
|
+
description: [
|
|
180
|
+
"Get recent notifications from the user's Android device.",
|
|
181
|
+
"Response: JSON array of notification objects with `id`, `packageName`, `appName`, `title`, `text`, `timestamp`.",
|
|
182
|
+
],
|
|
183
|
+
mimeType: "application/json",
|
|
184
|
+
restPath: "/notifications",
|
|
185
|
+
read: getNotifications,
|
|
186
|
+
};
|
|
187
|
+
export const agentResources = [deviceNotificationsResource];
|
|
188
|
+
export const agentResourceMap = new Map(agentResources.map((r) => [r.uri, r]));
|
|
175
189
|
/**
|
|
176
190
|
* Generate the HTTP Endpoints markdown section for agent-instructions.md from the tool registry.
|
|
177
191
|
*/
|
|
178
|
-
export function generateEndpointDocs(port, taskId) {
|
|
192
|
+
export function generateEndpointDocs(port, taskId, tools = agentTools, resources = agentResources) {
|
|
179
193
|
const baseUrl = `http://localhost:${port}`;
|
|
180
194
|
const lines = [
|
|
181
195
|
`The following HTTP endpoints are available during task execution. Use curl to call them.`,
|
|
182
196
|
"",
|
|
183
197
|
];
|
|
184
|
-
for (const tool of
|
|
198
|
+
for (const tool of tools) {
|
|
185
199
|
const schema = tool.inputSchema;
|
|
186
200
|
const props = schema.properties ?? {};
|
|
187
201
|
const required = new Set(schema.required ?? []);
|
|
@@ -213,6 +227,14 @@ export function generateEndpointDocs(port, taskId) {
|
|
|
213
227
|
}
|
|
214
228
|
lines.push("");
|
|
215
229
|
}
|
|
230
|
+
for (const resource of resources) {
|
|
231
|
+
const [header, ...details] = resource.description;
|
|
232
|
+
lines.push(`**\`GET ${baseUrl}${resource.restPath}\`** — ${header}`);
|
|
233
|
+
for (const detail of details) {
|
|
234
|
+
lines.push(`- ${detail}`);
|
|
235
|
+
}
|
|
236
|
+
lines.push("");
|
|
237
|
+
}
|
|
216
238
|
return lines.join("\n").trimEnd();
|
|
217
239
|
}
|
|
218
240
|
//# sourceMappingURL=mcp-tools.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface DeviceNotification {
|
|
2
|
+
id: string;
|
|
3
|
+
packageName: string;
|
|
4
|
+
appName: string;
|
|
5
|
+
title: string;
|
|
6
|
+
text: string;
|
|
7
|
+
timestamp: number;
|
|
8
|
+
receivedAt: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function addNotification(n: DeviceNotification): void;
|
|
11
|
+
export declare function getNotifications(): DeviceNotification[];
|
|
12
|
+
export declare function onNotificationsChanged(cb: () => void): () => void;
|
|
13
|
+
//# sourceMappingURL=notification-store.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const MAX_NOTIFICATIONS = 50;
|
|
2
|
+
const notifications = [];
|
|
3
|
+
const listeners = new Set();
|
|
4
|
+
export function addNotification(n) {
|
|
5
|
+
notifications.push(n);
|
|
6
|
+
if (notifications.length > MAX_NOTIFICATIONS) {
|
|
7
|
+
notifications.shift();
|
|
8
|
+
}
|
|
9
|
+
for (const cb of listeners)
|
|
10
|
+
cb();
|
|
11
|
+
}
|
|
12
|
+
export function getNotifications() {
|
|
13
|
+
return [...notifications];
|
|
14
|
+
}
|
|
15
|
+
export function onNotificationsChanged(cb) {
|
|
16
|
+
listeners.add(cb);
|
|
17
|
+
return () => { listeners.delete(cb); };
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=notification-store.js.map
|