@nia-teams/claude-code-plugin 0.2.0 → 0.3.2

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/dist/stdio.js DELETED
@@ -1,45 +0,0 @@
1
- import { clientBranding } from './branding.js';
2
- import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
- import { Server } from '@modelcontextprotocol/sdk/server/index.js';
4
- import { ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
5
- import { BridgeClient } from './bridge-client.js';
6
- import { loadCredentials } from './credentials.js';
7
- import { ChannelServer } from './channel-server.js';
8
- /** The daemon already owns the bridge and supplies its own scoped SDK tools. */
9
- function idleChannel() {
10
- const mcp = new Server({ name: 'nia-teams', version: '0.2.0' }, { capabilities: { tools: {} } });
11
- mcp.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [] }));
12
- return { mcp, connect: (transport) => mcp.connect(transport), close: () => mcp.close() };
13
- }
14
- /** Own the child process lifetime, including hosts that close stdin without signaling. */
15
- export async function runStdioServer(configDir) {
16
- // Guard before loading credentials or constructing any bridge/channel state.
17
- // Inherited legacy MCP configuration must remain healthy but inert in SDK children.
18
- const channel = process.env.NIA_CLAUDE_DAEMON === '1' ? idleChannel() : new ChannelServer(new BridgeClient(await loadCredentials(configDir), { ...clientBranding, onError: error => console.error(`Nia Teams: ${error.message}`) }));
19
- let stopping = false;
20
- const stop = () => {
21
- if (stopping)
22
- return;
23
- stopping = true;
24
- clearInterval(watchdog);
25
- // A dead stdio peer must never leave a WebSocket child alive indefinitely.
26
- const deadline = setTimeout(() => { process.exit(0); }, 2500);
27
- void channel.close().catch(error => console.error(String(error))).finally(() => { clearTimeout(deadline); process.exit(0); });
28
- };
29
- const watchdog = setInterval(() => { if (process.stdin.destroyed || process.stdin.readableEnded)
30
- stop(); }, 1000);
31
- watchdog.unref();
32
- for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP'])
33
- process.once(signal, stop);
34
- process.stdin.once('end', stop);
35
- process.stdin.once('close', stop);
36
- try {
37
- await channel.connect(new StdioServerTransport());
38
- channel.mcp.onclose = stop;
39
- }
40
- catch (error) {
41
- console.error(`Nia Teams: ${String(error)}`);
42
- stop();
43
- }
44
- }
45
- //# sourceMappingURL=stdio.js.map
package/dist/stdio.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"stdio.js","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAE5E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,gFAAgF;AAChF,SAAS,WAAW;IAClB,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IACjG,GAAG,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3E,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,SAAoB,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC;AACtG,CAAC;AAED,0FAA0F;AAC1F,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,SAAkB;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AAI,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAU;QAAE,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC1F,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACnE,IAAI,CAAC;QAAC,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;QAAC,OAAO,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;IAAC,CAAC;IACtF,OAAO,KAAK,EAAE,CAAC;QAAC,OAAO,CAAC,KAAK,CAAC,cAAc,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAAC,IAAI,EAAE,CAAC;IAAC,CAAC;AACzE,CAAC"}
package/docs/DAEMON.md DELETED
@@ -1,15 +0,0 @@
1
- # Headless daemon mode
2
-
3
- Inspected npm `@anthropic-ai/claude-agent-sdk@0.3.319` declarations and implementation. Package metadata is retained in upstream/. SDK archive SHA256: `6bfb9ccb6a5d15686f5c7dd12d7a7da6d7b486ca6e1331ac8a7ab98a2d302001`.
4
-
5
- `nia-claude start` is separate from the existing experimental channel MCP mode. It uses `query({ prompt, options })` with `pathToClaudeCodeExecutable`, `cwd`, `model`, `resume`, `abortController`, `canUseTool`, and in-process `createSdkMcpServer`/`tool`. No interactive PTY or `--dangerously-load-development-channels` acknowledgement is needed for this SDK path. A local authenticated Claude CLI is still required.
6
-
7
- The SDK invokes stream-json input/output with `--verbose`, `--permission-prompt-tool=stdio`, and `--resume=<sessionId>`. Initialize negotiates SDK MCP servers/manifests. `canUseTool` returns behavior allow/deny and updatedInput, unlike Tencent's translated wire `allowed` field. Native final SDK result messages contain `session_id`, `subtype: success`, and `result: string`; errors carry `is_error` and errors. Subagent assistant messages are not published as main-turn replies.
8
-
9
- Default permission mode is `default`; full-auto selects `bypassPermissions` and `allowDangerouslySkipPermissions`. User/project/local settings are enabled. Existing upstream allow rules and hooks remain in effect; TaskBar only receives requests that the upstream permission engine forwards. GroupChat send/history are intentionally allowlisted and remain scoped to the current host context. SDK warnings about their canUseTool bypass describe this intentional allowlist.
10
-
11
- Per-GroupChat runtime IDs live in private threads.json. `AskUserQuestion` publishes questions and waits for the invoking human; multiple questions use a JSON answer map. Upstream tool requests use signed TaskBar `claude_code.permission` verification. Session rotation and cancellation abort the query and pending cards. Core owns state persistence, publication retries, and macOS sleep prevention.
12
-
13
- The previous `.claude-plugin`, `.mcp.json`, `nia-claude mcp` channel server, tool names and permission flow are unchanged. Do not run channel mode and daemon mode concurrently with the same paired credentials.
14
-
15
- The runner sets `strictMcpConfig: true`, which adds `--strict-mcp-config` in the SDK CLI invocation. Only the supplied scoped `nia` MCP server is loaded; inherited MCP server configuration is ignored. This complements the `NIA_CLAUDE_DAEMON=1` child marker that disables accidental legacy channel connections.
@@ -1,8 +0,0 @@
1
- import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
2
- import { BridgeClient, ChannelServer, loadCredentials } from '@nia-teams/claude-code-plugin';
3
-
4
- // For embedding only; the nia-claude mcp CLI also installs an orphan watchdog.
5
- const channel = new ChannelServer(new BridgeClient(await loadCredentials()));
6
- for (const signal of ['SIGINT', 'SIGTERM']) process.once(signal, () => { void channel.close(); });
7
- process.stdin.once('end', () => { void channel.close(); });
8
- await channel.connect(new StdioServerTransport());