@tangenta/claude-code 0.20.0 → 0.20.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tangenta",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "description": "Attaches Claude Code to a Tangenta issue: the issue page shows the session's plan and activity, and people on it can message, answer and stop Claude.",
5
5
  "author": { "name": "Tangenta" },
6
6
  "keywords": ["tangenta", "issues", "agents"],
@@ -80,7 +80,7 @@ function initialize(params) {
80
80
  return {
81
81
  protocolVersion: VERSIONS.includes(requested) ? requested : VERSIONS[0],
82
82
  capabilities: { tools: { listChanged: true } },
83
- serverInfo: { name: "tangenta-agent", title: "Tangenta agent", version: "0.20.0" },
83
+ serverInfo: { name: "tangenta-agent", title: "Tangenta agent", version: "0.20.1" },
84
84
  instructions:
85
85
  "Tangenta's tools, as the agent member this Claude Code is connected as. Connect with " +
86
86
  "connect_agent and the setup token of the agent's setup prompt; check with agent_status.",
package/lib/agent.mjs CHANGED
@@ -19,9 +19,9 @@ import {
19
19
  renameSync,
20
20
  writeSync,
21
21
  } from "node:fs";
22
- import { isAbsolute, join, relative } from "node:path";
22
+ import { join } from "node:path";
23
23
 
24
- import { attachApiUrl, projectDir, stateRoot } from "./config.mjs";
24
+ import { attachApiUrl, projectDir, stateRoot, stateRootInsideProject } from "./config.mjs";
25
25
 
26
26
  /** The agent API key and setup token forms; answers and errors never carry either. */
27
27
  export const AGENT_SECRET_PATTERN = /tng_(?:api|stp)_[A-Za-z0-9_-]{20,}/g;
@@ -44,15 +44,10 @@ function realPath(path) {
44
44
  }
45
45
  }
46
46
 
47
- function inside(parent, child) {
48
- const path = relative(parent, child);
49
- return path === "" || (!path.startsWith("..") && !isAbsolute(path));
50
- }
51
-
52
47
  /** Where the agent's credentials are kept, outside the project. */
53
48
  export function credentialsPath(env) {
54
49
  const root = realPath(stateRoot(env));
55
- if (inside(realPath(projectDir(env, null)), root)) {
50
+ if (stateRootInsideProject(env, projectDir(env, null))) {
56
51
  throw new AgentError(
57
52
  "The Tangenta plugin's state directory is inside the project, where the agent's key could " +
58
53
  "end up in the repository. Point TANGENTA_PLUGIN_STATE_DIR somewhere else.",
package/lib/config.mjs CHANGED
@@ -14,8 +14,9 @@
14
14
  * TANGENTA_QUESTION_WAIT_SECONDS how long the Stop hook waits for the answer to a question
15
15
  * TANGENTA_EMIT_ACTIONS 0 turns off reporting each tool call as an action
16
16
  */
17
+ import { existsSync, realpathSync } from "node:fs";
17
18
  import { homedir } from "node:os";
18
- import { join, resolve } from "node:path";
19
+ import { isAbsolute, join, relative, resolve } from "node:path";
19
20
 
20
21
  /** The least time between two input checks after tool calls, unless the environment says. */
21
22
  export const DEFAULT_POLL_INTERVAL_MS = 5_000;
@@ -177,6 +178,28 @@ export function projectDir(env, hookInput) {
177
178
  return resolve(process.cwd());
178
179
  }
179
180
 
181
+ function realPath(path) {
182
+ try {
183
+ return realpathSync(path);
184
+ } catch {
185
+ return path;
186
+ }
187
+ }
188
+
189
+ /**
190
+ * Whether the state root lies inside the project, where a key or session token could end up
191
+ * in a repository. The user's home directory as the project is exempt, since every default
192
+ * state root is under it, unless the home directory is itself a git repository (a dotfiles
193
+ * checkout), where a key could still be committed.
194
+ */
195
+ export function stateRootInsideProject(env, project) {
196
+ const projectPath = realPath(project);
197
+ const home = realPath(present(env.HOME) ? env.HOME : homedir());
198
+ if (projectPath === home && !existsSync(join(home, ".git"))) return false;
199
+ const path = relative(projectPath, realPath(stateRoot(env)));
200
+ return path === "" || (!path.startsWith("..") && !isAbsolute(path));
201
+ }
202
+
180
203
  function integer(value, fallback, { min, max }) {
181
204
  const parsed = Number.parseInt(value ?? "", 10);
182
205
  if (Number.isNaN(parsed)) return fallback;
package/lib/proxy.mjs CHANGED
@@ -124,7 +124,7 @@ function initialize(params) {
124
124
  return {
125
125
  protocolVersion: VERSIONS.includes(requested) ? requested : VERSIONS[0],
126
126
  capabilities: { tools: { listChanged: false } },
127
- serverInfo: { name: `tangenta-${PROXY_SERVER}`, title: "Tangenta session", version: "0.20.0" },
127
+ serverInfo: { name: `tangenta-${PROXY_SERVER}`, title: "Tangenta session", version: "0.20.1" },
128
128
  instructions:
129
129
  "Tools of the Tangenta session this project is attached to: report activity and the " +
130
130
  "plan to the issue page, ask the starter a question, and end the session.",
package/lib/store.mjs CHANGED
@@ -18,9 +18,9 @@ import {
18
18
  statSync,
19
19
  writeSync,
20
20
  } from "node:fs";
21
- import { isAbsolute, join, relative } from "node:path";
21
+ import { join } from "node:path";
22
22
 
23
- import { stateRoot } from "./config.mjs";
23
+ import { stateRoot, stateRootInsideProject } from "./config.mjs";
24
24
 
25
25
  const LOCK_WAIT_MS = 8_000;
26
26
  const LOCK_STALE_MS = 20_000;
@@ -36,16 +36,11 @@ function realPath(path) {
36
36
  }
37
37
  }
38
38
 
39
- function inside(parent, child) {
40
- const path = relative(parent, child);
41
- return path === "" || (!path.startsWith("..") && !isAbsolute(path));
42
- }
43
-
44
39
  /** The store of `project` under the state root that `env` names. */
45
40
  export function openStore(env, project) {
46
41
  const root = realPath(stateRoot(env));
47
42
  const projectPath = realPath(project);
48
- if (inside(projectPath, root)) {
43
+ if (stateRootInsideProject(env, projectPath)) {
49
44
  throw new StoreError(
50
45
  "The Tangenta plugin's state directory is inside the project, where the session token " +
51
46
  "could end up in the repository. Point TANGENTA_PLUGIN_STATE_DIR somewhere else.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangenta/claude-code",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "type": "module",
5
5
  "description": "The Tangenta plugin for Claude Code: hooks and a local MCP server that attach a Claude Code session to a Tangenta issue. No dependencies.",
6
6
  "keywords": [