@pruddiman/hem 0.0.1-beta-95d42fc → 0.0.1-beta-7ae1e11

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.
@@ -20,11 +20,20 @@
20
20
  */
21
21
  import type { Provider, ProviderConfig } from "./types.js";
22
22
  /** Permission request kind from the Copilot SDK. */
23
- type PermissionKind = "shell" | "write" | "mcp" | "read" | "url" | "custom-tool";
24
- /** Minimal permission request shape. */
23
+ type PermissionKind = "shell" | "write" | "mcp" | "read" | "url" | "custom-tool" | "memory" | "hook";
24
+ /**
25
+ * Minimal permission request shape.
26
+ *
27
+ * Mirrors the discriminated union from `@github/copilot-sdk` (defined in
28
+ * `generated/session-events.d.ts` as `PermissionRequest*`). The 0.3.0 SDK
29
+ * carries the shell command text in `fullCommandText` (not `command`); the
30
+ * old singular `command` field never existed in the published types, so
31
+ * agents were silently rejected for every `mkdir`/`touch` they tried.
32
+ */
25
33
  interface PermissionRequest {
26
34
  kind: PermissionKind;
27
- command?: string;
35
+ /** Present on `kind: "shell"` — the full shell command text. */
36
+ fullCommandText?: string;
28
37
  [key: string]: unknown;
29
38
  }
30
39
  /**
@@ -88,6 +97,10 @@ export interface CopilotClientLike {
88
97
  permissionDecision?: string;
89
98
  } | void> | void;
90
99
  };
100
+ /** Disable persistent infinite-session workspace; hem sessions are single-shot. */
101
+ infiniteSessions?: {
102
+ enabled: boolean;
103
+ };
91
104
  }): Promise<CopilotSessionLike>;
92
105
  deleteSession(sessionId: string): Promise<void>;
93
106
  on(eventType: string, handler: (...args: unknown[]) => void): () => void;
@@ -326,11 +326,18 @@ export class CopilotProvider {
326
326
  ? { kind: "approve-once" }
327
327
  : { kind: "reject" };
328
328
  case "shell": {
329
- const cmd = request.command ?? "";
329
+ const cmd = request.fullCommandText ?? "";
330
330
  return agentAllowsShell(agent, cmd)
331
331
  ? { kind: "approve-once" }
332
332
  : { kind: "reject" };
333
333
  }
334
+ case "memory":
335
+ case "hook":
336
+ // Both are SDK-internal mechanisms (agent self-memory and
337
+ // pre/post-tool-use hook permissions). Approve so the agent can
338
+ // run its own lifecycle plumbing — the per-tool permissions
339
+ // above are what gate user-visible side effects.
340
+ return { kind: "approve-once" };
334
341
  case "url":
335
342
  return agentAllowsWebfetch(agent)
336
343
  ? { kind: "approve-once" }
@@ -362,6 +369,15 @@ export class CopilotProvider {
362
369
  return {
363
370
  ...(modelId ? { model: modelId } : {}),
364
371
  workingDirectory: this._config.destinationPath,
372
+ // Disable infinite-session persistence: hem sessions are single-shot
373
+ // doc-generation runs, not resumable chats. With the SDK default
374
+ // (enabled: true) every tool-use event gets written to a workspace
375
+ // log on disk; the on-disk schema requires `ephemeral: true` on
376
+ // certain event types (e.g. `session.idle`), and any mismatch leaves
377
+ // a "Session file is corrupted" file in VS Code's Copilot session
378
+ // picker. Disabling also avoids the persist round-trip on every
379
+ // tool call, which is dead weight for our use case.
380
+ infiniteSessions: { enabled: false },
365
381
  mcpServers: {
366
382
  "hem-broadcast": {
367
383
  type: "local",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pruddiman/hem",
3
- "version": "0.0.1-beta-95d42fc",
3
+ "version": "0.0.1-beta-7ae1e11",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "hem": "./dist/index.js"
@@ -24,7 +24,6 @@
24
24
  "@github/copilot-sdk": "^0.3.0",
25
25
  "@modelcontextprotocol/sdk": "^1.26.0",
26
26
  "@opencode-ai/sdk": "^1.14.48",
27
- "@pruddiman/hem": "^0.0.1-beta-1aff12a",
28
27
  "better-sqlite3": "^12.8.0",
29
28
  "commander": "^14.0.3",
30
29
  "fast-glob": "^3.3.3",