@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 +1 -1
- package/src/__test__/smoke-linear-api.test.ts +2 -1
- package/src/__test__/webhook-scenarios.test.ts +3 -0
- package/src/agent/agent.ts +9 -7
- package/src/agent/watchdog.ts +1 -1
- package/src/api/linear-api.ts +2 -1
- package/src/api/oauth-callback.ts +2 -1
- package/src/infra/cli.ts +2 -2
- package/src/infra/codex-worktree.ts +2 -2
- package/src/infra/config-paths.test.ts +3 -0
- package/src/infra/doctor.test.ts +621 -1
- package/src/infra/multi-repo.test.ts +11 -9
- package/src/infra/multi-repo.ts +3 -2
- package/src/infra/shared-profiles.ts +2 -1
- package/src/infra/template.test.ts +2 -2
- package/src/pipeline/active-session.test.ts +96 -1
- package/src/pipeline/active-session.ts +60 -0
- package/src/pipeline/artifacts.ts +1 -1
- package/src/pipeline/pipeline.test.ts +3 -0
- package/src/pipeline/webhook-dedup.test.ts +3 -0
- package/src/pipeline/webhook.test.ts +2088 -2
- package/src/pipeline/webhook.ts +24 -6
- package/src/tools/claude-tool.ts +1 -1
- package/src/tools/cli-shared.test.ts +3 -0
- package/src/tools/cli-shared.ts +3 -1
- package/src/tools/code-tool.test.ts +3 -0
- package/src/tools/code-tool.ts +1 -1
- package/src/tools/codex-tool.ts +1 -1
- package/src/tools/gemini-tool.ts +1 -1
package/package.json
CHANGED
|
@@ -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
|
-
|
|
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", () => ({
|
package/src/agent/agent.ts
CHANGED
|
@@ -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 =
|
|
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:
|
|
38
|
+
let _extensionAPI: any | null = null;
|
|
37
39
|
async function getExtensionAPI() {
|
|
38
40
|
if (!_extensionAPI) {
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
|
|
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
|
}
|
package/src/agent/watchdog.ts
CHANGED
|
@@ -129,7 +129,7 @@ interface AgentProfileWatchdog {
|
|
|
129
129
|
toolTimeoutSec?: number;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
const PROFILES_PATH = join(
|
|
132
|
+
const PROFILES_PATH = join(homedir(), ".openclaw", "agent-profiles.json");
|
|
133
133
|
|
|
134
134
|
function loadProfileWatchdog(agentId: string): AgentProfileWatchdog | null {
|
|
135
135
|
try {
|
package/src/api/linear-api.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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": "
|
|
850
|
-
console.log(` "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 = "
|
|
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:
|
|
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", () => ({
|