@calltelemetry/openclaw-linear 0.9.3 → 0.9.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calltelemetry/openclaw-linear",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "description": "Linear Agent plugin for OpenClaw — webhook-driven AI pipeline with OAuth, multi-agent routing, and issue triage",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -10,13 +10,14 @@
10
10
  */
11
11
  import { readFileSync } from "node:fs";
12
12
  import { join } from "node:path";
13
+ import { homedir } from "node:os";
13
14
  import { afterAll, beforeAll, describe, expect, it } from "vitest";
14
15
  import { LinearAgentApi } from "../api/linear-api.js";
15
16
 
16
17
  // ── Setup ──────────────────────────────────────────────────────────
17
18
 
18
19
  const AUTH_PROFILES_PATH = join(
19
- process.env.HOME ?? "/home/claw",
20
+ homedir(),
20
21
  ".openclaw",
21
22
  "auth-profiles.json",
22
23
  );
@@ -87,6 +87,9 @@ vi.mock("../pipeline/pipeline.js", () => ({
87
87
  vi.mock("../pipeline/active-session.js", () => ({
88
88
  setActiveSession: mockSetActiveSession,
89
89
  clearActiveSession: mockClearActiveSession,
90
+ getIssueAffinity: vi.fn().mockReturnValue(null),
91
+ _configureAffinityTtl: vi.fn(),
92
+ _resetAffinityForTesting: vi.fn(),
90
93
  }));
91
94
 
92
95
  vi.mock("../infra/observability.js", () => ({
@@ -1,6 +1,8 @@
1
1
  import { randomUUID } from "node:crypto";
2
- import { join } from "node:path";
2
+ import { join, dirname } from "node:path";
3
+ import { homedir } from "node:os";
3
4
  import { mkdirSync, readFileSync } from "node:fs";
5
+ import { createRequire } from "node:module";
4
6
  import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
5
7
  import type { LinearAgentApi, ActivityContent } from "../api/linear-api.js";
6
8
  import { InactivityWatchdog, resolveWatchdogConfig } from "./watchdog.js";
@@ -15,7 +17,7 @@ interface AgentDirs {
15
17
  }
16
18
 
17
19
  function resolveAgentDirs(agentId: string, config: Record<string, any>): AgentDirs {
18
- const home = process.env.HOME ?? "/home/claw";
20
+ const home = homedir();
19
21
  const agentList = config?.agents?.list as Array<Record<string, any>> | undefined;
20
22
  const agentEntry = agentList?.find((a) => a.id === agentId);
21
23
 
@@ -33,13 +35,13 @@ function resolveAgentDirs(agentId: string, config: Record<string, any>): AgentDi
33
35
  }
34
36
 
35
37
  // Import extensionAPI for embedded agent runner (internal, not in public SDK)
36
- let _extensionAPI: typeof import("/home/claw/.npm-global/lib/node_modules/openclaw/dist/extensionAPI.js") | null = null;
38
+ let _extensionAPI: any | null = null;
37
39
  async function getExtensionAPI() {
38
40
  if (!_extensionAPI) {
39
- // Dynamic import to avoid blocking module load if unavailable
40
- _extensionAPI = await import(
41
- "/home/claw/.npm-global/lib/node_modules/openclaw/dist/extensionAPI.js"
42
- );
41
+ // Resolve the openclaw package location dynamically, then import extensionAPI
42
+ const _require = createRequire(import.meta.url);
43
+ const openclawDir = dirname(_require.resolve("openclaw/package.json"));
44
+ _extensionAPI = await import(join(openclawDir, "dist", "extensionAPI.js"));
43
45
  }
44
46
  return _extensionAPI;
45
47
  }
@@ -129,7 +129,7 @@ interface AgentProfileWatchdog {
129
129
  toolTimeoutSec?: number;
130
130
  }
131
131
 
132
- const PROFILES_PATH = join(process.env.HOME ?? "/home/claw", ".openclaw", "agent-profiles.json");
132
+ const PROFILES_PATH = join(homedir(), ".openclaw", "agent-profiles.json");
133
133
 
134
134
  function loadProfileWatchdog(agentId: string): AgentProfileWatchdog | null {
135
135
  try {
@@ -1,11 +1,12 @@
1
1
  import { readFileSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
+ import { homedir } from "node:os";
3
4
  import { refreshLinearToken } from "./auth.js";
4
5
  import { withResilience } from "../infra/resilience.js";
5
6
 
6
7
  export const LINEAR_GRAPHQL_URL = "https://api.linear.app/graphql";
7
8
  export const AUTH_PROFILES_PATH = join(
8
- process.env.HOME ?? "/home/claw",
9
+ homedir(),
9
10
  ".openclaw",
10
11
  "auth-profiles.json",
11
12
  );
@@ -2,10 +2,11 @@ import type { IncomingMessage, ServerResponse } from "node:http";
2
2
  import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
3
3
  import { writeFileSync, readFileSync } from "node:fs";
4
4
  import { join } from "node:path";
5
+ import { homedir } from "node:os";
5
6
 
6
7
  const LINEAR_OAUTH_TOKEN_URL = "https://api.linear.app/oauth/token";
7
8
  const AUTH_PROFILES_PATH = join(
8
- process.env.HOME ?? "/home/claw",
9
+ homedir(),
9
10
  ".openclaw",
10
11
  "auth-profiles.json",
11
12
  );
package/src/infra/cli.ts CHANGED
@@ -846,8 +846,8 @@ async function reposAction(
846
846
  console.log(`\n No "repos" configured in plugin config.`);
847
847
  console.log(` Add a repos map to openclaw.json → plugins.entries.openclaw-linear.config:`);
848
848
  console.log(`\n "repos": {`);
849
- console.log(` "api": "/home/claw/repos/api",`);
850
- console.log(` "frontend": "/home/claw/repos/frontend"`);
849
+ console.log(` "api": "~/repos/api",`);
850
+ console.log(` "frontend": "~/repos/frontend"`);
851
851
  console.log(` }\n`);
852
852
  return;
853
853
  }
@@ -5,7 +5,7 @@ import path from "node:path";
5
5
  import { ensureGitignore } from "../pipeline/artifacts.js";
6
6
  import type { RepoConfig } from "./multi-repo.js";
7
7
 
8
- const DEFAULT_BASE_REPO = "/home/claw/ai-workspace";
8
+ const DEFAULT_BASE_REPO = path.join(homedir(), "ai-workspace");
9
9
  const DEFAULT_WORKTREE_BASE_DIR = path.join(homedir(), ".openclaw", "worktrees");
10
10
 
11
11
  export interface WorktreeInfo {
@@ -22,7 +22,7 @@ export interface WorktreeStatus {
22
22
  }
23
23
 
24
24
  export interface WorktreeOptions {
25
- /** Base git repo to create worktrees from. Default: /home/claw/ai-workspace */
25
+ /** Base git repo to create worktrees from. Default: ~/ai-workspace */
26
26
  baseRepo?: string;
27
27
  /** Directory under which worktrees are created. Default: ~/.openclaw/worktrees */
28
28
  baseDir?: string;
@@ -33,6 +33,9 @@ vi.mock("../api/linear-api.js", () => ({
33
33
  vi.mock("../pipeline/active-session.js", () => ({
34
34
  setActiveSession: vi.fn(),
35
35
  clearActiveSession: vi.fn(),
36
+ getIssueAffinity: vi.fn().mockReturnValue(null),
37
+ _configureAffinityTtl: vi.fn(),
38
+ _resetAffinityForTesting: vi.fn(),
36
39
  }));
37
40
 
38
41
  vi.mock("../infra/observability.js", () => ({