@akira-tl/forgerelay 0.8.7 → 0.8.9
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/CHANGELOG.md +18 -0
- package/README.md +10 -18
- package/capabilities/host-integration/GUIDE.md +2 -2
- package/dist/activity/{audit-store.js → history/audit-store.js} +129 -21
- package/dist/activity/history/bash-output-store.js +250 -0
- package/dist/activity/{host-turn-store.js → history/host-turn-store.js} +4 -1
- package/dist/activity/{query-service.js → history/query-service.js} +13 -7
- package/dist/activity/{lifecycle.js → runtime/lifecycle.js} +1 -1
- package/dist/activity/{mcp-query-tools.js → runtime/mcp-query-tools.js} +3 -3
- package/dist/activity/storage/history.js +12 -0
- package/dist/activity/storage/paths.js +56 -0
- package/dist/activity/storage/segmented-log.js +149 -0
- package/dist/cli/setup-support.js +116 -0
- package/dist/cli.js +18 -126
- package/dist/lsp/code-intelligence.js +1 -1
- package/dist/lsp/test-support/server-fixture.js +9 -9
- package/dist/mcp/filesystem/filesystem-tools.js +245 -0
- package/dist/mcp/hooks/command-runner.js +79 -0
- package/dist/{hook-cli.js → mcp/hooks/hook-cli.js} +1 -1
- package/dist/{hooks.js → mcp/hooks/hooks.js} +3 -80
- package/dist/{oauth-provider.js → mcp/oauth/oauth-provider.js} +1 -1
- package/dist/{oauth-store.js → mcp/oauth/oauth-store.js} +5 -4
- package/dist/{operations → mcp/operations}/native-bulk-mutations.js +2 -2
- package/dist/mcp/panel/app.js +143 -0
- package/dist/{mcp-app-template.js → mcp/panel/mcp-app-template.js} +2 -38
- package/dist/mcp/process/runtime.js +257 -0
- package/dist/mcp/process/tools.js +346 -0
- package/dist/mcp/server/core/activity-support.js +70 -0
- package/dist/{capabilities.js → mcp/server/core/capabilities.js} +5 -3
- package/dist/{capability-registry.js → mcp/server/core/capability-registry.js} +2 -2
- package/dist/mcp/server/core/capability-support.js +90 -0
- package/dist/mcp/server/core/schemas.js +216 -0
- package/dist/mcp/server/core/tool-support.js +207 -0
- package/dist/mcp/server/core/version.js +9 -0
- package/dist/mcp/server/operations/runtime/filesystem-tools.js +400 -0
- package/dist/mcp/server/operations/runtime/operation-runtime.js +523 -0
- package/dist/mcp/server/transport/http-server.js +301 -0
- package/dist/mcp/server/transport/http-support.js +43 -0
- package/dist/mcp/server/workspace/runtime/workspace-open-presentation.js +222 -0
- package/dist/mcp/server/workspace/runtime/workspace-open-schema.js +187 -0
- package/dist/mcp/server/workspace/runtime/workspace-open.js +552 -0
- package/dist/mcp/server/workspace/runtime/workspace-tools.js +601 -0
- package/dist/{config.js → runtime/config/config.js} +3 -3
- package/dist/{user-config.js → runtime/config/user-config.js} +14 -54
- package/dist/{db → runtime/state/db}/client.js +1 -1
- package/dist/{db → runtime/state/db}/migrations.js +34 -3
- package/dist/runtime/state/lock/file-lock.js +130 -0
- package/dist/runtime/testing/server-fixture.js +190 -0
- package/dist/server.js +139 -4192
- package/dist/subagents/providers/adapters/claude.js +86 -52
- package/dist/subagents/providers/adapters/codex.js +103 -39
- package/dist/subagents/providers/adapters/opencode.js +114 -84
- package/dist/subagents/providers/adapters/pi.js +59 -8
- package/dist/subagents/providers/availability.js +15 -30
- package/dist/subagents/providers/runtime/external-command.js +56 -0
- package/dist/subagents/sessions/capability.js +1 -1
- package/dist/subagents/sessions/execution.js +1 -1
- package/dist/subagents/sessions/mcp/activity-audit-test-support.js +30 -0
- package/dist/subagents/sessions/store.js +1 -1
- package/dist/ui/.vite/manifest.json +342 -409
- package/dist/ui/activity-panel-app.html +2 -4
- package/dist/ui/assets/activity-panel-app-7Xe0alhm.css +1 -0
- package/dist/ui/assets/activity-panel-app-Sl1Jro8v.js +115 -0
- package/dist/ui/assets/angular-html-B_yn91wW.js +1 -0
- package/dist/ui/assets/{angular-ts-Bxh4-O1-.js → angular-ts-DSgtloKz.js} +1 -1
- package/dist/ui/assets/{apl-BmYHKQ6m.js → apl-NatWtF8X.js} +1 -1
- package/dist/ui/assets/{astro-C51vqDKq.js → astro-BYFEVBuN.js} +1 -1
- package/dist/ui/assets/{blade-CdhVsmwq.js → blade-DoO7yvMR.js} +1 -1
- package/dist/ui/assets/c-Rl2hMCcg.js +1 -0
- package/dist/ui/assets/{cobol-Cf6azoN_.js → cobol-ByC5mWiB.js} +1 -1
- package/dist/ui/assets/{coffee-vVdGzlmt.js → coffee-Dez77Qov.js} +1 -1
- package/dist/ui/assets/cpp-DtaAQT9h.js +1 -0
- package/dist/ui/assets/{crystal-5UZy6KIX.js → crystal-Bgmbf8ec.js} +1 -1
- package/dist/ui/assets/css-C1tjBtVN.js +1 -0
- package/dist/ui/assets/{edge-CESgo4ia.js → edge-DeH6u8Wg.js} +1 -1
- package/dist/ui/assets/{elixir-9FKfw4cJ.js → elixir-_H3KnmWT.js} +1 -1
- package/dist/ui/assets/{elm-Dv7A0aLa.js → elm-CsCe3U28.js} +1 -1
- package/dist/ui/assets/{erb-DHFmDvM0.js → erb-CbM-L2g8.js} +1 -1
- package/dist/ui/assets/{git-rebase-utbU6CzV.js → git-rebase-D0s5pDh9.js} +1 -1
- package/dist/ui/assets/{glimmer-js-t2kiCkyB.js → glimmer-js-BfOToq_A.js} +1 -1
- package/dist/ui/assets/{glimmer-ts-F0Jv5okV.js → glimmer-ts-CCUOkL2K.js} +1 -1
- package/dist/ui/assets/glsl-DH4ec9dE.js +1 -0
- package/dist/ui/assets/graphql-DilAMBoI.js +1 -0
- package/dist/ui/assets/{hack-8yjdbaSA.js → hack-BDkNDZlF.js} +1 -1
- package/dist/ui/assets/haml-D_QBp6K7.js +1 -0
- package/dist/ui/assets/{handlebars-BBFEg4Lo.js → handlebars-DePUrTpC.js} +1 -1
- package/dist/ui/assets/heavy-payload-DOwZpO6n.js +290 -0
- package/dist/ui/assets/html-By4dNnM4.js +1 -0
- package/dist/ui/assets/{html-derivative-DJAQcZyc.js → html-derivative-DDw9Ef4Q.js} +1 -1
- package/dist/ui/assets/{http-Dg5LSYRK.js → http-B0QxWc9M.js} +1 -1
- package/dist/ui/assets/{hurl-Y5uYzMZR.js → hurl-vMQ4lda1.js} +1 -1
- package/dist/ui/assets/java-DYRe2lWG.js +1 -0
- package/dist/ui/assets/javascript-CxyGqwcL.js +1 -0
- package/dist/ui/assets/{jinja-Bt30h8Ik.js → jinja-JUwV-fZt.js} +1 -1
- package/dist/ui/assets/{jison-D5uZ1Nyo.js → jison-7ZqCEvS8.js} +1 -1
- package/dist/ui/assets/json-dbltgiiA.js +1 -0
- package/dist/ui/assets/jsx-oDopT7YQ.js +1 -0
- package/dist/ui/assets/{julia-76hRaaGz.js → julia-CkKiNSav.js} +1 -1
- package/dist/ui/assets/{just-CDE7W0vW.js → just-DuqCAKJ3.js} +1 -1
- package/dist/ui/assets/{latex-CVO2Byab.js → latex-sudcRDSn.js} +1 -1
- package/dist/ui/assets/{liquid-CA-AS3EX.js → liquid-Di-08Js7.js} +1 -1
- package/dist/ui/assets/lua-YlqdMoV0.js +1 -0
- package/dist/ui/assets/{marko-_BWrPfny.js → marko-CJRNyJDb.js} +1 -1
- package/dist/ui/assets/{mdc-PyJv85eS.js → mdc-t12CzZHs.js} +1 -1
- package/dist/ui/assets/{nginx-DAWVw8yu.js → nginx-57-b4XwT.js} +1 -1
- package/dist/ui/assets/{nim-CKE1dzpU.js → nim-BzrswYQa.js} +1 -1
- package/dist/ui/assets/{perl-BBhWva19.js → perl-D9JR_iIh.js} +1 -1
- package/dist/ui/assets/{php-ChIeaAoF.js → php-Py2gFHil.js} +1 -1
- package/dist/ui/assets/{pug-CMgI5afi.js → pug-PzLLy0h1.js} +1 -1
- package/dist/ui/assets/{qml-CjxTkcFH.js → qml-By8fwgV4.js} +1 -1
- package/dist/ui/assets/r-CcezTbLq.js +1 -0
- package/dist/ui/assets/{razor-i4DbHr8p.js → razor-dG-vdhL_.js} +1 -1
- package/dist/ui/assets/regexp-BlsQ-N_8.js +1 -0
- package/dist/ui/assets/{rst-oy_97Kl4.js → rst-C2awDCat.js} +1 -1
- package/dist/ui/assets/{ruby-C5zYZIyl.js → ruby-zA2W_49d.js} +1 -1
- package/dist/ui/assets/{sas-BnMEh2S3.js → sas-D49bhyaN.js} +1 -1
- package/dist/ui/assets/scss-BQb-cp01.js +1 -0
- package/dist/ui/assets/shellscript-Dga4H_Ni.js +1 -0
- package/dist/ui/assets/{shellsession-BpE5o7_3.js → shellsession-n3-5CqcF.js} +1 -1
- package/dist/ui/assets/{soy-COesmhTY.js → soy-XYBOf_BA.js} +1 -1
- package/dist/ui/assets/sql-ET4u5Cpl.js +1 -0
- package/dist/ui/assets/{stata-CGQEuSZq.js → stata-CLHcJHO_.js} +1 -1
- package/dist/ui/assets/{surrealql-Bz4JbU-9.js → surrealql-BdjQ60T4.js} +1 -1
- package/dist/ui/assets/{svelte-1jM2ejXj.js → svelte-B2RPtKJe.js} +1 -1
- package/dist/ui/assets/{templ-C-VwELcp.js → templ-CrByPW_W.js} +1 -1
- package/dist/ui/assets/{tex-t1rUiQCm.js → tex-DZBkg363.js} +1 -1
- package/dist/ui/assets/{ts-tags-Bewoa6pS.js → ts-tags-DJR3Gphb.js} +1 -1
- package/dist/ui/assets/tsx-CajzROyy.js +1 -0
- package/dist/ui/assets/{twig-DVg-vELl.js → twig-BZjk5Zda.js} +1 -1
- package/dist/ui/assets/typescript-B-EWToLj.js +1 -0
- package/dist/ui/assets/{vue-wPQ7UlMy.js → vue-D_rHCCr8.js} +1 -1
- package/dist/ui/assets/{vue-html-BHtJ8geX.js → vue-html-CC4WlvVt.js} +1 -1
- package/dist/ui/assets/{vue-vine-CNSGAWwc.js → vue-vine-BgNMVgpk.js} +1 -1
- package/dist/ui/assets/xml-BI86-WbH.js +1 -0
- package/dist/ui/assets/{xsl-3_vJ27aE.js → xsl-DXeLZV4J.js} +1 -1
- package/dist/ui/assets/yaml-60_PFlWa.js +1 -0
- package/dist/workspaces/bootstrap.js +72 -0
- package/dist/workspaces/context.js +302 -0
- package/dist/workspaces/conversation-test-support.js +86 -0
- package/dist/{git-worktrees.js → workspaces/git/git-worktrees.js} +1 -1
- package/dist/workspaces/inventory.js +131 -0
- package/dist/workspaces/paths.js +55 -0
- package/dist/{remote-auth.js → workspaces/relay/auth/remote-auth.js} +2 -2
- package/dist/workspaces/relay/result-support.js +111 -0
- package/dist/workspaces/relay/tests/test-support.js +203 -0
- package/dist/{remote-mcp-connection-pool.js → workspaces/relay/transport/remote-mcp-connection-pool.js} +1 -1
- package/dist/workspaces/relay/types.js +1 -0
- package/dist/{remote-workspace-relay.js → workspaces/relay/workspace-relay.js} +23 -172
- package/dist/workspaces/resources/skills.js +285 -0
- package/dist/{review-checkpoints.js → workspaces/review/review-checkpoints.js} +2 -2
- package/dist/workspaces/sessions.js +457 -0
- package/dist/{workspace-store.js → workspaces/state/workspace-store.js} +2 -2
- package/dist/workspaces.js +69 -991
- package/docs/chatgpt-coding-workflow.md +3 -11
- package/docs/configuration.md +12 -25
- package/docs/gotchas.md +0 -30
- package/docs/roadmap.md +6 -10
- package/docs/security.md +1 -5
- package/docs/setup.md +0 -11
- package/package.json +6 -8
- package/scripts/ci/architecture.mjs +109 -0
- package/scripts/ci/verify.mjs +5 -0
- package/scripts/debug/accept/bootstrap.mjs +326 -0
- package/scripts/debug/accept/harness.mjs +76 -0
- package/scripts/debug/accept/support.mjs +432 -0
- package/scripts/debug/accept.mjs +43 -806
- package/scripts/debug/relay-accept/support.mjs +135 -0
- package/scripts/debug/relay-accept.mjs +26 -115
- package/scripts/debug/traffic/support.mjs +167 -0
- package/scripts/debug/traffic/traffic-audit.mjs +4 -161
- package/scripts/{lsp-interop-support.test.mjs → lsp/interop-support.test.mjs} +1 -1
- package/scripts/{lsp-interop.mjs → lsp/interop.mjs} +3 -3
- package/scripts/wiki/sync.mjs +21 -10
- package/dist/activity/bash-output-store.js +0 -127
- package/dist/pi-tools.js +0 -110
- package/dist/skills.js +0 -127
- package/dist/ui/assets/activity-panel-app-CUAN6zyW.js +0 -2
- package/dist/ui/assets/angular-html-BkgDQl-G.js +0 -1
- package/dist/ui/assets/c-IBzBpxAO.js +0 -1
- package/dist/ui/assets/chunk-EyZ2wyi3.js +0 -1
- package/dist/ui/assets/cpp-CVHeO-Jk.js +0 -1
- package/dist/ui/assets/css-DEfus9J5.js +0 -1
- package/dist/ui/assets/glsl-_ooCjaeB.js +0 -1
- package/dist/ui/assets/graphql-B9LqP-cY.js +0 -1
- package/dist/ui/assets/haml-BU5EoZBn.js +0 -1
- package/dist/ui/assets/heavy-payload-CgzrutLm.js +0 -4
- package/dist/ui/assets/html-D-C6YZk4.js +0 -1
- package/dist/ui/assets/java-ppHvycj5.js +0 -1
- package/dist/ui/assets/javascript-DDTjKLlQ.js +0 -1
- package/dist/ui/assets/json-Cw91r8h1.js +0 -1
- package/dist/ui/assets/jsx-04X2FT_1.js +0 -1
- package/dist/ui/assets/lua-CiyBp52Y.js +0 -1
- package/dist/ui/assets/r-DfFga4si.js +0 -1
- package/dist/ui/assets/regexp-iC9_nbSI.js +0 -1
- package/dist/ui/assets/review-payload-BrLbezbq.js +0 -1
- package/dist/ui/assets/scrollbar-CbhpdW05.js +0 -287
- package/dist/ui/assets/scss-BfZXsAWQ.js +0 -1
- package/dist/ui/assets/shellscript-BC2srNaB.js +0 -1
- package/dist/ui/assets/sql-Ccv_yeUm.js +0 -1
- package/dist/ui/assets/tsx-CTXzrBkN.js +0 -1
- package/dist/ui/assets/typescript--ElHoFkw.js +0 -1
- package/dist/ui/assets/workspace-app-Bhj96tsR.js +0 -1
- package/dist/ui/assets/workspace-app-CxwJuZyS.js +0 -111
- package/dist/ui/assets/workspace-app-D6UR0AFl.js +0 -5
- package/dist/ui/assets/workspace-app-ldjBmCJR.css +0 -1
- package/dist/ui/assets/workspace-lifecycle-app-Cqfhx9pV.js +0 -1
- package/dist/ui/assets/xml-JnmX6vyS.js +0 -1
- package/dist/ui/assets/yaml-OAcZkP-w.js +0 -1
- package/dist/ui/workspace-app.html +0 -18
- package/dist/ui/workspace-lifecycle-app.html +0 -18
- package/docs/agent-profile-schema.md +0 -114
- package/docs/artifact-exchange.md +0 -65
- package/docs/versioning.md +0 -205
- /package/capabilities/{managed-worktrees → workspace/managed-worktrees}/GUIDE.md +0 -0
- /package/capabilities/{workspace-tasks → workspace/workspace-tasks}/GUIDE.md +0 -0
- /package/dist/activity/{process-output-audit.js → runtime/process-output-audit.js} +0 -0
- /package/dist/{artifact-error.js → mcp/artifacts/artifact-error.js} +0 -0
- /package/dist/{artifact-tools.js → mcp/artifacts/artifact-tools.js} +0 -0
- /package/dist/{incoming-artifacts.js → mcp/artifacts/incoming-artifacts.js} +0 -0
- /package/dist/{advertised-files.js → mcp/filesystem/advertised-files.js} +0 -0
- /package/dist/{apply-patch.js → mcp/filesystem/apply-patch.js} +0 -0
- /package/dist/{file-mutations.js → mcp/filesystem/file-mutations.js} +0 -0
- /package/dist/{roots.js → mcp/filesystem/roots.js} +0 -0
- /package/dist/{oauth → mcp/oauth}/public-url.js +0 -0
- /package/dist/{oauth → mcp/oauth}/router.js +0 -0
- /package/dist/{operations → mcp/operations}/batch/executor.js +0 -0
- /package/dist/{operations → mcp/operations}/batch/scheduler.js +0 -0
- /package/dist/{operations → mcp/operations}/batch/types.js +0 -0
- /package/dist/{operations → mcp/operations}/bulk-mutation.js +0 -0
- /package/dist/{operations → mcp/operations}/bulk-read.js +0 -0
- /package/dist/{operations → mcp/operations}/core-operation-executor.js +0 -0
- /package/dist/{process-platform.js → mcp/process/process-platform.js} +0 -0
- /package/dist/{process-sessions.js → mcp/process/process-sessions.js} +0 -0
- /package/dist/{request-meta.js → mcp/request-meta.js} +0 -0
- /package/dist/{mcp-sessions.js → mcp/server/transport/mcp-sessions.js} +0 -0
- /package/dist/{server-shutdown.js → mcp/server/transport/server-shutdown.js} +0 -0
- /package/dist/{logger.js → runtime/logging/logger.js} +0 -0
- /package/dist/{db → runtime/state/db}/schema.js +0 -0
- /package/dist/{composite-activity.js → workspaces/composite/composite-activity.js} +0 -0
- /package/dist/{composite-workspaces.js → workspaces/composite/composite-workspaces.js} +0 -0
- /package/dist/{git.js → workspaces/git/git.js} +0 -0
- /package/dist/{workspace-presentation.js → workspaces/presentation/workspace-presentation.js} +0 -0
- /package/dist/{remote-transport.js → workspaces/relay/transport/remote-transport.js} +0 -0
- /package/dist/{workspace-task-reminders.js → workspaces/tasks/workspace-task-reminders.js} +0 -0
- /package/dist/{workspace-tasks.js → workspaces/tasks/workspace-tasks.js} +0 -0
- /package/scripts/{lsp-interop-support.mjs → lsp/interop-support.mjs} +0 -0
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { debugBaseUrl, debugMcpUrl } from "../runtime.mjs";
|
|
5
|
+
import {
|
|
6
|
+
authorizeDebugClient,
|
|
7
|
+
callTool,
|
|
8
|
+
curlRequest,
|
|
9
|
+
initializeRequest,
|
|
10
|
+
jsonRequest,
|
|
11
|
+
mcpHeaders,
|
|
12
|
+
mcpRequest,
|
|
13
|
+
pass,
|
|
14
|
+
toolText,
|
|
15
|
+
waitForHealth,
|
|
16
|
+
} from "./support.mjs";
|
|
17
|
+
|
|
18
|
+
/** Validate the public MCP/OAuth contract and establish the canonical checkout
|
|
19
|
+
* Workspace used by the remaining acceptance scenarios. */
|
|
20
|
+
export async function runBootstrapAcceptance({ server, packageJson, ownerToken, checkoutWorkspace, stateDir }) {
|
|
21
|
+
const health = await waitForHealth(server);
|
|
22
|
+
assert.deepEqual(health, { ok: true, name: "forgerelay" });
|
|
23
|
+
pass("health", JSON.stringify(health));
|
|
24
|
+
|
|
25
|
+
const protectedResource = jsonRequest(`${debugBaseUrl}/.well-known/oauth-protected-resource/mcp`);
|
|
26
|
+
assert.equal(protectedResource.status, 200);
|
|
27
|
+
assert.equal(protectedResource.json.resource, debugMcpUrl);
|
|
28
|
+
assert.equal(protectedResource.json.resource_name, "ForgeRelay");
|
|
29
|
+
pass("OAuth protected-resource discovery", protectedResource.json.resource);
|
|
30
|
+
|
|
31
|
+
const authorizationServer = jsonRequest(`${debugBaseUrl}/.well-known/oauth-authorization-server`);
|
|
32
|
+
assert.equal(authorizationServer.status, 200);
|
|
33
|
+
assert.equal(authorizationServer.json.authorization_endpoint, `${debugBaseUrl}/authorize`);
|
|
34
|
+
assert.equal(authorizationServer.json.token_endpoint, `${debugBaseUrl}/token`);
|
|
35
|
+
assert.equal(authorizationServer.json.registration_endpoint, `${debugBaseUrl}/register`);
|
|
36
|
+
pass("OAuth authorization-server discovery", authorizationServer.json.token_endpoint);
|
|
37
|
+
|
|
38
|
+
const unauthorized = curlRequest({
|
|
39
|
+
method: "POST",
|
|
40
|
+
url: debugMcpUrl,
|
|
41
|
+
headers: mcpHeaders(),
|
|
42
|
+
body: JSON.stringify(initializeRequest(1)),
|
|
43
|
+
});
|
|
44
|
+
assert.equal(unauthorized.status, 401);
|
|
45
|
+
assert.equal(JSON.parse(unauthorized.body).error, "invalid_token");
|
|
46
|
+
pass("unauthorized MCP is rejected", "HTTP 401 invalid_token");
|
|
47
|
+
|
|
48
|
+
const oauth = authorizeDebugClient(authorizationServer.json, ownerToken);
|
|
49
|
+
pass("OAuth owner-password flow", "registered client and issued access token");
|
|
50
|
+
|
|
51
|
+
const initialized = mcpRequest(oauth.accessToken, undefined, initializeRequest(1));
|
|
52
|
+
assert.equal(initialized.response.status, 200);
|
|
53
|
+
const sessionId = initialized.response.headers.get("mcp-session-id");
|
|
54
|
+
assert.ok(sessionId);
|
|
55
|
+
assert.equal(initialized.message.result.serverInfo.name, "forgerelay");
|
|
56
|
+
assert.equal(initialized.message.result.serverInfo.title, "ForgeRelay");
|
|
57
|
+
assert.equal(initialized.message.result.serverInfo.version, packageJson.version);
|
|
58
|
+
const serverInstructions = initialized.message.result.instructions ?? "";
|
|
59
|
+
assert.match(serverInstructions, /Shell commands may modify ordinary project files/);
|
|
60
|
+
assert.match(serverInstructions, /\/etc\/sudoers/);
|
|
61
|
+
assert.match(serverInstructions, /configuration files through shell only when the user's request explicitly calls for that configuration change/);
|
|
62
|
+
assert.match(serverInstructions, /Project-work order: open_workspace if needed → activity_panel\(workspaceId\) once → work tools/);
|
|
63
|
+
assert.ok(serverInstructions.length < 3_000, `server instructions should stay compact, got ${serverInstructions.length} characters`);
|
|
64
|
+
assert.doesNotMatch(serverInstructions, /fast-forwards the original target branch/);
|
|
65
|
+
assert.doesNotMatch(serverInstructions, /Do not create or modify files with bash/);
|
|
66
|
+
pass(
|
|
67
|
+
"MCP initialize",
|
|
68
|
+
JSON.stringify(initialized.message.result.serverInfo),
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const initializedNotification = curlRequest({
|
|
72
|
+
method: "POST",
|
|
73
|
+
url: debugMcpUrl,
|
|
74
|
+
headers: mcpHeaders(oauth.accessToken, sessionId),
|
|
75
|
+
body: JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" }),
|
|
76
|
+
});
|
|
77
|
+
assert.equal(initializedNotification.status, 202);
|
|
78
|
+
|
|
79
|
+
const tools = mcpRequest(oauth.accessToken, sessionId, {
|
|
80
|
+
jsonrpc: "2.0",
|
|
81
|
+
id: 2,
|
|
82
|
+
method: "tools/list",
|
|
83
|
+
params: {},
|
|
84
|
+
}).message.result.tools;
|
|
85
|
+
const toolNames = tools.map((tool) => tool.name);
|
|
86
|
+
assert.deepEqual(toolNames, [
|
|
87
|
+
"open_workspace",
|
|
88
|
+
"activity_panel",
|
|
89
|
+
"activity_snapshot",
|
|
90
|
+
"activity_index",
|
|
91
|
+
"activity_detail",
|
|
92
|
+
"activity_output",
|
|
93
|
+
"workspace_instruction",
|
|
94
|
+
"capability",
|
|
95
|
+
"close_workspace",
|
|
96
|
+
"read",
|
|
97
|
+
"write",
|
|
98
|
+
"edit",
|
|
99
|
+
"rename",
|
|
100
|
+
"delete",
|
|
101
|
+
"bash",
|
|
102
|
+
]);
|
|
103
|
+
const bashTool = tools.find((tool) => tool.name === "bash");
|
|
104
|
+
assert.match(bashTool?.description ?? "", /local user's authority/);
|
|
105
|
+
assert.doesNotMatch(bashTool?.description ?? "", /may modify ordinary project files/);
|
|
106
|
+
assert.doesNotMatch(bashTool?.description ?? "", /\/etc\/sudoers/);
|
|
107
|
+
assert.doesNotMatch(bashTool?.description ?? "", /external device or hardware mutations/);
|
|
108
|
+
assert.doesNotMatch(bashTool?.description ?? "", /Do not use bash to create, move, rename, or delete project files/);
|
|
109
|
+
assert.equal(bashTool?.inputSchema?.properties?.timeout, undefined);
|
|
110
|
+
assert.match(bashTool?.description ?? "", /action=process/);
|
|
111
|
+
assert.equal(bashTool?.inputSchema?.properties?.yieldTimeMs?.maximum, 300000);
|
|
112
|
+
assert.equal(bashTool?.inputSchema?.properties?.timeoutMs?.maximum, 86400000);
|
|
113
|
+
assert.match(bashTool?.inputSchema?.properties?.processId?.description ?? "", /action=process/);
|
|
114
|
+
assert.match(bashTool?.inputSchema?.properties?.interrupt?.description ?? "", /SIGINT/);
|
|
115
|
+
const openWorkspaceTool = tools.find((tool) => tool.name === "open_workspace");
|
|
116
|
+
assert.ok(openWorkspaceTool?.inputSchema?.properties?.workspaceId);
|
|
117
|
+
assert.ok(openWorkspaceTool?.inputSchema?.properties?.newWorkspace);
|
|
118
|
+
assert.ok(openWorkspaceTool?.outputSchema?.properties?.staleWorkspaces);
|
|
119
|
+
assert.ok(openWorkspaceTool?.outputSchema?.properties?.capabilityFingerprint);
|
|
120
|
+
assert.ok(openWorkspaceTool?.outputSchema?.properties?.capabilityCatalog);
|
|
121
|
+
assert.ok(openWorkspaceTool?.outputSchema?.properties?.capabilityGuides);
|
|
122
|
+
const capabilityTool = tools.find((tool) => tool.name === "capability");
|
|
123
|
+
assert.deepEqual(capabilityTool?._meta?.["openai/fileParams"], ["file"]);
|
|
124
|
+
const activityPanelTool = tools.find((tool) => tool.name === "activity_panel");
|
|
125
|
+
const activityTemplateUri = activityPanelTool?._meta?.ui?.resourceUri;
|
|
126
|
+
assert.match(
|
|
127
|
+
activityTemplateUri ?? "",
|
|
128
|
+
/^ui:\/\/forgerelay\/activity-panel-app-[0-9a-f]{12}\.html$/,
|
|
129
|
+
);
|
|
130
|
+
assert.deepEqual(activityPanelTool?._meta?.ui?.visibility, ["model", "app"]);
|
|
131
|
+
pass("MCP tools/list", `${toolNames.length} tools: ${toolNames.join(", ")}`);
|
|
132
|
+
|
|
133
|
+
const resources = mcpRequest(oauth.accessToken, sessionId, {
|
|
134
|
+
jsonrpc: "2.0",
|
|
135
|
+
id: 21,
|
|
136
|
+
method: "resources/list",
|
|
137
|
+
params: {},
|
|
138
|
+
}).message.result.resources;
|
|
139
|
+
const currentActivityResource = resources.find((resource) => resource.uri === activityTemplateUri);
|
|
140
|
+
assert.ok(currentActivityResource);
|
|
141
|
+
assert.equal(currentActivityResource._meta?.ui?.domain, debugBaseUrl);
|
|
142
|
+
assert.equal(resources.length, 1);
|
|
143
|
+
|
|
144
|
+
const resourceTemplates = mcpRequest(oauth.accessToken, sessionId, {
|
|
145
|
+
jsonrpc: "2.0",
|
|
146
|
+
id: 22,
|
|
147
|
+
method: "resources/templates/list",
|
|
148
|
+
params: {},
|
|
149
|
+
}).message.result.resourceTemplates;
|
|
150
|
+
assert.deepEqual(resourceTemplates, []);
|
|
151
|
+
|
|
152
|
+
const readTemplate = (id, uri) => mcpRequest(oauth.accessToken, sessionId, {
|
|
153
|
+
jsonrpc: "2.0",
|
|
154
|
+
id,
|
|
155
|
+
method: "resources/read",
|
|
156
|
+
params: { uri },
|
|
157
|
+
}).message.result.contents[0];
|
|
158
|
+
|
|
159
|
+
const activityTemplate = readTemplate(24, activityTemplateUri);
|
|
160
|
+
assert.equal(activityTemplate.uri, activityTemplateUri);
|
|
161
|
+
assert.equal(activityTemplate.mimeType, "text/html;profile=mcp-app");
|
|
162
|
+
assert.match(activityTemplate.text ?? "", /activity-panel-app-[^\"]+\.js/);
|
|
163
|
+
assert.equal(activityTemplate._meta?.ui?.domain, debugBaseUrl);
|
|
164
|
+
assert.ok(activityTemplate._meta?.ui?.csp?.resourceDomains?.includes(debugBaseUrl));
|
|
165
|
+
const scriptUrl = activityTemplate.text?.match(/<script type="module" crossorigin src="([^"]+)"/)?.[1];
|
|
166
|
+
assert.ok(scriptUrl);
|
|
167
|
+
const scriptAsset = curlRequest({ method: "GET", url: scriptUrl });
|
|
168
|
+
assert.equal(scriptAsset.status, 200, scriptAsset.body);
|
|
169
|
+
|
|
170
|
+
pass("MCP App template", activityTemplateUri);
|
|
171
|
+
|
|
172
|
+
const workspaceConversationMeta = { "openai/session": "acceptance-workspace" };
|
|
173
|
+
const opened = callTool(oauth.accessToken, sessionId, 3, "open_workspace", {
|
|
174
|
+
path: checkoutWorkspace,
|
|
175
|
+
}, workspaceConversationMeta);
|
|
176
|
+
const workspaceId = opened.structuredContent.workspaceId;
|
|
177
|
+
assert.match(workspaceId, /^ws_/);
|
|
178
|
+
assert.equal(opened.structuredContent.action, "open");
|
|
179
|
+
assert.equal(opened.structuredContent.root, checkoutWorkspace);
|
|
180
|
+
assert.equal(opened.structuredContent.mode, "checkout");
|
|
181
|
+
assert.equal(typeof opened.structuredContent.contextFingerprint, "string");
|
|
182
|
+
assert.deepEqual(opened.structuredContent.capabilityFingerprint, {
|
|
183
|
+
version: packageJson.version,
|
|
184
|
+
toolMode: "full",
|
|
185
|
+
capabilities: [
|
|
186
|
+
"workspace.close",
|
|
187
|
+
"worktree.managed",
|
|
188
|
+
"filesystem.rename-move",
|
|
189
|
+
"filesystem.delete",
|
|
190
|
+
"process.lifecycle",
|
|
191
|
+
"hooks.lifecycle",
|
|
192
|
+
"capability-guides.read",
|
|
193
|
+
"code.intelligence",
|
|
194
|
+
"workspace.tasks",
|
|
195
|
+
"batch.execute",
|
|
196
|
+
...(process.platform === "linux" ? ["artifact.native-download"] : []),
|
|
197
|
+
"ui.mcp-app",
|
|
198
|
+
"review.changes",
|
|
199
|
+
],
|
|
200
|
+
});
|
|
201
|
+
const capabilityCatalog = opened.structuredContent.capabilityCatalog;
|
|
202
|
+
assert.deepEqual(capabilityCatalog.map((entry) => entry.name), [
|
|
203
|
+
"hooks.check",
|
|
204
|
+
"review.changes",
|
|
205
|
+
"code.intelligence",
|
|
206
|
+
"workspace.tasks",
|
|
207
|
+
"batch.execute",
|
|
208
|
+
...(process.platform === "linux" ? ["artifact.download"] : []),
|
|
209
|
+
]);
|
|
210
|
+
assert.equal(capabilityCatalog[0].available, true);
|
|
211
|
+
assert.equal(capabilityCatalog[0].guide.name, "lifecycle-hooks");
|
|
212
|
+
|
|
213
|
+
const checkoutTaskStatePath = join(stateDir, "workspaces", workspaceId, "tasks.json");
|
|
214
|
+
assert.ok(existsSync(checkoutTaskStatePath));
|
|
215
|
+
const checkoutTaskList = callTool(oauth.accessToken, sessionId, 130, "capability", {
|
|
216
|
+
workspaceId,
|
|
217
|
+
name: "workspace.tasks",
|
|
218
|
+
action: "run",
|
|
219
|
+
arguments: { operation: "list.create", name: "7677 release tasks" },
|
|
220
|
+
});
|
|
221
|
+
assert.equal(checkoutTaskList.isError, undefined);
|
|
222
|
+
const checkoutListId = checkoutTaskList.structuredContent.result.lists[0].id;
|
|
223
|
+
const checkoutTask = callTool(oauth.accessToken, sessionId, 131, "capability", {
|
|
224
|
+
workspaceId,
|
|
225
|
+
name: "workspace.tasks",
|
|
226
|
+
action: "run",
|
|
227
|
+
arguments: {
|
|
228
|
+
operation: "task.create",
|
|
229
|
+
listId: checkoutListId,
|
|
230
|
+
subject: "Verify v0.8.3 Task persistence",
|
|
231
|
+
content: "created through real MCP",
|
|
232
|
+
status: "in_progress",
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
assert.equal(checkoutTask.isError, undefined);
|
|
236
|
+
const checkoutTaskId = checkoutTask.structuredContent.result.lists[0].tasks[0].id;
|
|
237
|
+
const taskFingerprintBeforeExternal = checkoutTask.structuredContent.result.fingerprint;
|
|
238
|
+
const externalTaskState = JSON.parse(readFileSync(checkoutTaskStatePath, "utf8"));
|
|
239
|
+
externalTaskState.lists[0].tasks[0].content = "reloaded external task edit";
|
|
240
|
+
writeFileSync(checkoutTaskStatePath, `${JSON.stringify(externalTaskState, null, 2)}\n`);
|
|
241
|
+
const reloadedCheckoutTasks = callTool(oauth.accessToken, sessionId, 132, "capability", {
|
|
242
|
+
workspaceId,
|
|
243
|
+
name: "workspace.tasks",
|
|
244
|
+
action: "run",
|
|
245
|
+
arguments: {
|
|
246
|
+
operation: "get",
|
|
247
|
+
level: "detail",
|
|
248
|
+
listId: checkoutListId,
|
|
249
|
+
taskId: checkoutTaskId,
|
|
250
|
+
},
|
|
251
|
+
});
|
|
252
|
+
assert.equal(reloadedCheckoutTasks.isError, undefined);
|
|
253
|
+
assert.equal(reloadedCheckoutTasks.structuredContent.result.task.id, checkoutTaskId);
|
|
254
|
+
assert.equal(reloadedCheckoutTasks.structuredContent.result.task.content, "reloaded external task edit");
|
|
255
|
+
assert.notEqual(reloadedCheckoutTasks.structuredContent.result.fingerprint, taskFingerprintBeforeExternal);
|
|
256
|
+
|
|
257
|
+
const checkoutTaskSummary = callTool(oauth.accessToken, sessionId, 150, "capability", {
|
|
258
|
+
workspaceId,
|
|
259
|
+
name: "workspace.tasks",
|
|
260
|
+
action: "run",
|
|
261
|
+
arguments: { operation: "get" },
|
|
262
|
+
});
|
|
263
|
+
const summaryProjection = checkoutTaskSummary.structuredContent.result;
|
|
264
|
+
assert.equal(summaryProjection.level, "summary");
|
|
265
|
+
assert.equal(summaryProjection.lists[0].id, checkoutListId);
|
|
266
|
+
assert.equal(summaryProjection.lists[0].taskCount, 1);
|
|
267
|
+
assert.equal(summaryProjection.lists[0].unfinishedTaskCount, 1);
|
|
268
|
+
assert.equal(JSON.stringify(summaryProjection).includes(checkoutTaskId), false);
|
|
269
|
+
assert.equal(JSON.stringify(summaryProjection).includes("reloaded external task edit"), false);
|
|
270
|
+
|
|
271
|
+
const checkoutTaskHeaders = callTool(oauth.accessToken, sessionId, 151, "capability", {
|
|
272
|
+
workspaceId,
|
|
273
|
+
name: "workspace.tasks",
|
|
274
|
+
action: "run",
|
|
275
|
+
arguments: { operation: "get", level: "headers", listId: checkoutListId },
|
|
276
|
+
});
|
|
277
|
+
const headersProjection = checkoutTaskHeaders.structuredContent.result;
|
|
278
|
+
assert.equal(headersProjection.level, "headers");
|
|
279
|
+
assert.equal(headersProjection.lists.length, 1);
|
|
280
|
+
assert.equal(headersProjection.lists[0].tasks[0].id, checkoutTaskId);
|
|
281
|
+
assert.equal(headersProjection.lists[0].tasks[0].subject, "Verify v0.8.3 Task persistence");
|
|
282
|
+
assert.equal("content" in headersProjection.lists[0].tasks[0], false);
|
|
283
|
+
|
|
284
|
+
const checkoutTaskDetail = callTool(oauth.accessToken, sessionId, 152, "capability", {
|
|
285
|
+
workspaceId,
|
|
286
|
+
name: "workspace.tasks",
|
|
287
|
+
action: "run",
|
|
288
|
+
arguments: {
|
|
289
|
+
operation: "get",
|
|
290
|
+
level: "detail",
|
|
291
|
+
listId: checkoutListId,
|
|
292
|
+
taskId: checkoutTaskId,
|
|
293
|
+
},
|
|
294
|
+
});
|
|
295
|
+
const detailProjection = checkoutTaskDetail.structuredContent.result;
|
|
296
|
+
assert.equal(detailProjection.level, "detail");
|
|
297
|
+
assert.equal(detailProjection.task.id, checkoutTaskId);
|
|
298
|
+
assert.equal(detailProjection.task.content, "reloaded external task edit");
|
|
299
|
+
pass("workspace.tasks progressive disclosure", "summary -> headers -> one Task detail through real MCP");
|
|
300
|
+
|
|
301
|
+
for (let index = 0; index < 29; index += 1) {
|
|
302
|
+
const semanticWork = callTool(oauth.accessToken, sessionId, 160 + index, "read", {
|
|
303
|
+
workspaceId,
|
|
304
|
+
path: "README.md",
|
|
305
|
+
});
|
|
306
|
+
assert.doesNotMatch(toolText(semanticWork), /Reminder: this Workspace has unfinished active Tasks/);
|
|
307
|
+
}
|
|
308
|
+
const reminderWork = callTool(oauth.accessToken, sessionId, 189, "read", {
|
|
309
|
+
workspaceId,
|
|
310
|
+
path: "README.md",
|
|
311
|
+
});
|
|
312
|
+
assert.match(toolText(reminderWork), /Reminder: this Workspace has unfinished active Tasks/);
|
|
313
|
+
assert.equal(toolText(reminderWork).includes("reloaded external task edit"), false);
|
|
314
|
+
pass("workspace.tasks reminder", "default 30 semantic work calls emitted one body-free reminder");
|
|
315
|
+
|
|
316
|
+
return {
|
|
317
|
+
oauth,
|
|
318
|
+
sessionId,
|
|
319
|
+
workspaceConversationMeta,
|
|
320
|
+
opened,
|
|
321
|
+
workspaceId,
|
|
322
|
+
capabilityCatalog,
|
|
323
|
+
checkoutListId,
|
|
324
|
+
checkoutTaskId,
|
|
325
|
+
};
|
|
326
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
3
|
+
import { randomBytes, randomUUID } from "node:crypto";
|
|
4
|
+
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import { join, resolve } from "node:path";
|
|
7
|
+
import {
|
|
8
|
+
createDebugEnvironment,
|
|
9
|
+
debugRoot,
|
|
10
|
+
repoRoot,
|
|
11
|
+
} from "../runtime.mjs";
|
|
12
|
+
import {
|
|
13
|
+
setupCodeIntelligenceProject as setupCodeIntelligenceAcceptanceProject,
|
|
14
|
+
} from "../code-intelligence-accept.mjs";
|
|
15
|
+
import { assertCurlAvailable, assertDebugPortFree, pass, setupGitProject } from "./support.mjs";
|
|
16
|
+
|
|
17
|
+
/** Build the disposable 7677 acceptance environment in one place so the main
|
|
18
|
+
* scenario remains a readable sequence of externally observable assertions. */
|
|
19
|
+
export async function createAcceptanceHarness() {
|
|
20
|
+
const packageJson = JSON.parse(readFileSync(join(repoRoot, "package.json"), "utf8"));
|
|
21
|
+
const acceptanceRoot = resolve(debugRoot, "acceptance");
|
|
22
|
+
const stateDir = resolve(acceptanceRoot, "state");
|
|
23
|
+
const worktreeRoot = resolve(acceptanceRoot, "worktrees");
|
|
24
|
+
const hookLog = resolve(acceptanceRoot, "hooks.jsonl");
|
|
25
|
+
const checkoutWorkspace = resolve(acceptanceRoot, "workspace");
|
|
26
|
+
const lifecycleDeleteWorkspace = resolve(acceptanceRoot, "delete-workspace");
|
|
27
|
+
const codeIntelligenceLog = resolve(acceptanceRoot, "code-intelligence-lsp.jsonl");
|
|
28
|
+
const fakeLanguageServer = resolve(repoRoot, "src", "lsp", "test-fixtures", "fake-lsp-server.mjs");
|
|
29
|
+
const gitProject = resolve(acceptanceRoot, "git-project");
|
|
30
|
+
const releaseProject = resolve(acceptanceRoot, "release-project");
|
|
31
|
+
const releaseRemote = resolve(acceptanceRoot, "release-remote.git");
|
|
32
|
+
const ownerToken = randomBytes(32).toString("base64url");
|
|
33
|
+
const tempAcceptanceRoot = resolve(tmpdir(), `forgerelay-debug-acceptance-${randomUUID()}`);
|
|
34
|
+
|
|
35
|
+
assertCurlAvailable();
|
|
36
|
+
await assertDebugPortFree();
|
|
37
|
+
rmSync(acceptanceRoot, { recursive: true, force: true });
|
|
38
|
+
mkdirSync(acceptanceRoot, { recursive: true });
|
|
39
|
+
setupGitProject(checkoutWorkspace);
|
|
40
|
+
setupGitProject(lifecycleDeleteWorkspace);
|
|
41
|
+
writeFileSync(join(lifecycleDeleteWorkspace, "keep.txt"), "keep checkout files\n");
|
|
42
|
+
writeFileSync(join(lifecycleDeleteWorkspace, "AGENTS.md"), "INSPECTION_ACCEPTANCE_BOOTSTRAP_SECRET\n");
|
|
43
|
+
setupCodeIntelligenceAcceptanceProject({ root: checkoutWorkspace, fakeLanguageServer, logPath: codeIntelligenceLog });
|
|
44
|
+
|
|
45
|
+
const { env } = createDebugEnvironment({
|
|
46
|
+
ownerToken,
|
|
47
|
+
stateDir,
|
|
48
|
+
worktreeRoot,
|
|
49
|
+
hookLog,
|
|
50
|
+
widgets: "changes",
|
|
51
|
+
});
|
|
52
|
+
env.FORGERELAY_ARTIFACTS = "1";
|
|
53
|
+
const doctor = spawnSync(process.execPath, ["--import", "tsx", "src/cli.ts", "doctor"], {
|
|
54
|
+
cwd: repoRoot,
|
|
55
|
+
env,
|
|
56
|
+
encoding: "utf8",
|
|
57
|
+
});
|
|
58
|
+
assert.equal(doctor.status, 0, doctor.stderr);
|
|
59
|
+
assert.match(doctor.stdout, /Public base URL: http:\/\/127\.0\.0\.1:7677/);
|
|
60
|
+
assert.match(doctor.stdout, /Tool mode: full/);
|
|
61
|
+
assert.match(doctor.stdout, /Widgets: changes/);
|
|
62
|
+
assert.match(doctor.stdout, /Trust proxy: off/);
|
|
63
|
+
pass("doctor resolved MCP shape", "public URL + tool/widgets/proxy state");
|
|
64
|
+
|
|
65
|
+
const server = spawn(process.execPath, ["--import", "tsx", "src/cli.ts", "serve"], {
|
|
66
|
+
cwd: repoRoot,
|
|
67
|
+
env,
|
|
68
|
+
stdio: ["ignore", "inherit", "inherit"],
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
packageJson, acceptanceRoot, stateDir, worktreeRoot, hookLog, checkoutWorkspace,
|
|
73
|
+
lifecycleDeleteWorkspace, codeIntelligenceLog, fakeLanguageServer, gitProject, releaseProject,
|
|
74
|
+
releaseRemote, ownerToken, tempAcceptanceRoot, env, server,
|
|
75
|
+
};
|
|
76
|
+
}
|