@karma42/agent 0.1.0-beta.3 → 0.1.0-beta.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/README.md +17 -97
- package/package.json +4 -3
- package/runtime/manifest.json +1 -6
- package/runtime/project-tools.json +510 -0
- package/src/browser-pairing.mjs +34 -36
- package/src/cli.mjs +28 -78
- package/src/mcp-configuration.mjs +35 -0
- package/src/project-identity.mjs +15 -0
- package/src/reusable-stdio.mjs +163 -0
- package/src/session-stdio.mjs +7 -4
- package/src/session.mjs +8 -117
- package/src/state.mjs +11 -29
- package/src/system.mjs +4 -40
- package/src/version.mjs +1 -0
- package/runtime/AGENT_PROMPT_V2.md +0 -115
- package/runtime/claude-settings.json +0 -82
- package/runtime/launcher.mjs +0 -55
- package/runtime/providers.mjs +0 -284
- package/runtime/runner.mjs +0 -591
- package/runtime/runtime.mjs +0 -67
- package/src/connection.mjs +0 -214
- package/src/doctor.mjs +0 -28
- package/src/plan.mjs +0 -88
- package/src/supervisor.mjs +0 -17
- package/src/terminal.mjs +0 -33
package/README.md
CHANGED
|
@@ -1,115 +1,35 @@
|
|
|
1
|
-
# Karma42
|
|
1
|
+
# Karma42 MCP connector
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`0.1.0-beta.4` is an **unpublished draft**. It connects an existing MCP-capable AI client to a Karma42 project. It does not select, download or run a model. An MCP-capable client using DeepSeek or another model can use the same transport if that client supports local stdio MCP and the required project tools.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## First-time setup
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
npx --ignore-scripts @karma42/agent@0.1.0-beta.3 browser-connect --project-url HTTPS_SERVICE/p/PROJECT_ID --provider claude --agent-id AGENT_ID
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Use `--provider codex` in Codex. The current folder is the requested workspace; `--folder /absolute/workspace` selects another. Setup prints a browser link and request check, then exits immediately. Open the link, sign in with Google, match the request check to this session, and review the project, agent, requested folder and access before approving. The browser does not independently verify that local folder. Approval does not grant filesystem/GitHub permissions, start development or edit client settings. Native client trust prompts remain yours.
|
|
12
|
-
|
|
13
|
-
Run `browser-prepare --connection ID` after approval. It checks once; if pending it prints the link again without keeping a process or lock open. Approved requests save the credential privately and return the secret-free named MCP entry. Lost HTTP replies and interrupted local saves are recoverable by retrying this same command; do not delete the private receipt or create another request. `browser-status --connection ID` shows local pending/saved metadata only, never online activity. Cancel a pending request in the signed-in browser. Expired/cancelled requests preserve existing saved credentials; repeat `browser-connect` for a fresh request. `browser-connect --reconnect` requests a replacement after a previously saved setup, with browser confirmation required before any active connection is replaced.
|
|
14
|
-
|
|
15
|
-
The server receives the hash of a locally generated credential, never its plaintext. The polling secret and candidate credential stay in private 0600 files under 0700 directories; neither appears in the URL, command arguments, chat or MCP configuration. Per-project/service/agent locks cover only short local operations and HTTP requests. No lock is held while a human approves in the browser. Recognized browser-operation locks whose PID is confirmed dead recover automatically; live, reused or uncertain PIDs and legacy bridge locks are never stopped or removed. Recovery attempts are serialized and recheck the lock inode/content. An interrupted recovery guard is conservatively refused rather than deleting an uncertain lock. Two different agents/projects can set up independently; duplicate operations for the same identity are refused safely. Pending requests expire on the service; approved receipts remain recoverable.
|
|
16
|
-
|
|
17
|
-
The deployed beta.2 private-code command remains an identified compatibility path: `session-connect` requires an interactive terminal, rejects pipes/redirected input before taking a lock and never runs in the background. Codes belong only in its private prompt. Expected agent IDs lock only that agent, without a whole-home lock. Existing beta.2 session records remain valid and continue to pin their beta.2 bridge rather than silently upgrading a live connection. OPE-43 owns retirement after participant migration and independent acceptance.
|
|
18
|
-
|
|
19
|
-
Setup returns a secret-free MCP entry and instructions for the selected client. Ask your current agent to add only that entry after your approval, preserving all other entries. Claude uses its workspace-local `mcp add --scope local` command; Codex uses the trusted workspace’s `.codex/config.toml`. Do not share machine-specific paths in repository config. Native trust and permission prompts remain under your control. The client may need MCP reload before tools appear; return to the existing conversation and verify `get_project` on the named entry before continuing. macOS is the tested package environment; Linux and Windows acceptance remains pending. Independent real-client reload/continuation acceptance is still pending; configuration generation and the actual stdio process are tested separately.
|
|
20
|
-
|
|
21
|
-
Each service/project/agent combination has its own ID, credentials and MCP name. Local and production services are distinct even when their IDs match. Several catalogs may load without claiming their agents. The first `get_project` call claims only its connection and verifies `you.agentId` and `you.agentName`; other tool calls are refused until this succeeds. Use a separate named agent for concurrent sessions. A second process using one identity is refused without takeover. Workspace scoping is client configuration, not a security sandbox; credentials are scoped by the service to their project agent.
|
|
22
|
-
|
|
23
|
-
Commands: `session-connect`, `session-prepare --connection ID` (recover interrupted pairing), `session-config --connection ID` (print the secret-free entry), `session-status` (local records only), and `session-serve --connection ID` (stdio transport, started by the MCP client). Session commands use separate private storage at `~/.karma42/sessions/SERVICE_PROJECT_HASH/AGENT_ID`; `--state-dir` selects a private test root. Browser setup records survive interruption. Browser approval explicitly confirms credential replacement; pending/cancelled requests do not rotate it. Legacy private codes rotate that identity’s credential, so disconnect its old bridge/runner before private-code setup. Other identities and their history are preserved.
|
|
24
|
-
|
|
25
|
-
The client owns the bridge process. EOF or SIGINT/SIGTERM/SIGHUP reports stopping, closes polling and releases the local identity lock. Closing a chat does not necessarily close the client-owned process; explicitly disconnect the named MCP entry to release it. A crash/SIGKILL cannot send a final report: the backend’s existing lease/fencing and stale-lock recovery still apply. No remote kill of the coding client is promised. Catalog discovery and connection contact are not evidence of model work or measured spending. The bridge retains the canonical bounded deferred-send journal/retries, only while connected. Revocation, stale runs, paused/not-started mutations and urgent runtime barriers remain enforced by the service; the bridge never downloads or executes cloud-selected runner updates to bypass a refusal.
|
|
26
|
-
|
|
27
|
-
The pinned beta.1 foreground-runner path remains for identified existing users. It uses different private storage and is not silently migrated. The commands below describe that legacy path; new onboarding uses the current-session commands above. OPE-12/OPE-43 own migration and eventual retirement after independent acceptance.
|
|
28
|
-
|
|
29
|
-
## Existing foreground runner
|
|
30
|
-
|
|
31
|
-
# Karma42 agent — beta release
|
|
32
|
-
|
|
33
|
-
Version `0.1.0-beta.1`. The package implements connection preparation, permission approval and a separate foreground start using the existing Karma42 agent runtime. This beta is prepared for public npm distribution. Publication status is recorded in the release plan. The deployed website still uses the existing setup instructions.
|
|
34
|
-
|
|
35
|
-
## The participant flow
|
|
36
|
-
|
|
37
|
-
1. Join the project in Karma42. In project **My agents**, create an agent or choose Reconnect and obtain its short-lived setup code.
|
|
38
|
-
2. In your terminal, run **connect**, explicitly choosing Claude Code or Codex and guarded or bypass permissions. Local prerequisites are checked before the setup code is consumed. Paste the code into a hidden prompt; it never belongs in a command, environment variable or chat transcript.
|
|
39
|
-
3. Pairing retrieves the authoritative agent identity and repository. Review the repository, local checkout, GitHub account, permissions, model-usage risks and current service-managed update policy. Answer each acknowledgement yourself. Bypass also requires the isolated-environment acknowledgement and typing `BYPASS`.
|
|
40
|
-
4. Preparation clones or validates the checkout, installs the packaged canonical kit, and reports readiness to Karma42. It does **not** start an agent. Git can invoke local hooks/filters while cloning. Model sign-in remains owned by your local coding client.
|
|
41
|
-
5. Run **start** separately. The confirmation shows the provider, saved permissions and newly checked GitHub account. On an active project the model can work immediately and consume usage; while preparing or paused it waits. Keep the terminal open. **Ctrl+C** stops this foreground runner; completed changes and external actions remain.
|
|
42
|
-
6. Use **status** for local preparation/approval/check timestamps. Open **My agents** for service-observed contact and activity. A local lock, missing contact or past readiness check is not proof an agent is currently working or stopped.
|
|
43
|
-
|
|
44
|
-
Project approval, joining, agent connection and the owner's Start project remain separate actions.
|
|
45
|
-
|
|
46
|
-
## Build and install locally
|
|
47
|
-
|
|
48
|
-
Supported package verification: macOS with Node 22+, Git, GitHub CLI and Claude Code 2.1.259+ or Codex CLI 0.160.0+. POSIX paths and private filesystem permissions are required. Linux and independent-operator acceptance remain release checks; Windows is not claimed as supported in this iteration.
|
|
49
|
-
|
|
50
|
-
From the repository:
|
|
51
|
-
|
|
52
|
-
```sh
|
|
53
|
-
npm --prefix packages/agent-cli test
|
|
54
|
-
npm pack ./packages/agent-cli --pack-destination /private/tmp
|
|
55
|
-
npm install --global --offline --ignore-scripts --no-audit --no-fund /private/tmp/karma42-agent-0.1.0-beta.1.tgz
|
|
56
|
-
karma42-agent --help
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Installation has no preinstall/install/postinstall/prepare hooks, contacts no project service and launches no model. Packaging runs a local build that copies the canonical kit from `pilot/agent-kit`; it does not execute that kit. There are no external package dependencies.
|
|
60
|
-
|
|
61
|
-
For a real project, replace `PROJECT_ID` and `SERVICE_ORIGIN` with its service URL from My agents:
|
|
7
|
+
Once per computer and client, print its registration instructions:
|
|
62
8
|
|
|
63
9
|
```sh
|
|
64
|
-
karma42-
|
|
65
|
-
karma42-agent connect --project-url https://SERVICE_ORIGIN/p/PROJECT_ID --provider claude --mode guarded
|
|
66
|
-
karma42-agent status
|
|
67
|
-
karma42-agent start --connection PROJECT_ID/AGENT_ID
|
|
10
|
+
npx --ignore-scripts @karma42/agent@0.1.0-beta.4 mcp-config --client claude
|
|
68
11
|
```
|
|
69
12
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
Optional: `--folder /absolute/real/checkout` selects an existing repository root or a new checkout under an existing real directory. Its HTTPS origin must match the project's repository exactly (optional `.git` suffix is normalized). The CLI never resets files, pulls changes or changes the origin. Custom checkouts must be separate from private connection storage, without symbolic-link paths. Existing working files are preserved.
|
|
73
|
-
|
|
74
|
-
## Commands and recovery
|
|
75
|
-
|
|
76
|
-
| Command | What it does |
|
|
77
|
-
| --- | --- |
|
|
78
|
-
| `connect --project-url … --provider claude\|codex --mode guarded\|bypass` | Checks versions, privately exchanges a code, records permission approval, prepares checkout and reports readiness. Never starts. |
|
|
79
|
-
| `prepare --connection ID` | Recovers an interrupted pairing or repeats preparation/readiness using the saved credential, without consuming another code. Renews preparation approval. |
|
|
80
|
-
| `start --connection ID` | Validates saved approval, bundle, checkout and current service authorization, refreshes GitHub evidence, asks to start, then runs in the foreground. |
|
|
81
|
-
| `reconnect --connection ID` | Privately exchanges a fresh code for the same agent/repository, rotates its credential and prepares again. Preserves checkout, sessions, logs and recovery files. Stop the previous runner first. |
|
|
82
|
-
| `permissions --connection ID --mode guarded\|bypass [--provider claude\|codex]` | Reviews and records the chosen permissions, refreshes preparation, and leaves the runner stopped. |
|
|
83
|
-
| `status [--connection ID] [--json]` | Lists local records and pending recovery, without contacting the server or claiming online/working state. |
|
|
84
|
-
| `doctor --provider claude\|codex [--json]` | Checks installed versions only. No account, model sign-in or repository-access claim. |
|
|
85
|
-
| `preview --provider … --mode … --project-url … --repo … --folder … [--json]` | Displays unverified onboarding copy with no connection or persisted approval. |
|
|
86
|
-
|
|
87
|
-
Connection commands accept `--state-dir /absolute/private/directory` for isolated tests or explicit local storage. Repeat the same option on later commands. The default is `~/.karma42/connections`.
|
|
88
|
-
|
|
89
|
-
An expired/refused code requires a new code in My agents. After a lost exchange response, its consumption is uncertain: do not blindly retry; generate a fresh code. After a successful response, an interrupted local application leaves a private receipt that `prepare` can recover. `status` identifies pending preparation. A mismatched reconnect never overwrites the previous identity or checkout; review the indicated connection separately. Repository identity changes are refused rather than silently authorized.
|
|
90
|
-
|
|
91
|
-
If GitHub access is unconfirmed, preparation reports **action required**. Sign in with `gh`, ask the owner for repository access and accept the invitation, then rerun `prepare`. Start requires an additional warning acknowledgement if write access remains unconfirmed; this preserves the existing warning behavior while the broader blocking policy remains undecided.
|
|
92
|
-
|
|
93
|
-
A lock prevents simultaneous package operations. After an unexpected kill, inspect the PID in `operation.lock` and confirm that the process has stopped before removing that lock. There is no automatic takeover or background service. Use the same `start` command to return after a normal stop.
|
|
13
|
+
Use `--client codex` for Codex, or `--client other` for the generic stdio configuration. **Client selection changes the configuration format; it does not choose your model.** These npm commands become available after publication; source-draft testing uses the locally built package.
|
|
94
14
|
|
|
95
|
-
|
|
15
|
+
Review and approve adding the single **karma42** connection. Claude Code uses user scope; Codex uses user configuration. Other clients receive a JSON command/arguments entry to adapt to their configuration schema. Inspect an existing `karma42` entry before changing it, and preserve other connections and native permissions. This command prints instructions only and makes no settings changes.
|
|
96
16
|
|
|
97
|
-
|
|
17
|
+
Start a project conversation with the connector loaded and approve any native trust prompt. First-time installation may require a client reload. Merely printing or saving configuration does not verify that its tools loaded.
|
|
98
18
|
|
|
99
|
-
|
|
19
|
+
References: [Claude Code MCP setup](https://code.claude.com/docs/en/mcp-quickstart), [official OpenAI MCP documentation](https://developers.openai.com/codex/mcp).
|
|
100
20
|
|
|
101
|
-
|
|
21
|
+
## Project-agent onboarding
|
|
102
22
|
|
|
103
|
-
|
|
23
|
+
Copy the project-agent instructions from [Karma42](https://karma42.ai) into the conversation. Approve connecting the named agent in its project and working folder. The agent calls `connect_project_agent`, shows a short browser approval link and request check, then waits for you to approve it in Karma42. Review the project, agent and requested folder; the browser cannot independently verify that folder.
|
|
104
24
|
|
|
105
|
-
|
|
25
|
+
After approval, `finish_project_agent_connection` uses the returned connection_ref to finish binding. `get_project` with that reference verifies identity and reads context. Keep the same reference on every subsequent project tool call. Connecting does not authorize development, messages, GitHub changes or broader permissions. Your client controls those actions and model usage.
|
|
106
26
|
|
|
107
|
-
|
|
27
|
+
The connector supports separate processes and hosts that share one MCP process across conversations. Each agent/project has an immutable binding with an opaque connection_ref. Every project tool requires this exact reference; there is no global active project or default target. Different bindings can work concurrently. Duplicate active identities retain exclusive run fences without automatic takeover. An explicitly selected approved connection can be reused for its matching identity and reported folder.
|
|
108
28
|
|
|
109
|
-
|
|
29
|
+
## Transport and private state
|
|
110
30
|
|
|
111
|
-
|
|
31
|
+
The client runs `mcp-serve`, which serves JSON-RPC over stdin/stdout without launching a model or background service. Node 22+ is required. `disconnect_project_agent` releases only the specified binding; EOF or transport termination releases all bindings in that process; completed external actions are not undone. Run fences, membership, revocation and project-state checks remain enforced by the service.
|
|
112
32
|
|
|
113
|
-
|
|
33
|
+
Private records use `~/.karma42/mcp` or `--state-dir /absolute/private/directory`. Storage must be private and outside the working folder. Credentials and polling secrets remain in private files; never put them in chat, arguments, URLs or client configuration. Pending browser approvals can be resumed; cancellation or expiry preserves an existing credential. Replacement requires explicit browser approval.
|
|
114
34
|
|
|
115
|
-
|
|
35
|
+
This source contains only the current MCP connector. Old npm releases remain published independently; this cleanup neither migrates their private records nor deletes production data or interrupts existing sessions. Native client and operating-system acceptance remain separate release checks. Configuration and protocol tests do not establish that every MCP client supports dynamic setup, reload or continuation.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@karma42/agent",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
4
|
-
"description": "Karma42
|
|
3
|
+
"version": "0.1.0-beta.4",
|
|
4
|
+
"description": "Model-independent Karma42 MCP connector for project agents",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -30,5 +30,6 @@
|
|
|
30
30
|
"registry": "https://registry.npmjs.org/",
|
|
31
31
|
"access": "public",
|
|
32
32
|
"tag": "beta"
|
|
33
|
-
}
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://karma42.ai"
|
|
34
35
|
}
|
package/runtime/manifest.json
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"source": "pilot/agent-kit",
|
|
3
3
|
"files": {
|
|
4
|
-
"runner.mjs": "984d2eabc54f2561397a04c851c29f8362d83e9521063222c2a3ce2725e3e06f",
|
|
5
4
|
"control-v2.mjs": "02e325b642669b8f29c7b25582b1afaf4b74cbc63d2b463c11bf02abac90ca12",
|
|
6
|
-
"
|
|
7
|
-
"launcher.mjs": "4254a649e02597f21b5f3c1b146490554a19cc9919933a3dfdc55113cbf140aa",
|
|
8
|
-
"claude-settings.json": "bf3bfaaf38de37cda60a7dc48cb8c186c1864df61bd5ff500715ee2d1db4333e",
|
|
9
|
-
"AGENT_PROMPT_V2.md": "1a4f28e8105db39d384b63ef32cf06a9b14057da2e12fd2d0a0c0f3f1ca02d80",
|
|
10
|
-
"providers.mjs": "90e70acd1d2363f28584c8ccbc5cce7f9851c4aae1864309ff408822050a10ef"
|
|
5
|
+
"project-tools.json": "e0b97987df7887bb10926651de61cf886d6fd19b774ee1ecf3a67241e5cc98bd"
|
|
11
6
|
}
|
|
12
7
|
}
|