palmier 0.7.6 → 0.7.8

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 (122) hide show
  1. package/dist/agents/agent.d.ts +3 -0
  2. package/dist/agents/agent.js +1 -1
  3. package/dist/agents/aider.d.ts +1 -0
  4. package/dist/agents/aider.js +1 -0
  5. package/dist/agents/claude.d.ts +1 -0
  6. package/dist/agents/claude.js +1 -0
  7. package/dist/agents/cline.d.ts +1 -0
  8. package/dist/agents/cline.js +1 -0
  9. package/dist/agents/codex.d.ts +1 -0
  10. package/dist/agents/codex.js +1 -0
  11. package/dist/agents/copilot.d.ts +1 -0
  12. package/dist/agents/copilot.js +1 -0
  13. package/dist/agents/cursor.d.ts +1 -0
  14. package/dist/agents/cursor.js +1 -0
  15. package/dist/agents/deepagents.d.ts +1 -0
  16. package/dist/agents/deepagents.js +1 -0
  17. package/dist/agents/droid.d.ts +1 -0
  18. package/dist/agents/droid.js +1 -0
  19. package/dist/agents/gemini.d.ts +1 -0
  20. package/dist/agents/gemini.js +1 -0
  21. package/dist/agents/goose.d.ts +1 -0
  22. package/dist/agents/goose.js +1 -0
  23. package/dist/agents/hermes.d.ts +1 -0
  24. package/dist/agents/hermes.js +1 -0
  25. package/dist/agents/kimi.d.ts +1 -0
  26. package/dist/agents/kimi.js +1 -0
  27. package/dist/agents/kiro.d.ts +1 -0
  28. package/dist/agents/kiro.js +1 -0
  29. package/dist/agents/openclaw.d.ts +1 -0
  30. package/dist/agents/openclaw.js +2 -2
  31. package/dist/agents/opencode.d.ts +1 -0
  32. package/dist/agents/opencode.js +1 -0
  33. package/dist/agents/qoder.d.ts +1 -0
  34. package/dist/agents/qoder.js +1 -0
  35. package/dist/agents/qwen.d.ts +1 -0
  36. package/dist/agents/qwen.js +1 -0
  37. package/dist/agents/shared-prompt.js +1 -1
  38. package/dist/commands/init.js +3 -2
  39. package/dist/commands/pair.js +3 -3
  40. package/dist/commands/run.js +4 -4
  41. package/dist/commands/serve.js +1 -1
  42. package/dist/config.js +2 -2
  43. package/dist/device-capabilities.d.ts +1 -1
  44. package/dist/events.js +1 -1
  45. package/dist/mcp-tools.js +79 -7
  46. package/dist/nats-client.d.ts +1 -1
  47. package/dist/nats-client.js +6 -3
  48. package/dist/pending-requests.d.ts +30 -8
  49. package/dist/pending-requests.js +28 -15
  50. package/dist/pwa/assets/index-8cTctVnD.js +120 -0
  51. package/dist/pwa/assets/index-CSUkBBsQ.css +1 -0
  52. package/dist/pwa/assets/{web-DnuoxUd4.js → web-BNr628AV.js} +1 -1
  53. package/dist/pwa/assets/{web-7raT3zOZ.js → web-DyQPewAi.js} +1 -1
  54. package/dist/pwa/index.html +2 -2
  55. package/dist/pwa/service-worker.js +1 -1
  56. package/dist/rpc-handler.js +12 -16
  57. package/dist/transports/http-transport.js +6 -3
  58. package/dist/types.d.ts +4 -1
  59. package/package.json +1 -1
  60. package/palmier-server/PRODUCTION.md +31 -28
  61. package/palmier-server/README.md +35 -5
  62. package/palmier-server/nats.conf +9 -5
  63. package/palmier-server/package.json +2 -1
  64. package/palmier-server/pnpm-lock.yaml +6 -0
  65. package/palmier-server/pwa/src/App.css +66 -0
  66. package/palmier-server/pwa/src/App.tsx +1 -0
  67. package/palmier-server/pwa/src/components/HostMenu.tsx +65 -2
  68. package/palmier-server/pwa/src/components/RunsView.tsx +48 -22
  69. package/palmier-server/pwa/src/components/SessionComposer.tsx +137 -0
  70. package/palmier-server/pwa/src/components/TabBar.tsx +17 -10
  71. package/palmier-server/pwa/src/components/TaskForm.tsx +11 -66
  72. package/palmier-server/pwa/src/components/TaskListView.tsx +17 -283
  73. package/palmier-server/pwa/src/constants.ts +1 -1
  74. package/palmier-server/pwa/src/contexts/HostConnectionContext.tsx +9 -5
  75. package/palmier-server/pwa/src/draftGuard.ts +24 -0
  76. package/palmier-server/pwa/src/pages/Dashboard.tsx +335 -12
  77. package/palmier-server/pwa/src/pages/PairHost.tsx +6 -3
  78. package/palmier-server/pwa/src/types.ts +1 -6
  79. package/palmier-server/server/package.json +3 -1
  80. package/palmier-server/server/src/index.ts +83 -2
  81. package/palmier-server/server/src/nats-jwt.ts +299 -0
  82. package/palmier-server/server/src/nats-setup.ts +48 -0
  83. package/palmier-server/server/src/nats.ts +12 -4
  84. package/palmier-server/server/src/routes/device.ts +24 -0
  85. package/palmier-server/server/src/routes/hosts.ts +13 -2
  86. package/palmier-server/spec.md +28 -14
  87. package/src/agents/agent.ts +5 -1
  88. package/src/agents/aider.ts +1 -0
  89. package/src/agents/claude.ts +1 -0
  90. package/src/agents/cline.ts +1 -0
  91. package/src/agents/codex.ts +1 -0
  92. package/src/agents/copilot.ts +1 -0
  93. package/src/agents/cursor.ts +1 -0
  94. package/src/agents/deepagents.ts +1 -0
  95. package/src/agents/droid.ts +1 -0
  96. package/src/agents/gemini.ts +1 -0
  97. package/src/agents/goose.ts +1 -0
  98. package/src/agents/hermes.ts +1 -0
  99. package/src/agents/kimi.ts +1 -0
  100. package/src/agents/kiro.ts +1 -0
  101. package/src/agents/openclaw.ts +2 -2
  102. package/src/agents/opencode.ts +1 -0
  103. package/src/agents/qoder.ts +1 -0
  104. package/src/agents/qwen.ts +1 -0
  105. package/src/agents/shared-prompt.ts +1 -1
  106. package/src/commands/init.ts +7 -5
  107. package/src/commands/pair.ts +3 -3
  108. package/src/commands/run.ts +4 -4
  109. package/src/commands/serve.ts +1 -1
  110. package/src/config.ts +2 -2
  111. package/src/device-capabilities.ts +1 -0
  112. package/src/events.ts +1 -1
  113. package/src/mcp-tools.ts +83 -7
  114. package/src/nats-client.ts +10 -3
  115. package/src/pending-requests.ts +47 -15
  116. package/src/rpc-handler.ts +13 -16
  117. package/src/transports/http-transport.ts +6 -3
  118. package/src/types.ts +4 -3
  119. package/test/agent-instructions.test.ts +10 -10
  120. package/test/pairing.test.ts +2 -2
  121. package/dist/pwa/assets/index-B-ByUHPS.css +0 -1
  122. package/dist/pwa/assets/index-uSwkmHBs.js +0 -118
@@ -1,11 +1,14 @@
1
- import { connect } from "nats";
1
+ import { connect, jwtAuthenticator } from "nats";
2
2
  /**
3
- * Connect to NATS using the host config's TCP URL and token auth.
3
+ * Connect to NATS using the host config's JWT credentials.
4
4
  */
5
5
  export async function connectNats(config) {
6
+ if (!config.natsJwt || !config.natsNkeySeed) {
7
+ throw new Error("NATS JWT credentials not configured. Re-run palmier init.");
8
+ }
6
9
  const nc = await connect({
7
10
  servers: config.natsUrl,
8
- token: config.natsToken,
11
+ authenticator: jwtAuthenticator(config.natsJwt, new TextEncoder().encode(config.natsNkeySeed)),
9
12
  });
10
13
  // Do not log anything as that will pollute stdout for mcp server.
11
14
  return nc;
@@ -1,27 +1,49 @@
1
1
  import type { RequiredPermission } from "./types.js";
2
+ export interface PendingRequestMeta {
3
+ /** Doubles as task_id for permission-type entries (the key the task uses). */
4
+ session_id?: string;
5
+ /** Human-readable label for whoever opened the prompt — agent name for
6
+ * confirm/input, task name for permission. */
7
+ session_name?: string;
8
+ description?: string;
9
+ input_questions?: string[];
10
+ }
2
11
  export interface PendingRequest {
3
12
  type: "confirmation" | "permission" | "input";
4
13
  resolve: (value: string[]) => void;
5
14
  /** Permission list (for 'permission') or input descriptions (for 'input'). */
6
15
  params?: RequiredPermission[] | string[];
16
+ /** Display context for PWAs that connect while this request is already open. */
17
+ meta?: PendingRequestMeta;
7
18
  }
8
19
  /**
9
- * Register a pending request for a task. Returns a Promise that resolves
10
- * when `resolvePending` is called with the user's response.
11
- * Only one pending request per task at a time.
20
+ * Register a pending request keyed by either a sessionId (confirmation / input)
21
+ * or a taskId (permission). The `meta` is surfaced to PWAs that connect after
22
+ * the request was opened, so their modals can render without replaying events.
23
+ * Only one pending request per key at a time.
12
24
  */
13
- export declare function registerPending(taskId: string, type: PendingRequest["type"], params?: PendingRequest["params"]): Promise<string[]>;
25
+ export declare function registerPending(key: string, type: PendingRequest["type"], params?: PendingRequest["params"], meta?: PendingRequestMeta): Promise<string[]>;
14
26
  /**
15
27
  * Resolve a pending request with the user's response.
16
28
  * Returns true if a pending request was found and resolved.
17
29
  */
18
- export declare function resolvePending(taskId: string, value: string[]): boolean;
30
+ export declare function resolvePending(key: string, value: string[]): boolean;
19
31
  /**
20
- * Get the current pending request for a task (if any).
32
+ * Get the current pending request for a key (if any).
21
33
  */
22
- export declare function getPending(taskId: string): PendingRequest | undefined;
34
+ export declare function getPending(key: string): PendingRequest | undefined;
23
35
  /**
24
36
  * Remove a pending request without resolving it.
25
37
  */
26
- export declare function removePending(taskId: string): void;
38
+ export declare function removePending(key: string): void;
39
+ /**
40
+ * List all currently-pending requests, stripped of the unserializable `resolve`
41
+ * callback. Used by `host.info` so the PWA can seed its modal state on connect.
42
+ */
43
+ export declare function listPending(): Array<{
44
+ key: string;
45
+ type: PendingRequest["type"];
46
+ params?: PendingRequest["params"];
47
+ meta?: PendingRequestMeta;
48
+ }>;
27
49
  //# sourceMappingURL=pending-requests.d.ts.map
@@ -1,39 +1,52 @@
1
1
  const pending = new Map();
2
2
  /**
3
- * Register a pending request for a task. Returns a Promise that resolves
4
- * when `resolvePending` is called with the user's response.
5
- * Only one pending request per task at a time.
3
+ * Register a pending request keyed by either a sessionId (confirmation / input)
4
+ * or a taskId (permission). The `meta` is surfaced to PWAs that connect after
5
+ * the request was opened, so their modals can render without replaying events.
6
+ * Only one pending request per key at a time.
6
7
  */
7
- export function registerPending(taskId, type, params) {
8
- if (pending.has(taskId)) {
9
- return Promise.reject(new Error(`Task ${taskId} already has a pending request`));
8
+ export function registerPending(key, type, params, meta) {
9
+ if (pending.has(key)) {
10
+ return Promise.reject(new Error(`Key ${key} already has a pending request`));
10
11
  }
11
12
  return new Promise((resolve) => {
12
- pending.set(taskId, { type, resolve, params });
13
+ pending.set(key, { type, resolve, params, meta });
13
14
  });
14
15
  }
15
16
  /**
16
17
  * Resolve a pending request with the user's response.
17
18
  * Returns true if a pending request was found and resolved.
18
19
  */
19
- export function resolvePending(taskId, value) {
20
- const entry = pending.get(taskId);
20
+ export function resolvePending(key, value) {
21
+ const entry = pending.get(key);
21
22
  if (!entry)
22
23
  return false;
23
- pending.delete(taskId);
24
+ pending.delete(key);
24
25
  entry.resolve(value);
25
26
  return true;
26
27
  }
27
28
  /**
28
- * Get the current pending request for a task (if any).
29
+ * Get the current pending request for a key (if any).
29
30
  */
30
- export function getPending(taskId) {
31
- return pending.get(taskId);
31
+ export function getPending(key) {
32
+ return pending.get(key);
32
33
  }
33
34
  /**
34
35
  * Remove a pending request without resolving it.
35
36
  */
36
- export function removePending(taskId) {
37
- pending.delete(taskId);
37
+ export function removePending(key) {
38
+ pending.delete(key);
39
+ }
40
+ /**
41
+ * List all currently-pending requests, stripped of the unserializable `resolve`
42
+ * callback. Used by `host.info` so the PWA can seed its modal state on connect.
43
+ */
44
+ export function listPending() {
45
+ return [...pending.entries()].map(([key, entry]) => ({
46
+ key,
47
+ type: entry.type,
48
+ params: entry.params,
49
+ meta: entry.meta,
50
+ }));
38
51
  }
39
52
  //# sourceMappingURL=pending-requests.js.map