@mcp-abap-adt/compact 18.1.0 → 19.1.0

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.
Files changed (40) hide show
  1. package/README.md +73 -27
  2. package/bin/mcp-abap-adt-compact.js +7 -8
  3. package/dist/index.d.ts +9 -8
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +11 -9
  6. package/dist/index.js.map +1 -1
  7. package/dist/launcher.d.ts +10 -22
  8. package/dist/launcher.d.ts.map +1 -1
  9. package/dist/launcher.js +29 -151
  10. package/dist/launcher.js.map +1 -1
  11. package/docs/AVAILABLE_TOOLS.md +308 -139
  12. package/package.json +7 -7
  13. package/dist/debug/group.d.ts +0 -21
  14. package/dist/debug/group.d.ts.map +0 -1
  15. package/dist/debug/group.js +0 -39
  16. package/dist/debug/group.js.map +0 -1
  17. package/dist/debug/handleHandlerDebugStart.d.ts +0 -137
  18. package/dist/debug/handleHandlerDebugStart.d.ts.map +0 -1
  19. package/dist/debug/handleHandlerDebugStart.js +0 -71
  20. package/dist/debug/handleHandlerDebugStart.js.map +0 -1
  21. package/dist/debug/handleHandlerDebugStep.d.ts +0 -49
  22. package/dist/debug/handleHandlerDebugStep.d.ts.map +0 -1
  23. package/dist/debug/handleHandlerDebugStep.js +0 -118
  24. package/dist/debug/handleHandlerDebugStep.js.map +0 -1
  25. package/dist/debug/handleHandlerDebugView.d.ts +0 -36
  26. package/dist/debug/handleHandlerDebugView.d.ts.map +0 -1
  27. package/dist/debug/handleHandlerDebugView.js +0 -72
  28. package/dist/debug/handleHandlerDebugView.js.map +0 -1
  29. package/dist/debug/handleHandlerDebugWait.d.ts +0 -29
  30. package/dist/debug/handleHandlerDebugWait.d.ts.map +0 -1
  31. package/dist/debug/handleHandlerDebugWait.js +0 -39
  32. package/dist/debug/handleHandlerDebugWait.js.map +0 -1
  33. package/dist/debug/shared.d.ts +0 -23
  34. package/dist/debug/shared.d.ts.map +0 -1
  35. package/dist/debug/shared.js +0 -45
  36. package/dist/debug/shared.js.map +0 -1
  37. package/dist/group.d.ts +0 -6
  38. package/dist/group.d.ts.map +0 -1
  39. package/dist/group.js +0 -35
  40. package/dist/group.js.map +0 -1
package/README.md CHANGED
@@ -1,23 +1,46 @@
1
1
  # @mcp-abap-adt/compact
2
2
 
3
- The compact MCP server — the command that serves all 25, and the four debugger verbs on request.
3
+ The compact MCP server over **stdio** — the command that serves all 29, the four debugger tools, the
4
+ leftover sessions, background runs and batch mode (`HandlerBatch`). The 17 that change nothing alone are
5
+ [`@mcp-abap-adt/compact-ro`](https://www.npmjs.com/package/@mcp-abap-adt/compact-ro)
6
+ (`mcp-abap-adt-compact-ro`): the binary fixes the tool set (19.0.0), there is no `--exposition`.
7
+ Streamable HTTP is [`@mcp-abap-adt/compact-http`](https://www.npmjs.com/package/@mcp-abap-adt/compact-http)
8
+ (`mcp-abap-adt-compact-http`), SSE [`@mcp-abap-adt/compact-sse`](https://www.npmjs.com/package/@mcp-abap-adt/compact-sse)
9
+ (`mcp-abap-adt-compact-sse`): the same tools, a package per transport.
4
10
 
5
11
  ## What compact is
6
12
 
7
13
  A different decomposition of the same ABAP ADT surface: the **operation** is the
8
14
  tool and the object moves into the arguments. Where the object-oriented surface has
9
15
  `CreateClass`, `CreateDomain`, `CreateDdl` and so on, compact has one
10
- `HandlerCreate` with `object_type`. Twenty-five tool schemas instead of hundreds.
16
+ `HandlerCreate` with `object_type`. Twenty-seven tool schemas instead of hundreds.
11
17
 
12
18
  It exists for a host that **cannot build a retrieval pipeline of its own** — a small
13
19
  context, no tool-RAG, no way to select tools per request — and must still drive ABAP
14
20
  through MCP reliably. A consumer that does select per request (cloud-llm-hub, for
15
21
  one) has no use for it and should take `@mcp-abap-adt/lib` instead.
16
22
 
23
+ **The low set's analogue.** The low set left the full binaries in 19.0.0; its single-step operations are compact's: `HandlerCreate` (the create request alone — no validation, lock, write, check or activation; the object is created inactive with what the create carries; its schema lists only what the create sends; `UNIT_TEST` and `CDS_UNIT_TEST`, whose create is a chain, are refused — the full set serves `CreateUnitTest` and `CreateCdsUnitTest`), `HandlerLock`, `HandlerUpdate` with the `lock_handle` it answered (one request: the write alone, under your lock; `lock_handle` is required; for PACKAGE, DOMAIN, DATA_ELEMENT and FUNCTION_GROUP `source_code` is the whole metadata document, sent as given — read it with `HandlerGet` part `metadata`, change it, pass all of it back; for SERVICE_BINDING the write is its publication request), `HandlerUnlock`, `HandlerDeletionCheck` (the one deletion check, SAP's verdict as it came), `HandlerDelete` (one request: the deletion request alone, with no lock held on the object; a class include and `UNIT_TEST` are written empty by one `PUT` under your class lock's `lock_handle`), `HandlerCheckRun`, `HandlerValidate`, `HandlerActivate` (one request: one object of a type the per-object activation maps answers its verdict; every other call starts an activation run and answers `{ run_id }`), and `HandlerGet` — one request per part: `source` the source alone, `metadata` the metadata document alone (PACKAGE, DOMAIN, DATA_ELEMENT and FUNCTION_GROUP have only `metadata`; a function module is named `GROUP|MODULE` or with `function_group_name`), and `object_structure` / `node_structure` / `virtual_folders` (a package's blank node structure is the empty listing with `blank`: an empty package, or no package of that name), and `activation_status` / `activation_results` (an activation run by its `run_id`: its status, then its messages — asking again until the status settles is yours), and `object_type` `UNIT_TEST` / `CDS_UNIT_TEST` (a unit-test run's result by its `run_id`, one request, as `HandlerUnitTestResult` / `HandlerCdsUnitTestResult` read it; the status is `HandlerUnitTestStatus` / `HandlerCdsUnitTestStatus`, asked until it says `FINISHED`). `HandlerDumpList` reads one page per call (`top` 1 to 100, `to`): its `next_to` is the `to` of SAP's next link, and following it is yours; that page starts at the boundary second, inclusive, so match entries by `dump_id`. **Keeping a lock from `HandlerLock` short is your job:** the server releases nothing on its own clock — unlock as soon as the write is done. The tool-by-tool table: [MIGRATION-19.0](https://github.com/fr0ster/mcp-abap-adt/blob/main/docs/MIGRATION-19.0.md#the-low-set-leaves-the-full-binaries).
24
+
25
+ **Batch mode: `HandlerBatch`.** Every compact binary, `-ro` ones included, on every transport,
26
+ serves batch mode as one tool: `action: 'begin'` switches the server into batch mode, every call
27
+ none of whose requests depends on another's answer is then recorded (it answers nothing and takes
28
+ the next number, from 1), `action: 'end'` sends them all in one ADT batch envelope and leaves batch
29
+ mode whatever happens, and `action: 'answers'` with `number` or `numbers` reads each call's answer
30
+ by its number. A tool that builds a request from an earlier answer is refused; run such work as
31
+ phases, each its own batch — create (`HandlerCreate`), lock (`HandlerLock`),
32
+ write (`HandlerUpdate` with `lock_handle`), unlock (`HandlerUnlock`). A batch holds one kind of
33
+ request — LOCK, UNLOCK or stateless, as its first recorded call decides; a call of another kind is
34
+ refused `batch_other_kind`: record it in the next batch. Every tool's description ends with one sentence saying how it behaves
35
+ in batch mode: recordable, recordable for the arguments it names, or run outside batch mode. Over Streamable HTTP send the
36
+ `state_handle` `action: 'begin'` answers in the `x-mcp-state-handle` header on every call of the
37
+ batch. See
38
+ [Batch Mode](https://github.com/fr0ster/mcp-abap-adt/blob/main/docs/user-guide/BATCH_MODE.md).
39
+
17
40
  ## Why two library packages
18
41
 
19
42
  Capability is decided by what you import, not by a flag a caller can pass. A tool
20
- list assembled from `@mcp-abap-adt/compact-readonly` has **no route to a write
43
+ list assembled from `@mcp-abap-adt/compact-readonly-entries` has **no route to a write
21
44
  handler in its module graph** — asserted against the graph, not against a list of
22
45
  names, in `compact/src/__tests__/compactCapabilitySplit.test.ts`. The read-only
23
46
  half depends on `@mcp-abap-adt/lib/handlers/read`; the modifying half on
@@ -31,35 +54,58 @@ smaller install, and it is not a sandbox — code that deliberately reaches into
31
54
 
32
55
  ```bash
33
56
  npm install -g @mcp-abap-adt/compact
34
- mcp-abap-adt-compact # stdio, all 25 compact tools
35
- mcp-abap-adt-compact --exposition=ro # the 16 that change nothing
36
- mcp-abap-adt-compact --exposition=rw,debug # all 25 and the four debugger verbs
57
+ mcp-abap-adt-compact --system-type=<onprem|cloud> # stdio: all 29, the debugger tools, leftover sessions, background runs
37
58
  mcp-abap-adt-compact --version
59
+
60
+ npm install -g @mcp-abap-adt/compact-ro
61
+ mcp-abap-adt-compact-ro --system-type=<onprem|cloud> # the 17 that change nothing, the leftover-session list and logoff
38
62
  ```
39
63
 
40
- `--exposition` takes **`rw`** (the default — all 25 tools, every access, which is
41
- what a local server gives) or **`ro`** (the 16 tools that change nothing: no create,
42
- update, delete, activate, lock, unlock, unit-test run or profiler run is in the tool
43
- list at all, so a client cannot call one). The object-oriented sets
44
- `readonly`/`high`/`low` belong to `mcp-abap-adt` and are refused here by name.
45
-
46
- **The debugger is opt-in.** `debug` beside `ro` or `rw` (`--exposition=ro,debug`)
47
- adds four verbs: `HandlerDebugStart` (`kind: abap|amdp`, the breakpoints, `take_over`,
48
- an optional background `run`, and for `abap` `request_user`, `debugging_mode` and
49
- `settings`; answers a `state_handle`), `HandlerDebugWait`, `HandlerDebugView` (stack,
50
- variables, memory, an AMDP table) and `HandlerDebugStep` (the steps, `detach` and
51
- `release_debugger`, `terminate`, and `stop`, which ends the session). `debug` alone is
52
- refused: it names no half of the facade, and taking `rw` for it would open the write
53
- tools unasked. In user mode a breakpoint catches every request of the request
54
- user (the connected SAP user unless another is named), which is why the verbs are never
55
- served by default. What a debug session is, what keeps it
64
+ **The binary fixes the tool set.** `mcp-abap-adt-compact` serves all 29 tools (every access, which
65
+ is what a local server gives), the four debugger tools, the debugger batch (`HandlerDebugBatch`),
66
+ the leftover-session list and logoff, the background-run tools and `HandlerBatch` — 40. `mcp-abap-adt-compact-ro` serves the 17 tools that change nothing — the reads, searches,
67
+ where-used, checks and validations, the unit-test status and result reads, the profiler list and
68
+ view, the dump list and view, the service-binding type list — with `HandlerBatch` and the
69
+ leftover-session list and logoff — 20; its tool list is exactly these, so a client calls only them. `--exposition`
70
+ (`ro`, `rw`, `debug`, any word) and a config file's `exposition` stop the start with a sentence
71
+ naming the binary to install instead, e.g. *--exposition is gone (19.0.0): the binary fixes its tool
72
+ set, so remove it; the compact tools that change nothing are served by `mcp-abap-adt-compact-ro`
73
+ (`@mcp-abap-adt/compact-ro`)*.
74
+
75
+ **Leftover sessions, in both.** `HandlerLeftoverSessionList` and
76
+ `HandlerLeftoverSessionLogoff` are served by `mcp-abap-adt-compact` and `mcp-abap-adt-compact-ro`
77
+ alike (a logoff is a system action, not a data change) — the SAP sessions a killed
78
+ server process left open (and the locks in them), listed or logged off by the user, only
79
+ the caller's own; no tool resumes one: a stdio server takes up the one leftover session of its
80
+ destination at its start:
81
+ [Leftover SAP sessions](https://github.com/fr0ster/mcp-abap-adt/blob/main/docs/user-guide/README.md#leftover-sap-sessions-of-a-killed-process). They are stdio's: `-compact-http` and `-compact-sse`
82
+ (and their `-ro`) serve none and write no session file, since one such server holds the sessions of
83
+ many users.
84
+
85
+ **Background runs, in `mcp-abap-adt-compact`.** `HandlerProfileRun` takes `background: true` (no default):
86
+ the call answers at once with a `run_handle`, and the run goes on in an ABAP session of its own
87
+ until SAP answers — it cannot be cut. `HandlerBackgroundRunGet`, `HandlerBackgroundRunList` and
88
+ `HandlerBackgroundRunDiscard` read, list and remove the caller's own runs (16 at most, kept in the
89
+ server's memory until discarded or the process ends):
90
+ [Background runs](https://github.com/fr0ster/mcp-abap-adt/blob/main/docs/user-guide/README.md#background-runs-of-a-class-or-a-program).
91
+
92
+ **The debugger, always in `mcp-abap-adt-compact`, never in `-ro`.** Four tools, each for ABAP
93
+ and AMDP (`kind: abap|amdp`); every call sends one SAP request, the one its `operation` names,
94
+ and the consumer chains the calls: `HandlerDebugBreakpoints` (breakpoints and watchpoints),
95
+ `HandlerDebugSession` (check, listen with the caller's `hold_seconds`, stop the listener, attach,
96
+ detach, terminate, settings; AMDP start, events, stop, delete a debuggee; `end`, which logs off
97
+ the debug state and ends its handle), `HandlerDebugStep`
98
+ (the steps, run or jump to a line, the stack position) and `HandlerDebugMaintain` (stack,
99
+ variables, child variables, memory sizes, a snapshot, set a value; an AMDP data preview). The
100
+ first call that opens the debug state answers its `state_handle`. In user mode a
101
+ breakpoint catches every request of the request user (the connected SAP user unless another
102
+ is named): where that must not be possible, install `mcp-abap-adt-compact-ro`. What a debug session is, what keeps it
56
103
  alive on each transport and what ends it: [Debugger](https://github.com/fr0ster/mcp-abap-adt/blob/main/docs/user-guide/DEBUGGER.md).
57
104
 
58
- Configuration — connection, authentication, transports — is the same as
59
- `mcp-abap-adt`'s, because the launcher is the same one: this command passes its own
60
- tool list to `@mcp-abap-adt/core`'s launcher rather than reimplementing it. The
61
- object-oriented command no longer accepts `--exposition=compact`; it refuses the
62
- value and names this package.
105
+ Configuration — the destination, authentication, the login — is the same as
106
+ `mcp-abap-adt`'s, because the launcher is the same one: this command passes the
107
+ compact tool set (`compactToolSetOf` of `@mcp-abap-adt/lib/tool-set`, with the two
108
+ halves' entry builders) to `@mcp-abap-adt/core`'s `main`, and nothing else.
63
109
 
64
110
  **RFC and SNC** work here exactly as in the full server, and need the same preparation **before** `npm install -g @mcp-abap-adt/compact`: the SAP NW RFC SDK, a C++ toolchain and `SAPNWRFC_HOME` set in the shell — the RFC module is compiled during the install and silently left out when it cannot be. Check with `npm ls -g @mcp-abap-adt/sap-rfc-lite`. Steps: [RFC Setup](https://github.com/fr0ster/mcp-abap-adt/blob/main/docs/installation/RFC_SETUP.md); every variant: [Installation variants](https://github.com/fr0ster/mcp-abap-adt/blob/main/docs/installation/INSTALLATION.md#installation-variants).
65
111
 
@@ -1,19 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * MCP ABAP ADT — the compact command.
4
+ * MCP ABAP ADT — the compact command over stdio.
5
5
  *
6
6
  * Starts the server in THIS process so stdin/stdout stay wired to the MCP protocol
7
- * with no intermediate layer, exactly as `mcp-abap-adt` does. The tool list is the
8
- * compact facade's tools and nothing else: 25 with `rw`, the 16 that change nothing
9
- * with `ro`, and four debug verbs beside either with `debug`.
7
+ * with no intermediate layer, exactly as `mcp-abap-adt` does: core's `main` with the
8
+ * compact tool set: the 27 compact tools, the four debugger tools, the leftover
9
+ * sessions and background runs. The 16 that change nothing alone are
10
+ * `mcp-abap-adt-compact-ro` (@mcp-abap-adt/compact-ro).
10
11
  */
11
12
  const { main } = require('../dist/launcher.js');
13
+ const { launcherFailedLine } = require('@mcp-abap-adt/core/launcher');
12
14
 
13
15
  void main().catch((err) => {
14
- console.error(
15
- '[MCP] compact launcher failed:',
16
- err instanceof Error ? err.message : String(err),
17
- );
16
+ console.error(launcherFailedLine(err));
18
17
  process.exit(1);
19
18
  });
package/dist/index.d.ts CHANGED
@@ -1,15 +1,16 @@
1
1
  /**
2
- * @mcp-abap-adt/compact — the compact ABAP ADT server and its command.
2
+ * @mcp-abap-adt/compact — the compact ABAP ADT server over stdio, and its command.
3
3
  *
4
- * 25 tools instead of 370: one per operation, with the object in `object_type`. For
4
+ * 29 tools instead of 370: one per operation, with the object in `object_type`. For
5
5
  * a host that cannot build a retrieval pipeline of its own and must still drive ABAP
6
6
  * through MCP reliably.
7
7
  *
8
- * The tools themselves are in `@mcp-abap-adt/compact-readonly` (16, changing
9
- * nothing) and `@mcp-abap-adt/compact-modify` (9, writing, locking, activating or
10
- * executing). A consumer that wants only one capability imports that package
11
- * directly; this one is the server that serves both.
8
+ * The tools themselves are in `@mcp-abap-adt/compact-readonly-entries` (17, changing
9
+ * nothing) and `@mcp-abap-adt/compact-modify` (12, writing, locking, activating or
10
+ * executing), composed by `compactToolSetOf` of `@mcp-abap-adt/lib/tool-set`. A
11
+ * consumer that wants only one capability imports that package directly; this one
12
+ * is the stdio server that serves both. Streamable HTTP is
13
+ * `@mcp-abap-adt/compact-http`, SSE `@mcp-abap-adt/compact-sse`.
12
14
  */
13
- export { CompactHandlersGroup } from './group';
14
- export { main } from './launcher';
15
+ export { COMPACT_VERSION, compactToolSet, main } from './launcher';
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,20 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.main = exports.CompactHandlersGroup = void 0;
3
+ exports.main = exports.compactToolSet = exports.COMPACT_VERSION = void 0;
4
4
  /**
5
- * @mcp-abap-adt/compact — the compact ABAP ADT server and its command.
5
+ * @mcp-abap-adt/compact — the compact ABAP ADT server over stdio, and its command.
6
6
  *
7
- * 25 tools instead of 370: one per operation, with the object in `object_type`. For
7
+ * 29 tools instead of 370: one per operation, with the object in `object_type`. For
8
8
  * a host that cannot build a retrieval pipeline of its own and must still drive ABAP
9
9
  * through MCP reliably.
10
10
  *
11
- * The tools themselves are in `@mcp-abap-adt/compact-readonly` (16, changing
12
- * nothing) and `@mcp-abap-adt/compact-modify` (9, writing, locking, activating or
13
- * executing). A consumer that wants only one capability imports that package
14
- * directly; this one is the server that serves both.
11
+ * The tools themselves are in `@mcp-abap-adt/compact-readonly-entries` (17, changing
12
+ * nothing) and `@mcp-abap-adt/compact-modify` (12, writing, locking, activating or
13
+ * executing), composed by `compactToolSetOf` of `@mcp-abap-adt/lib/tool-set`. A
14
+ * consumer that wants only one capability imports that package directly; this one
15
+ * is the stdio server that serves both. Streamable HTTP is
16
+ * `@mcp-abap-adt/compact-http`, SSE `@mcp-abap-adt/compact-sse`.
15
17
  */
16
- var group_1 = require("./group");
17
- Object.defineProperty(exports, "CompactHandlersGroup", { enumerable: true, get: function () { return group_1.CompactHandlersGroup; } });
18
18
  var launcher_1 = require("./launcher");
19
+ Object.defineProperty(exports, "COMPACT_VERSION", { enumerable: true, get: function () { return launcher_1.COMPACT_VERSION; } });
20
+ Object.defineProperty(exports, "compactToolSet", { enumerable: true, get: function () { return launcher_1.compactToolSet; } });
19
21
  Object.defineProperty(exports, "main", { enumerable: true, get: function () { return launcher_1.main; } });
20
22
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;GAWG;AACH,iCAA+C;AAAtC,6GAAA,oBAAoB,OAAA;AAC7B,uCAAkC;AAAzB,gGAAA,IAAI,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACH,uCAAmE;AAA1D,2GAAA,eAAe,OAAA;AAAE,0GAAA,cAAc,OAAA;AAAE,gGAAA,IAAI,OAAA"}
@@ -1,25 +1,13 @@
1
- /** What `--exposition` means here. `rw` is the default: locally, every access. */
2
- export type CompactExposition = 'ro' | 'rw';
1
+ import { type StdioLauncherEdges } from '@mcp-abap-adt/core/launcher';
2
+ import { type ToolSet } from '@mcp-abap-adt/lib/tool-set';
3
+ /** The compact tool set: both halves, the debugger, the leftover sessions and background runs. */
4
+ export declare const compactToolSet: ToolSet;
3
5
  /**
4
- * Which half of the facade: the last of `ro`/`rw` in the list, `rw` when the flag
5
- * is absent. A value outside `ro`, `rw`, `debug` is refused by name rather than
6
- * defaulted, because starting with a different tool list than the one that was
7
- * asked for is the failure this is meant to prevent — and so is `debug` alone: it
8
- * names no half, and taking `rw` for it would open the write tools unasked.
6
+ * THIS package's version, for `--version` and `initialize` — never core's: a
7
+ * version that belongs to a different package reads as the truth (13.0.0
8
+ * shipped that defect in the other direction). `require`, not a file read: a
9
+ * bundler (the portable build) inlines it.
9
10
  */
10
- export declare function parseCompactExposition(argv: readonly string[]): CompactExposition;
11
- /** Whether the four debugger verbs are served: `debug` in the `--exposition` list. */
12
- export declare function parseCompactDebug(argv: readonly string[]): boolean;
13
- /**
14
- * The groups this command hands the core launcher, through `extraGroups` — the
15
- * option every published core launcher takes: its half of the facade, and the
16
- * debugger verbs when `debug` is listed. Each is a real group, never an object
17
- * literal wrapping the entries: the launcher sets the per-request context on the
18
- * group that owns an entry, and only a `BaseHandlerGroup` reads `this.context`
19
- * when the handler runs. A literal closing over the startup context is exactly the
20
- * defect review caught on PR #240 — a server running every call against the
21
- * connection it had before it connected.
22
- */
23
- export declare function compactExtraGroups(argv: readonly string[]): (context: never) => object[];
24
- export declare function main(): Promise<void>;
11
+ export declare const COMPACT_VERSION: string;
12
+ export declare function main(edges?: StdioLauncherEdges): Promise<void>;
25
13
  //# sourceMappingURL=launcher.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AA0BA,kFAAkF;AAClF,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,IAAI,CAAC;AA+D5C;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,iBAAiB,CAkBnB;AAED,sFAAsF;AACtF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAElE;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,CAAC,OAAO,EAAE,KAAK,KAAK,MAAM,EAAE,CAS9B;AAED,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CA+B1C"}
1
+ {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAgBA,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE5E,kGAAkG;AAClG,eAAO,MAAM,cAAc,EAAE,OAG3B,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,MAErB,CAAC;AAEV,wBAAgB,IAAI,CAClB,KAAK,GAAE,kBAAmC,GACzC,OAAO,CAAC,IAAI,CAAC,CASf"}
package/dist/launcher.js CHANGED
@@ -1,165 +1,43 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseCompactExposition = parseCompactExposition;
4
- exports.parseCompactDebug = parseCompactDebug;
5
- exports.compactExtraGroups = compactExtraGroups;
3
+ exports.COMPACT_VERSION = exports.compactToolSet = void 0;
6
4
  exports.main = main;
7
5
  /**
8
- * The compact command: the same server, a different decomposition of its tool list.
6
+ * `mcp-abap-adt-compact` — the compact tool set over stdio.
9
7
  *
10
- * `@mcp-abap-adt/core` owns the launcher — configuration, transports, auth, the
11
- * request context — and this command calls it with the compact groups instead of the
12
- * object-oriented ones. Nothing is copied: `main` takes `extraGroups`, an
13
- * `exposition`, `includeSearch`, the command's `program` name and its own
14
- * `helpExposition` section, which is all a second command needs.
8
+ * The same server as `mcp-abap-adt`, a different decomposition of its tool
9
+ * list: core's `main` with `compactToolSet` — the two halves' entry builders
10
+ * composed by lib's `compactToolSetOf` — and this command's name and version.
11
+ * Nothing else: core's table, core's
12
+ * destination, credentials, cancellation, failures and shutdown.
15
13
  *
16
14
  * **Why a command at all**, rather than a flag on the first one: the host this is
17
15
  * for cannot build a retrieval pipeline and must be handed a tool list short by
18
- * construction. `core` refuses `--exposition=compact` now and says to install this.
19
- *
20
- * **And why this command has an exposition of its own.** The two halves of the
21
- * facade are a real choice for whoever starts the server: `rw` serves all 25 tools,
22
- * `ro` serves the 16 that change nothing — no create, update, delete, activate,
23
- * lock, unlock, unit-test run or profiler run anywhere in the list. Locally the
24
- * default gives every access (`rw`); `ro` is there for a host that means to hand out
25
- * a surface which cannot change the system. The vocabulary is deliberately NOT
26
- * `readonly/high/low`: those are sets of the object-oriented surface, which this
27
- * command does not serve.
28
- */
29
- const compact_readonly_1 = require("@mcp-abap-adt/compact-readonly");
30
- const group_1 = require("./debug/group");
31
- const group_2 = require("./group");
32
- const HELP_EXPOSITION = `
33
- HANDLER EXPOSITION:
34
- --exposition=<set> Which half of the compact facade to serve
35
- Options: ro, rw, debug — a comma list
36
- Default: rw
37
-
38
- - rw: all 25 tools — HandlerGet, HandlerCreate,
39
- HandlerUpdate, HandlerDelete,
40
- HandlerActivate, HandlerLock, ...
41
- - ro: the 16 that change nothing. No create,
42
- update, delete, activate, lock, unlock,
43
- unit-test run or profiler run is in the
44
- list at all, so a client cannot call one.
45
- - debug: beside ro or rw, never alone,
46
- the four debugger verbs
47
- (HandlerDebugStart, ...Wait, ...View,
48
- ...Step). They catch every request
49
- of the connected SAP user.
50
-
51
- The object-oriented sets (readonly, high, low)
52
- belong to \`mcp-abap-adt\`; this command serves the
53
- compact facade only, where the OPERATION is the
54
- tool and the object goes in \`object_type\`.
55
- `;
56
- /**
57
- * The comma list a `--exposition` flag carries, in both spellings; the last flag
58
- * wins. `undefined` when the flag is absent.
59
- *
60
- * **The default belongs to an ABSENT flag, never to an empty value.** The first
61
- * version treated the two alike, so `--exposition="$MODE"` with an unset variable
62
- * opened all 25 tools — writes included — and `--exposition=ro --exposition=`
63
- * overrode a deliberate `ro` the same way (found in review on PR #247). A flag that
64
- * is present but says nothing is a caller who meant something and lost it in a
65
- * shell; the only safe answer is to refuse.
16
+ * construction. A binary fixes its tool set: `mcp-abap-adt-compact-ro` serves
17
+ * the half that changes nothing.
66
18
  */
67
- function expositionValues(argv) {
68
- let seen = false;
69
- let value;
70
- for (let index = 0; index < argv.length; index += 1) {
71
- const arg = argv[index];
72
- if (arg === '--exposition') {
73
- seen = true;
74
- const next = argv[index + 1];
75
- // `--exposition --transport=stdio` gives the flag no value of its own.
76
- value = next !== undefined && !next.startsWith('-') ? next : undefined;
77
- }
78
- else if (arg.startsWith('--exposition=')) {
79
- seen = true;
80
- value = arg.slice('--exposition='.length);
81
- }
82
- }
83
- if (!seen)
84
- return undefined;
85
- const wanted = (value ?? '').trim().toLowerCase();
86
- if (wanted === '') {
87
- throw new Error("--exposition was given no value. This command takes 'ro' (the 16 tools that change nothing) or 'rw' (all 25), and 'debug' beside either. An empty value is refused rather than defaulted: an unset shell variable must not silently open the write tools.");
88
- }
89
- return wanted.split(',').map((v) => v.trim());
90
- }
19
+ const compact_modify_1 = require("@mcp-abap-adt/compact-modify");
20
+ const compact_readonly_entries_1 = require("@mcp-abap-adt/compact-readonly-entries");
21
+ const launcher_1 = require("@mcp-abap-adt/core/launcher");
22
+ const config_1 = require("@mcp-abap-adt/lib/config");
23
+ const tool_set_1 = require("@mcp-abap-adt/lib/tool-set");
24
+ /** The compact tool set: both halves, the debugger, the leftover sessions and background runs. */
25
+ exports.compactToolSet = (0, tool_set_1.compactToolSetOf)({
26
+ readOnly: compact_readonly_entries_1.compactReadOnlyEntries,
27
+ modify: compact_modify_1.compactModifyEntries,
28
+ });
91
29
  /**
92
- * Which half of the facade: the last of `ro`/`rw` in the list, `rw` when the flag
93
- * is absent. A value outside `ro`, `rw`, `debug` is refused by name rather than
94
- * defaulted, because starting with a different tool list than the one that was
95
- * asked for is the failure this is meant to prevent — and so is `debug` alone: it
96
- * names no half, and taking `rw` for it would open the write tools unasked.
30
+ * THIS package's version, for `--version` and `initialize` — never core's: a
31
+ * version that belongs to a different package reads as the truth (13.0.0
32
+ * shipped that defect in the other direction). `require`, not a file read: a
33
+ * bundler (the portable build) inlines it.
97
34
  */
98
- function parseCompactExposition(argv) {
99
- const values = expositionValues(argv);
100
- if (!values)
101
- return 'rw';
102
- let base;
103
- for (const v of values) {
104
- if (v === 'ro' || v === 'rw')
105
- base = v;
106
- else if (v !== 'debug') {
107
- throw new Error(`--exposition=${v} is not a compact set. This command takes 'ro' (the 16 tools that change nothing) or 'rw' (all 25, the default), and 'debug' beside either. The sets readonly/high/low belong to \`mcp-abap-adt\`.`);
108
- }
109
- }
110
- if (!base) {
111
- throw new Error("--exposition=debug alone names no half of the facade: add 'ro' or 'rw' beside it (for example ro,debug).");
112
- }
113
- return base;
114
- }
115
- /** Whether the four debugger verbs are served: `debug` in the `--exposition` list. */
116
- function parseCompactDebug(argv) {
117
- return expositionValues(argv)?.includes('debug') ?? false;
118
- }
119
- /**
120
- * The groups this command hands the core launcher, through `extraGroups` — the
121
- * option every published core launcher takes: its half of the facade, and the
122
- * debugger verbs when `debug` is listed. Each is a real group, never an object
123
- * literal wrapping the entries: the launcher sets the per-request context on the
124
- * group that owns an entry, and only a `BaseHandlerGroup` reads `this.context`
125
- * when the handler runs. A literal closing over the startup context is exactly the
126
- * defect review caught on PR #240 — a server running every call against the
127
- * connection it had before it connected.
128
- */
129
- function compactExtraGroups(argv) {
130
- const exposition = parseCompactExposition(argv);
131
- const debug = parseCompactDebug(argv);
132
- return (context) => [
133
- exposition === 'ro'
134
- ? new compact_readonly_1.CompactReadOnlyHandlersGroup(context)
135
- : new group_2.CompactHandlersGroup(context),
136
- ...(debug ? [new group_1.CompactDebugHandlersGroup(context)] : []),
137
- ];
138
- }
139
- async function main() {
140
- // `--version` answers THIS package's version, not core's. The launcher core owns
141
- // would print its own manifest, which is the defect 13.0.0 shipped in the other
142
- // direction: a version that belongs to a different package reads as the truth.
143
- const manifest = require('../package.json');
144
- if (process.argv.includes('--version') || process.argv.includes('-v')) {
145
- console.log(manifest.version);
146
- return;
147
- }
148
- const extraGroups = compactExtraGroups(process.argv.slice(2));
149
- const { main: launch } = require('@mcp-abap-adt/core/launcher');
150
- await launch({
35
+ exports.COMPACT_VERSION = require('../package.json').version;
36
+ function main(edges = (0, config_1.processEdges)()) {
37
+ return (0, launcher_1.main)({
38
+ toolSet: exports.compactToolSet,
151
39
  program: 'mcp-abap-adt-compact',
152
- version: manifest.version,
153
- helpExposition: HELP_EXPOSITION,
154
- exposition: [],
155
- includeSearch: false,
156
- extraGroups,
157
- });
158
- }
159
- if (require.main === module) {
160
- void main().catch((error) => {
161
- console.error('[MCP] compact launcher failed:', error instanceof Error ? error.message : String(error));
162
- process.exit(1);
163
- });
40
+ version: exports.COMPACT_VERSION,
41
+ }, edges);
164
42
  }
165
43
  //# sourceMappingURL=launcher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"launcher.js","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":";;AAiGA,wDAoBC;AAGD,8CAEC;AAYD,gDAWC;AAED,oBA+BC;AAlLD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qEAA8E;AAC9E,yCAA0D;AAC1D,mCAA+C;AAK/C,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBvB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,SAAS,gBAAgB,CAAC,IAAuB;IAC/C,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,IAAI,KAAyB,CAAC;IAC9B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACpD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,IAAI,GAAG,KAAK,cAAc,EAAE,CAAC;YAC3B,IAAI,GAAG,IAAI,CAAC;YACZ,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAC7B,uEAAuE;YACvE,KAAK,GAAG,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QACzE,CAAC;aAAM,IAAI,GAAG,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;YAC3C,IAAI,GAAG,IAAI,CAAC;YACZ,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IACD,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,MAAM,MAAM,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAA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