@gotgenes/pi-permission-system 7.1.3 → 7.1.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/package.json +6 -2
  3. package/src/handlers/gates/bash-external-directory.ts +4 -4
  4. package/src/handlers/gates/bash-path-extractor.ts +1 -1
  5. package/src/handlers/gates/bash-path.ts +4 -4
  6. package/src/handlers/gates/descriptor.ts +6 -6
  7. package/src/handlers/gates/external-directory.ts +2 -2
  8. package/src/handlers/gates/helpers.ts +2 -2
  9. package/src/handlers/gates/path.ts +4 -4
  10. package/src/handlers/gates/runner.ts +4 -4
  11. package/src/handlers/gates/skill-read.ts +5 -5
  12. package/src/handlers/gates/tool.ts +5 -5
  13. package/src/wildcard-matcher.ts +2 -2
  14. package/{tests → test}/active-agent.test.ts +1 -1
  15. package/{tests → test}/bash-arity.test.ts +4 -4
  16. package/{tests → test}/bash-external-directory.test.ts +3 -3
  17. package/{tests → test}/common.test.ts +1 -1
  18. package/{tests → test}/config-loader.test.ts +1 -1
  19. package/{tests → test}/config-modal.test.ts +3 -3
  20. package/{tests → test}/config-paths.test.ts +1 -1
  21. package/{tests → test}/config-reporter.test.ts +4 -4
  22. package/{tests → test}/denial-messages.test.ts +2 -2
  23. package/{tests → test}/expand-home.test.ts +1 -1
  24. package/{tests → test}/extension-config.test.ts +1 -1
  25. package/{tests → test}/extension-paths.test.ts +2 -2
  26. package/{tests → test}/forwarded-permissions/io.test.ts +2 -2
  27. package/{tests → test}/forwarding-manager.test.ts +1 -1
  28. package/{tests → test}/handlers/before-agent-start.test.ts +4 -4
  29. package/{tests → test}/handlers/external-directory-integration.test.ts +7 -7
  30. package/{tests → test}/handlers/external-directory-session-dedup.test.ts +6 -6
  31. package/{tests → test}/handlers/gates/bash-external-directory.test.ts +5 -8
  32. package/{tests → test}/handlers/gates/bash-path.test.ts +6 -9
  33. package/{tests → test}/handlers/gates/external-directory-messages.test.ts +1 -1
  34. package/{tests → test}/handlers/gates/external-directory.test.ts +4 -7
  35. package/{tests → test}/handlers/gates/helpers.test.ts +1 -1
  36. package/{tests → test}/handlers/gates/path.test.ts +6 -6
  37. package/{tests → test}/handlers/gates/runner.test.ts +5 -5
  38. package/{tests → test}/handlers/gates/skill-read.test.ts +4 -4
  39. package/{tests → test}/handlers/gates/tool.test.ts +3 -3
  40. package/{tests → test}/handlers/input-events.test.ts +6 -6
  41. package/{tests → test}/handlers/input.test.ts +4 -4
  42. package/{tests → test}/handlers/lifecycle.test.ts +2 -2
  43. package/{tests → test}/handlers/tool-call-events.test.ts +6 -6
  44. package/{tests → test}/handlers/tool-call.test.ts +4 -4
  45. package/{tests → test}/input-normalizer.test.ts +2 -2
  46. package/{tests → test}/mcp-targets.test.ts +1 -1
  47. package/{tests → test}/node-modules-discovery.test.ts +1 -1
  48. package/{tests → test}/normalize.test.ts +1 -1
  49. package/{tests → test}/path-utils.test.ts +1 -1
  50. package/{tests → test}/pattern-suggest.test.ts +1 -1
  51. package/{tests → test}/permission-dialog.test.ts +1 -1
  52. package/{tests → test}/permission-event-rpc.test.ts +3 -3
  53. package/{tests → test}/permission-events.test.ts +4 -4
  54. package/{tests → test}/permission-forwarding.test.ts +1 -1
  55. package/{tests → test}/permission-gate.test.ts +2 -2
  56. package/{tests → test}/permission-manager-unified.test.ts +5 -5
  57. package/{tests → test}/permission-merge.test.ts +1 -1
  58. package/{tests → test}/permission-prompter.test.ts +4 -4
  59. package/{tests → test}/permission-prompts.test.ts +4 -4
  60. package/{tests → test}/permission-session.test.ts +7 -7
  61. package/{tests → test}/permission-system.test.ts +13 -13
  62. package/{tests → test}/pi-infrastructure-read.test.ts +2 -2
  63. package/{tests → test}/policy-loader.test.ts +1 -1
  64. package/{tests → test}/rule.test.ts +2 -2
  65. package/{tests → test}/runtime.test.ts +4 -4
  66. package/{tests → test}/service.test.ts +4 -4
  67. package/{tests → test}/session-logger.test.ts +2 -2
  68. package/{tests → test}/session-rules.test.ts +2 -2
  69. package/{tests → test}/session-start.test.ts +4 -4
  70. package/{tests → test}/skill-prompt-sanitizer.test.ts +3 -3
  71. package/{tests → test}/subagent-context.test.ts +2 -2
  72. package/{tests → test}/synthesize.test.ts +3 -3
  73. package/{tests → test}/system-prompt-sanitizer.test.ts +1 -1
  74. package/{tests → test}/tool-input-preview.test.ts +3 -3
  75. package/{tests → test}/tool-registry.test.ts +1 -1
  76. package/{tests → test}/wildcard-matcher.test.ts +1 -1
  77. package/{tests → test}/yolo-mode.test.ts +2 -2
@@ -4,12 +4,12 @@
4
4
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
5
5
  import { describe, expect, it, vi } from "vitest";
6
6
 
7
- import { PermissionGateHandler } from "../../src/handlers/permission-gate-handler";
8
- import type { PermissionDecisionEvent } from "../../src/permission-events";
9
- import { PERMISSIONS_DECISION_CHANNEL } from "../../src/permission-events";
10
- import type { PermissionSession } from "../../src/permission-session";
11
- import type { ToolRegistry } from "../../src/tool-registry";
12
- import type { PermissionState } from "../../src/types";
7
+ import { PermissionGateHandler } from "#src/handlers/permission-gate-handler";
8
+ import type { PermissionDecisionEvent } from "#src/permission-events";
9
+ import { PERMISSIONS_DECISION_CHANNEL } from "#src/permission-events";
10
+ import type { PermissionSession } from "#src/permission-session";
11
+ import type { ToolRegistry } from "#src/tool-registry";
12
+ import type { PermissionState } from "#src/types";
13
13
 
14
14
  // ── helpers ────────────────────────────────────────────────────────────────
15
15
 
@@ -4,10 +4,10 @@ import { describe, expect, it, vi } from "vitest";
4
4
  import {
5
5
  extractSkillNameFromInput,
6
6
  PermissionGateHandler,
7
- } from "../../src/handlers/permission-gate-handler";
8
- import type { PermissionSession } from "../../src/permission-session";
9
- import type { ToolRegistry } from "../../src/tool-registry";
10
- import type { PermissionState } from "../../src/types";
7
+ } from "#src/handlers/permission-gate-handler";
8
+ import type { PermissionSession } from "#src/permission-session";
9
+ import type { ToolRegistry } from "#src/tool-registry";
10
+ import type { PermissionState } from "#src/types";
11
11
 
12
12
  // ── helpers ────────────────────────────────────────────────────────────────
13
13
 
@@ -1,7 +1,7 @@
1
1
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
2
  import { describe, expect, it, vi } from "vitest";
3
- import { SessionLifecycleHandler } from "../../src/handlers/lifecycle";
4
- import type { PermissionSession } from "../../src/permission-session";
3
+ import { SessionLifecycleHandler } from "#src/handlers/lifecycle";
4
+ import type { PermissionSession } from "#src/permission-session";
5
5
 
6
6
  // ── status stub ────────────────────────────────────────────────────────────
7
7
  vi.mock("../../src/status", () => ({
@@ -5,12 +5,12 @@
5
5
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
6
6
  import { describe, expect, it, vi } from "vitest";
7
7
 
8
- import { PermissionGateHandler } from "../../src/handlers/permission-gate-handler";
9
- import type { PermissionDecisionEvent } from "../../src/permission-events";
10
- import { PERMISSIONS_DECISION_CHANNEL } from "../../src/permission-events";
11
- import type { PermissionSession } from "../../src/permission-session";
12
- import type { ToolRegistry } from "../../src/tool-registry";
13
- import type { PermissionCheckResult, PermissionState } from "../../src/types";
8
+ import { PermissionGateHandler } from "#src/handlers/permission-gate-handler";
9
+ import type { PermissionDecisionEvent } from "#src/permission-events";
10
+ import { PERMISSIONS_DECISION_CHANNEL } from "#src/permission-events";
11
+ import type { PermissionSession } from "#src/permission-session";
12
+ import type { ToolRegistry } from "#src/tool-registry";
13
+ import type { PermissionCheckResult, PermissionState } from "#src/types";
14
14
 
15
15
  // ── helpers ────────────────────────────────────────────────────────────────
16
16
 
@@ -4,10 +4,10 @@ import { describe, expect, it, vi } from "vitest";
4
4
  import {
5
5
  getEventInput,
6
6
  PermissionGateHandler,
7
- } from "../../src/handlers/permission-gate-handler";
8
- import type { PermissionSession } from "../../src/permission-session";
9
- import type { ToolRegistry } from "../../src/tool-registry";
10
- import type { PermissionCheckResult, PermissionState } from "../../src/types";
7
+ } from "#src/handlers/permission-gate-handler";
8
+ import type { PermissionSession } from "#src/permission-session";
9
+ import type { ToolRegistry } from "#src/tool-registry";
10
+ import type { PermissionCheckResult, PermissionState } from "#src/types";
11
11
 
12
12
  // ── SDK stubs ──────────────────────────────────────────────────────────────
13
13
  vi.mock("@earendil-works/pi-coding-agent", async (importOriginal) => {
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it } from "vitest";
2
- import { normalizeInput } from "../src/input-normalizer";
3
- import { createMcpPermissionTargets } from "../src/mcp-targets";
2
+ import { normalizeInput } from "#src/input-normalizer";
3
+ import { createMcpPermissionTargets } from "#src/mcp-targets";
4
4
 
5
5
  describe("normalizeInput — non-MCP surfaces", () => {
6
6
  describe("special / path", () => {
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
2
2
  import {
3
3
  createMcpPermissionTargets,
4
4
  parseQualifiedMcpToolName,
5
- } from "../src/mcp-targets";
5
+ } from "#src/mcp-targets";
6
6
 
7
7
  describe("parseQualifiedMcpToolName", () => {
8
8
  it("returns server and tool for a valid qualified name", () => {
@@ -18,7 +18,7 @@ vi.mock("node:fs", () => ({
18
18
  default: { existsSync: mockExistsSync },
19
19
  }));
20
20
 
21
- import { discoverGlobalNodeModulesRoot } from "../src/node-modules-discovery";
21
+ import { discoverGlobalNodeModulesRoot } from "#src/node-modules-discovery";
22
22
 
23
23
  describe("discoverGlobalNodeModulesRoot", () => {
24
24
  beforeEach(() => {
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, test } from "vitest";
2
- import { normalizeFlatConfig } from "../src/normalize";
2
+ import { normalizeFlatConfig } from "#src/normalize";
3
3
 
4
4
  describe("normalizeFlatConfig", () => {
5
5
  describe("string shorthand", () => {
@@ -20,7 +20,7 @@ import {
20
20
  PATH_BEARING_TOOLS,
21
21
  READ_ONLY_PATH_BEARING_TOOLS,
22
22
  SAFE_SYSTEM_PATHS,
23
- } from "../src/path-utils";
23
+ } from "#src/path-utils";
24
24
 
25
25
  describe("normalizePathForComparison", () => {
26
26
  const cwd = "/projects/my-app";
@@ -3,7 +3,7 @@ import {
3
3
  suggestBashPattern,
4
4
  suggestMcpPattern,
5
5
  suggestSessionPattern,
6
- } from "../src/pattern-suggest";
6
+ } from "#src/pattern-suggest";
7
7
 
8
8
  describe("suggestBashPattern", () => {
9
9
  it("returns <command> <subcommand> * using the arity table", () => {
@@ -5,7 +5,7 @@ import {
5
5
  normalizePermissionDenialReason,
6
6
  type PermissionDecisionUi,
7
7
  requestPermissionDecisionFromUi,
8
- } from "../src/permission-dialog";
8
+ } from "#src/permission-dialog";
9
9
 
10
10
  describe("isPermissionDecisionState", () => {
11
11
  it("accepts approved", () => {
@@ -3,16 +3,16 @@ import { describe, expect, it, vi } from "vitest";
3
3
  import {
4
4
  type PermissionRpcDeps,
5
5
  registerPermissionRpcHandlers,
6
- } from "../src/permission-event-rpc";
6
+ } from "#src/permission-event-rpc";
7
7
  import type {
8
8
  PermissionsCheckReplyData,
9
9
  PermissionsRpcReply,
10
- } from "../src/permission-events";
10
+ } from "#src/permission-events";
11
11
  import {
12
12
  PERMISSIONS_PROTOCOL_VERSION,
13
13
  PERMISSIONS_RPC_CHECK_CHANNEL,
14
14
  PERMISSIONS_RPC_PROMPT_CHANNEL,
15
- } from "../src/permission-events";
15
+ } from "#src/permission-events";
16
16
 
17
17
  // ── Helpers ────────────────────────────────────────────────────────────────
18
18
 
@@ -3,8 +3,8 @@ import { tmpdir } from "node:os";
3
3
  import { dirname, join } from "node:path";
4
4
  import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
5
5
 
6
- import { getGlobalConfigPath } from "../src/config-paths";
7
- import piPermissionSystemExtension from "../src/index";
6
+ import { getGlobalConfigPath } from "#src/config-paths";
7
+ import piPermissionSystemExtension from "#src/index";
8
8
  import type {
9
9
  PermissionDecisionEvent,
10
10
  PermissionsCheckReplyData,
@@ -13,7 +13,7 @@ import type {
13
13
  PermissionsPromptRequest,
14
14
  PermissionsReadyEvent,
15
15
  PermissionsRpcReply,
16
- } from "../src/permission-events";
16
+ } from "#src/permission-events";
17
17
  import {
18
18
  emitDecisionEvent,
19
19
  emitReadyEvent,
@@ -22,7 +22,7 @@ import {
22
22
  PERMISSIONS_READY_CHANNEL,
23
23
  PERMISSIONS_RPC_CHECK_CHANNEL,
24
24
  PERMISSIONS_RPC_PROMPT_CHANNEL,
25
- } from "../src/permission-events";
25
+ } from "#src/permission-events";
26
26
 
27
27
  // ── Minimal EventBus stub ──────────────────────────────────────────────────
28
28
 
@@ -3,7 +3,7 @@ import {
3
3
  resolvePermissionForwardingTargetSessionId,
4
4
  SUBAGENT_PARENT_SESSION_ENV_CANDIDATES,
5
5
  SUBAGENT_PARENT_SESSION_ENV_KEY,
6
- } from "../src/permission-forwarding";
6
+ } from "#src/permission-forwarding";
7
7
 
8
8
  afterEach(() => {
9
9
  vi.unstubAllEnvs();
@@ -1,9 +1,9 @@
1
1
  import { describe, expect, it, vi } from "vitest";
2
- import type { PermissionPromptDecision } from "../src/permission-dialog";
2
+ import type { PermissionPromptDecision } from "#src/permission-dialog";
3
3
  import {
4
4
  applyPermissionGate,
5
5
  type PermissionGateParams,
6
- } from "../src/permission-gate";
6
+ } from "#src/permission-gate";
7
7
 
8
8
  function makeParams(
9
9
  overrides: Partial<PermissionGateParams> = {},
@@ -8,8 +8,8 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
8
8
  import { homedir, tmpdir } from "node:os";
9
9
  import { join } from "node:path";
10
10
  import { describe, expect, it } from "vitest";
11
- import { PermissionManager } from "../src/permission-manager";
12
- import type { Rule, Ruleset } from "../src/rule";
11
+ import { PermissionManager } from "#src/permission-manager";
12
+ import type { Rule, Ruleset } from "#src/rule";
13
13
 
14
14
  // ---------------------------------------------------------------------------
15
15
  // Helpers
@@ -666,9 +666,9 @@ describe("checkPermission — rule origin provenance", () => {
666
666
  // In-memory PolicyLoader stub tests — no filesystem required
667
667
  // ---------------------------------------------------------------------------
668
668
 
669
- import type { PolicyLoader } from "../src/permission-manager";
670
- import type { ResolvedPolicyPaths } from "../src/policy-loader";
671
- import type { ScopeConfig } from "../src/types";
669
+ import type { PolicyLoader } from "#src/permission-manager";
670
+ import type { ResolvedPolicyPaths } from "#src/policy-loader";
671
+ import type { ScopeConfig } from "#src/types";
672
672
 
673
673
  /**
674
674
  * Minimal in-memory PolicyLoader for testing merge + evaluation logic
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, test } from "vitest";
2
2
 
3
- import { mergeFlatPermissions } from "../src/permission-merge";
3
+ import { mergeFlatPermissions } from "#src/permission-merge";
4
4
 
5
5
  describe("mergeFlatPermissions", () => {
6
6
  test("string replaces string", () => {
@@ -14,13 +14,13 @@ vi.mock("../src/forwarded-permissions/polling", () => ({
14
14
  // ── Imports (after mocks) ───────────────────────────────────────────────────
15
15
 
16
16
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
17
- import { DEFAULT_EXTENSION_CONFIG } from "../src/extension-config";
18
- import type { PermissionPromptDecision } from "../src/permission-dialog";
19
- import type { PromptPermissionDetails } from "../src/permission-prompter";
17
+ import { DEFAULT_EXTENSION_CONFIG } from "#src/extension-config";
18
+ import type { PermissionPromptDecision } from "#src/permission-dialog";
19
+ import type { PromptPermissionDetails } from "#src/permission-prompter";
20
20
  import {
21
21
  PermissionPrompter,
22
22
  type PermissionPrompterDeps,
23
- } from "../src/permission-prompter";
23
+ } from "#src/permission-prompter";
24
24
 
25
25
  // ── Helpers ─────────────────────────────────────────────────────────────────
26
26
 
@@ -11,10 +11,10 @@ import {
11
11
  formatSkillAskPrompt,
12
12
  formatSkillPathAskPrompt,
13
13
  formatUnknownToolReason,
14
- } from "../src/permission-prompts";
15
- import type { SkillPromptEntry } from "../src/skill-prompt-sanitizer";
16
- import { formatToolInputForPrompt } from "../src/tool-input-preview";
17
- import type { PermissionCheckResult } from "../src/types";
14
+ } from "#src/permission-prompts";
15
+ import type { SkillPromptEntry } from "#src/skill-prompt-sanitizer";
16
+ import { formatToolInputForPrompt } from "#src/tool-input-preview";
17
+ import type { PermissionCheckResult } from "#src/types";
18
18
 
19
19
  const mockedFormatToolInput = vi.mocked(formatToolInputForPrompt);
20
20
 
@@ -29,16 +29,16 @@ vi.mock("../src/runtime", async (importOriginal) => {
29
29
 
30
30
  // ── Test helpers ───────────────────────────────────────────────────────────
31
31
 
32
- import type { ExtensionPaths } from "../src/extension-paths";
33
- import type { ForwardingController } from "../src/forwarding-manager";
34
- import type { PermissionManager } from "../src/permission-manager";
32
+ import type { ExtensionPaths } from "#src/extension-paths";
33
+ import type { ForwardingController } from "#src/forwarding-manager";
34
+ import type { PermissionManager } from "#src/permission-manager";
35
35
  import {
36
36
  PermissionSession,
37
37
  type PermissionSessionRuntimeDeps,
38
- } from "../src/permission-session";
39
- import type { SessionLogger } from "../src/session-logger";
40
- import type { SkillPromptEntry } from "../src/skill-prompt-sanitizer";
41
- import type { PermissionCheckResult } from "../src/types";
38
+ } from "#src/permission-session";
39
+ import type { SessionLogger } from "#src/session-logger";
40
+ import type { SkillPromptEntry } from "#src/skill-prompt-sanitizer";
41
+ import type { PermissionCheckResult } from "#src/types";
42
42
 
43
43
  function makeSkillEntry(
44
44
  name: string,
@@ -14,39 +14,39 @@ import {
14
14
  createActiveToolsCacheKey,
15
15
  createBeforeAgentStartPromptStateKey,
16
16
  shouldApplyCachedAgentStartState,
17
- } from "../src/before-agent-start-cache";
18
- import { getGlobalConfigPath } from "../src/config-paths";
19
- import { DEFAULT_EXTENSION_CONFIG } from "../src/extension-config";
20
- import piPermissionSystemExtension from "../src/index";
21
- import { createPermissionSystemLogger } from "../src/logging";
17
+ } from "#src/before-agent-start-cache";
18
+ import { getGlobalConfigPath } from "#src/config-paths";
19
+ import { DEFAULT_EXTENSION_CONFIG } from "#src/extension-config";
20
+ import piPermissionSystemExtension from "#src/index";
21
+ import { createPermissionSystemLogger } from "#src/logging";
22
22
  import {
23
23
  createPermissionForwardingLocation,
24
24
  isForwardedPermissionRequestForSession,
25
25
  resolvePermissionForwardingTargetSessionId,
26
26
  SUBAGENT_ENV_HINT_KEYS,
27
27
  SUBAGENT_PARENT_SESSION_ENV_KEY,
28
- } from "../src/permission-forwarding";
29
- import { PermissionManager } from "../src/permission-manager";
28
+ } from "#src/permission-forwarding";
29
+ import { PermissionManager } from "#src/permission-manager";
30
30
  import {
31
31
  findSkillPathMatch,
32
32
  parseAllSkillPromptSections,
33
33
  resolveSkillPromptEntries,
34
- } from "../src/skill-prompt-sanitizer";
35
- import { getPermissionSystemStatus } from "../src/status";
36
- import { sanitizeAvailableToolsSection } from "../src/system-prompt-sanitizer";
34
+ } from "#src/skill-prompt-sanitizer";
35
+ import { getPermissionSystemStatus } from "#src/status";
36
+ import { sanitizeAvailableToolsSection } from "#src/system-prompt-sanitizer";
37
37
  import {
38
38
  checkRequestedToolRegistration,
39
39
  getToolNameFromValue,
40
- } from "../src/tool-registry";
40
+ } from "#src/tool-registry";
41
41
  import type {
42
42
  PermissionCheckResult,
43
43
  PermissionState,
44
44
  ScopeConfig,
45
- } from "../src/types";
45
+ } from "#src/types";
46
46
  import {
47
47
  canResolveAskPermissionRequest,
48
48
  shouldAutoApprovePermissionState,
49
- } from "../src/yolo-mode";
49
+ } from "#src/yolo-mode";
50
50
 
51
51
  type CreateManagerOptions = {
52
52
  mcpServerNames?: readonly string[];
@@ -15,8 +15,8 @@ vi.mock("node:child_process", () => ({
15
15
  default: { spawnSync: mockSpawnSync },
16
16
  }));
17
17
 
18
- import { discoverGlobalNodeModulesRoot } from "../src/node-modules-discovery";
19
- import { isPiInfrastructureRead } from "../src/path-utils";
18
+ import { discoverGlobalNodeModulesRoot } from "#src/node-modules-discovery";
19
+ import { isPiInfrastructureRead } from "#src/path-utils";
20
20
 
21
21
  // ── discoverGlobalNodeModulesRoot ──────────────────────────────────────────
22
22
 
@@ -2,7 +2,7 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
2
2
  import { tmpdir } from "node:os";
3
3
  import { join } from "node:path";
4
4
  import { describe, expect, it } from "vitest";
5
- import { FilePolicyLoader } from "../src/policy-loader";
5
+ import { FilePolicyLoader } from "#src/policy-loader";
6
6
 
7
7
  // ---------------------------------------------------------------------------
8
8
  // Helpers
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, test } from "vitest";
2
- import type { Rule, RuleOrigin, Ruleset } from "../src/rule";
3
- import { evaluate, evaluateFirst, evaluateMostRestrictive } from "../src/rule";
2
+ import type { Rule, RuleOrigin, Ruleset } from "#src/rule";
3
+ import { evaluate, evaluateFirst, evaluateMostRestrictive } from "#src/rule";
4
4
 
5
5
  describe("evaluate", () => {
6
6
  const allowBashGit: Rule = {
@@ -71,15 +71,15 @@ import {
71
71
  getGlobalConfigPath,
72
72
  getGlobalLogsDir,
73
73
  getProjectConfigPath,
74
- } from "../src/config-paths";
75
- import { DEFAULT_EXTENSION_CONFIG } from "../src/extension-config";
76
- import { PermissionManager } from "../src/permission-manager";
74
+ } from "#src/config-paths";
75
+ import { DEFAULT_EXTENSION_CONFIG } from "#src/extension-config";
76
+ import { PermissionManager } from "#src/permission-manager";
77
77
  import {
78
78
  createExtensionRuntime,
79
79
  createPermissionManagerForCwd,
80
80
  derivePiProjectPaths,
81
81
  refreshExtensionConfig,
82
- } from "../src/runtime";
82
+ } from "#src/runtime";
83
83
 
84
84
  // ── test suite ─────────────────────────────────────────────────────────────
85
85
 
@@ -1,12 +1,12 @@
1
1
  import { afterEach, describe, expect, it, vi } from "vitest";
2
- import { buildInputForSurface } from "../src/input-normalizer";
3
- import type { PermissionsService } from "../src/service";
2
+ import { buildInputForSurface } from "#src/input-normalizer";
3
+ import type { PermissionsService } from "#src/service";
4
4
  import {
5
5
  getPermissionsService,
6
6
  publishPermissionsService,
7
7
  unpublishPermissionsService,
8
- } from "../src/service";
9
- import type { PermissionCheckResult } from "../src/types";
8
+ } from "#src/service";
9
+ import type { PermissionCheckResult } from "#src/types";
10
10
 
11
11
  // ── helpers ────────────────────────────────────────────────────────────────
12
12
 
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it, vi } from "vitest";
2
- import type { ExtensionRuntime } from "../src/runtime";
3
- import { createSessionLogger } from "../src/session-logger";
2
+ import type { ExtensionRuntime } from "#src/runtime";
3
+ import { createSessionLogger } from "#src/session-logger";
4
4
 
5
5
  // ── helpers ────────────────────────────────────────────────────────────────
6
6
 
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, it } from "vitest";
2
2
 
3
- import { evaluate } from "../src/rule";
4
- import { deriveApprovalPattern, SessionRules } from "../src/session-rules";
3
+ import { evaluate } from "#src/rule";
4
+ import { deriveApprovalPattern, SessionRules } from "#src/session-rules";
5
5
 
6
6
  // ── SessionRules ───────────────────────────────────────────────────────────
7
7
 
@@ -2,10 +2,10 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
2
2
  import { tmpdir } from "node:os";
3
3
  import { dirname, join } from "node:path";
4
4
  import { afterEach, beforeEach, describe, expect, test } from "vitest";
5
- import { getGlobalConfigPath } from "../src/config-paths";
6
- import { DEFAULT_EXTENSION_CONFIG } from "../src/extension-config";
7
- import piPermissionSystemExtension from "../src/index";
8
- import type { ScopeConfig } from "../src/types";
5
+ import { getGlobalConfigPath } from "#src/config-paths";
6
+ import { DEFAULT_EXTENSION_CONFIG } from "#src/extension-config";
7
+ import piPermissionSystemExtension from "#src/index";
8
+ import type { ScopeConfig } from "#src/types";
9
9
 
10
10
  type MockHandler = (
11
11
  event: Record<string, unknown>,
@@ -1,10 +1,10 @@
1
1
  import { afterEach, describe, expect, test, vi } from "vitest";
2
- import type { PermissionManager } from "../src/permission-manager";
2
+ import type { PermissionManager } from "#src/permission-manager";
3
3
  import {
4
4
  findSkillPathMatch,
5
5
  resolveSkillPromptEntries,
6
- } from "../src/skill-prompt-sanitizer";
7
- import type { PermissionCheckResult } from "../src/types";
6
+ } from "#src/skill-prompt-sanitizer";
7
+ import type { PermissionCheckResult } from "#src/types";
8
8
 
9
9
  afterEach(() => {
10
10
  vi.restoreAllMocks();
@@ -1,10 +1,10 @@
1
1
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
2
  import { afterEach, describe, expect, test, vi } from "vitest";
3
- import { SUBAGENT_ENV_HINT_KEYS } from "../src/permission-forwarding";
3
+ import { SUBAGENT_ENV_HINT_KEYS } from "#src/permission-forwarding";
4
4
  import {
5
5
  isSubagentExecutionContext,
6
6
  normalizeFilesystemPath,
7
- } from "../src/subagent-context";
7
+ } from "#src/subagent-context";
8
8
 
9
9
  afterEach(() => {
10
10
  vi.unstubAllEnvs();
@@ -1,11 +1,11 @@
1
1
  import { describe, expect, test } from "vitest";
2
- import type { RuleOrigin } from "../src/rule";
3
- import { evaluate } from "../src/rule";
2
+ import type { RuleOrigin } from "#src/rule";
3
+ import { evaluate } from "#src/rule";
4
4
  import {
5
5
  composeRuleset,
6
6
  synthesizeBaseline,
7
7
  synthesizeDefaults,
8
- } from "../src/synthesize";
8
+ } from "#src/synthesize";
9
9
 
10
10
  // ── synthesizeDefaults ─────────────────────────────────────────────────────
11
11
 
@@ -1,6 +1,6 @@
1
1
  import { afterEach, describe, expect, test, vi } from "vitest";
2
2
 
3
- import { sanitizeAvailableToolsSection } from "../src/system-prompt-sanitizer";
3
+ import { sanitizeAvailableToolsSection } from "#src/system-prompt-sanitizer";
4
4
 
5
5
  afterEach(() => {
6
6
  vi.restoreAllMocks();
@@ -5,7 +5,7 @@ vi.mock("../src/logging.js", () => ({
5
5
  safeJsonStringify: vi.fn((value: unknown) => JSON.stringify(value)),
6
6
  }));
7
7
 
8
- import { safeJsonStringify } from "../src/logging";
8
+ import { safeJsonStringify } from "#src/logging";
9
9
  import {
10
10
  countTextLines,
11
11
  formatCount,
@@ -24,8 +24,8 @@ import {
24
24
  TOOL_INPUT_PREVIEW_MAX_LENGTH,
25
25
  TOOL_TEXT_SUMMARY_MAX_LENGTH,
26
26
  truncateInlineText,
27
- } from "../src/tool-input-preview";
28
- import type { PermissionCheckResult } from "../src/types";
27
+ } from "#src/tool-input-preview";
28
+ import type { PermissionCheckResult } from "#src/types";
29
29
 
30
30
  const mockedStringify = vi.mocked(safeJsonStringify);
31
31
 
@@ -3,7 +3,7 @@ import { afterEach, describe, expect, test, vi } from "vitest";
3
3
  import {
4
4
  checkRequestedToolRegistration,
5
5
  getToolNameFromValue,
6
- } from "../src/tool-registry";
6
+ } from "#src/tool-registry";
7
7
 
8
8
  afterEach(() => {
9
9
  vi.restoreAllMocks();
@@ -16,7 +16,7 @@ import {
16
16
  findCompiledWildcardMatch,
17
17
  findCompiledWildcardMatchForNames,
18
18
  wildcardMatch,
19
- } from "../src/wildcard-matcher";
19
+ } from "#src/wildcard-matcher";
20
20
 
21
21
  afterEach(() => {
22
22
  mockHomedir.mockClear();
@@ -1,9 +1,9 @@
1
1
  import { afterEach, describe, expect, test, vi } from "vitest";
2
- import type { PermissionSystemExtensionConfig } from "../src/extension-config";
2
+ import type { PermissionSystemExtensionConfig } from "#src/extension-config";
3
3
  import {
4
4
  canResolveAskPermissionRequest,
5
5
  shouldAutoApprovePermissionState,
6
- } from "../src/yolo-mode";
6
+ } from "#src/yolo-mode";
7
7
 
8
8
  afterEach(() => {
9
9
  vi.restoreAllMocks();