@rubytech/create-realagent-code 0.1.566 → 0.1.567
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/package.json +1 -1
- package/payload/platform/neo4j/schema.cypher +9 -0
- package/payload/platform/package-lock.json +66 -1
- package/payload/platform/plugins/.claude-plugin/marketplace.json +5 -0
- package/payload/platform/plugins/admin/hooks/lib/maxy-mcp-plugins.txt +1 -0
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +48 -1
- package/payload/platform/plugins/admin/skills/public-agent-manager/SKILL.md +5 -1
- package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +6 -0
- package/payload/platform/plugins/docs/references/channel-wake-and-prompt.md +47 -0
- package/payload/platform/plugins/inventory/.claude-plugin/plugin.json +21 -0
- package/payload/platform/plugins/inventory/PLUGIN.md +75 -0
- package/payload/platform/plugins/inventory/lib/mcp-spawn-tee/index.js +204 -0
- package/payload/platform/plugins/inventory/lib/mcp-spawn-tee/package.json +3 -0
- package/payload/platform/plugins/inventory/mcp/dist/index.d.ts +2 -0
- package/payload/platform/plugins/inventory/mcp/dist/index.d.ts.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/index.js +241 -0
- package/payload/platform/plugins/inventory/mcp/dist/index.js.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/forecast.d.ts +20 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/forecast.d.ts.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/forecast.js +29 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/forecast.js.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/neo4j.d.ts +5 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/neo4j.d.ts.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/neo4j.js +40 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/neo4j.js.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/read.d.ts +28 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/read.d.ts.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/read.js +91 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/read.js.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/replenish.d.ts +56 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/replenish.d.ts.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/replenish.js +107 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/replenish.js.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/types.d.ts +98 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/types.d.ts.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/types.js +7 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/types.js.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/write-rejects.d.ts +12 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/write-rejects.d.ts.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/write-rejects.js +49 -0
- package/payload/platform/plugins/inventory/mcp/dist/lib/write-rejects.js.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/demand-record.d.ts +20 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/demand-record.d.ts.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/demand-record.js +53 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/demand-record.js.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/forecast.d.ts +23 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/forecast.d.ts.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/forecast.js +18 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/forecast.js.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/policy-set.d.ts +25 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/policy-set.d.ts.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/policy-set.js +37 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/policy-set.js.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/purchase-order-record.d.ts +25 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/purchase-order-record.d.ts.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/purchase-order-record.js +43 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/purchase-order-record.js.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/replenish-plan.d.ts +29 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/replenish-plan.d.ts.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/replenish-plan.js +95 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/replenish-plan.js.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/stock-record.d.ts +21 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/stock-record.d.ts.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/stock-record.js +46 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/stock-record.js.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/supplier-terms-set.d.ts +24 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/supplier-terms-set.d.ts.map +1 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/supplier-terms-set.js +29 -0
- package/payload/platform/plugins/inventory/mcp/dist/tools/supplier-terms-set.js.map +1 -0
- package/payload/platform/plugins/inventory/mcp/package.json +21 -0
- package/payload/platform/plugins/memory/references/schema-retail.md +20 -0
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js +8 -0
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.js +66 -5
- package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/public-spawn-model.d.ts +28 -0
- package/payload/platform/services/claude-session-manager/dist/public-spawn-model.d.ts.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/public-spawn-model.js +58 -0
- package/payload/platform/services/claude-session-manager/dist/public-spawn-model.js.map +1 -0
- package/payload/platform/services/telegram-channel/dist/server.d.ts +5 -0
- package/payload/platform/services/telegram-channel/dist/server.d.ts.map +1 -1
- package/payload/platform/services/telegram-channel/dist/server.js +22 -2
- package/payload/platform/services/telegram-channel/dist/server.js.map +1 -1
- package/payload/platform/services/telegram-channel/dist/turn-follow.d.ts +34 -2
- package/payload/platform/services/telegram-channel/dist/turn-follow.d.ts.map +1 -1
- package/payload/platform/services/telegram-channel/dist/turn-follow.js +150 -14
- package/payload/platform/services/telegram-channel/dist/turn-follow.js.map +1 -1
- package/payload/platform/services/webchat-channel/dist/server.d.ts +5 -0
- package/payload/platform/services/webchat-channel/dist/server.d.ts.map +1 -1
- package/payload/platform/services/webchat-channel/dist/server.js +22 -2
- package/payload/platform/services/webchat-channel/dist/server.js.map +1 -1
- package/payload/platform/services/webchat-channel/dist/turn-follow.d.ts +34 -2
- package/payload/platform/services/webchat-channel/dist/turn-follow.d.ts.map +1 -1
- package/payload/platform/services/webchat-channel/dist/turn-follow.js +150 -14
- package/payload/platform/services/webchat-channel/dist/turn-follow.js.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/server.d.ts +10 -2
- package/payload/platform/services/whatsapp-channel/dist/server.d.ts.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/server.js +45 -6
- package/payload/platform/services/whatsapp-channel/dist/server.js.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/turn-follow.d.ts +34 -2
- package/payload/platform/services/whatsapp-channel/dist/turn-follow.d.ts.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/turn-follow.js +153 -15
- package/payload/platform/services/whatsapp-channel/dist/turn-follow.js.map +1 -1
package/package.json
CHANGED
|
@@ -2381,3 +2381,12 @@ FOR (n:StockMovement) ON (n.accountId);
|
|
|
2381
2381
|
|
|
2382
2382
|
CREATE INDEX store_location_account IF NOT EXISTS
|
|
2383
2383
|
FOR (n:StoreLocation) ON (n.accountId);
|
|
2384
|
+
|
|
2385
|
+
CREATE INDEX stock_position_account IF NOT EXISTS
|
|
2386
|
+
FOR (n:StockPosition) ON (n.accountId);
|
|
2387
|
+
|
|
2388
|
+
CREATE INDEX demand_observation_account IF NOT EXISTS
|
|
2389
|
+
FOR (n:DemandObservation) ON (n.accountId);
|
|
2390
|
+
|
|
2391
|
+
CREATE INDEX replenishment_policy_account IF NOT EXISTS
|
|
2392
|
+
FOR (n:ReplenishmentPolicy) ON (n.accountId);
|
|
@@ -9,7 +9,11 @@
|
|
|
9
9
|
"workspaces": [
|
|
10
10
|
"plugins/*/mcp",
|
|
11
11
|
"services/*"
|
|
12
|
-
]
|
|
12
|
+
],
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"neo4j-driver": "^5.28.1",
|
|
15
|
+
"pdf-lib": "^1.17.1"
|
|
16
|
+
}
|
|
13
17
|
},
|
|
14
18
|
"node_modules/@babel/runtime": {
|
|
15
19
|
"version": "7.29.2",
|
|
@@ -585,6 +589,10 @@
|
|
|
585
589
|
"resolved": "plugins/graph-viewer/mcp",
|
|
586
590
|
"link": true
|
|
587
591
|
},
|
|
592
|
+
"node_modules/@maxy/inventory": {
|
|
593
|
+
"resolved": "plugins/inventory/mcp",
|
|
594
|
+
"link": true
|
|
595
|
+
},
|
|
588
596
|
"node_modules/@maxy/joblogic": {
|
|
589
597
|
"resolved": "plugins/joblogic/mcp",
|
|
590
598
|
"link": true
|
|
@@ -998,6 +1006,24 @@
|
|
|
998
1006
|
"url": "https://github.com/sponsors/Boshen"
|
|
999
1007
|
}
|
|
1000
1008
|
},
|
|
1009
|
+
"node_modules/@pdf-lib/standard-fonts": {
|
|
1010
|
+
"version": "1.0.0",
|
|
1011
|
+
"resolved": "https://registry.npmjs.org/@pdf-lib/standard-fonts/-/standard-fonts-1.0.0.tgz",
|
|
1012
|
+
"integrity": "sha512-hU30BK9IUN/su0Mn9VdlVKsWBS6GyhVfqjwl1FjZN4TxP6cCw0jP2w7V3Hf5uX7M0AZJ16vey9yE0ny7Sa59ZA==",
|
|
1013
|
+
"license": "MIT",
|
|
1014
|
+
"dependencies": {
|
|
1015
|
+
"pako": "^1.0.6"
|
|
1016
|
+
}
|
|
1017
|
+
},
|
|
1018
|
+
"node_modules/@pdf-lib/upng": {
|
|
1019
|
+
"version": "1.0.1",
|
|
1020
|
+
"resolved": "https://registry.npmjs.org/@pdf-lib/upng/-/upng-1.0.1.tgz",
|
|
1021
|
+
"integrity": "sha512-dQK2FUMQtowVP00mtIksrlZhdFXQZPC+taih1q4CvPZ5vqdxR/LKBaFg0oAfzd1GlHZXXSPdQfzQnt+ViGvEIQ==",
|
|
1022
|
+
"license": "MIT",
|
|
1023
|
+
"dependencies": {
|
|
1024
|
+
"pako": "^1.0.10"
|
|
1025
|
+
}
|
|
1026
|
+
},
|
|
1001
1027
|
"node_modules/@pinojs/redact": {
|
|
1002
1028
|
"version": "0.4.0",
|
|
1003
1029
|
"resolved": "https://registry.npmjs.org/@pinojs/redact/-/redact-0.4.0.tgz",
|
|
@@ -3790,6 +3816,12 @@
|
|
|
3790
3816
|
"node": ">=6"
|
|
3791
3817
|
}
|
|
3792
3818
|
},
|
|
3819
|
+
"node_modules/pako": {
|
|
3820
|
+
"version": "1.0.11",
|
|
3821
|
+
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
|
|
3822
|
+
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==",
|
|
3823
|
+
"license": "(MIT AND Zlib)"
|
|
3824
|
+
},
|
|
3793
3825
|
"node_modules/parseley": {
|
|
3794
3826
|
"version": "0.13.1",
|
|
3795
3827
|
"resolved": "https://registry.npmjs.org/parseley/-/parseley-0.13.1.tgz",
|
|
@@ -3857,6 +3889,24 @@
|
|
|
3857
3889
|
"node": ">= 14.16"
|
|
3858
3890
|
}
|
|
3859
3891
|
},
|
|
3892
|
+
"node_modules/pdf-lib": {
|
|
3893
|
+
"version": "1.17.1",
|
|
3894
|
+
"resolved": "https://registry.npmjs.org/pdf-lib/-/pdf-lib-1.17.1.tgz",
|
|
3895
|
+
"integrity": "sha512-V/mpyJAoTsN4cnP31vc0wfNA1+p20evqqnap0KLoRUN0Yk/p3wN52DOEsL4oBFcLdb76hlpKPtzJIgo67j/XLw==",
|
|
3896
|
+
"license": "MIT",
|
|
3897
|
+
"dependencies": {
|
|
3898
|
+
"@pdf-lib/standard-fonts": "^1.0.0",
|
|
3899
|
+
"@pdf-lib/upng": "^1.0.1",
|
|
3900
|
+
"pako": "^1.0.11",
|
|
3901
|
+
"tslib": "^1.11.1"
|
|
3902
|
+
}
|
|
3903
|
+
},
|
|
3904
|
+
"node_modules/pdf-lib/node_modules/tslib": {
|
|
3905
|
+
"version": "1.14.1",
|
|
3906
|
+
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
|
|
3907
|
+
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
|
|
3908
|
+
"license": "0BSD"
|
|
3909
|
+
},
|
|
3860
3910
|
"node_modules/peberminta": {
|
|
3861
3911
|
"version": "0.10.0",
|
|
3862
3912
|
"resolved": "https://registry.npmjs.org/peberminta/-/peberminta-0.10.0.tgz",
|
|
@@ -6644,6 +6694,19 @@
|
|
|
6644
6694
|
"vitest": "^4.1.2"
|
|
6645
6695
|
}
|
|
6646
6696
|
},
|
|
6697
|
+
"plugins/inventory/mcp": {
|
|
6698
|
+
"name": "@maxy/inventory",
|
|
6699
|
+
"version": "0.1.0",
|
|
6700
|
+
"dependencies": {
|
|
6701
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
6702
|
+
"neo4j-driver": "^5.28.1"
|
|
6703
|
+
},
|
|
6704
|
+
"devDependencies": {
|
|
6705
|
+
"@types/node": "^22.0.0",
|
|
6706
|
+
"typescript": "^5.7.0",
|
|
6707
|
+
"vitest": "^4.1.2"
|
|
6708
|
+
}
|
|
6709
|
+
},
|
|
6647
6710
|
"plugins/joblogic/mcp": {
|
|
6648
6711
|
"name": "@maxy/joblogic",
|
|
6649
6712
|
"version": "0.1.0",
|
|
@@ -6688,6 +6751,7 @@
|
|
|
6688
6751
|
"dependencies": {
|
|
6689
6752
|
"@microsoft/microsoft-graph-client": "^3.0.7",
|
|
6690
6753
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
6754
|
+
"neo4j-driver": "^5.28.1",
|
|
6691
6755
|
"zod": "^3.24.0"
|
|
6692
6756
|
},
|
|
6693
6757
|
"devDependencies": {
|
|
@@ -6727,6 +6791,7 @@
|
|
|
6727
6791
|
"dependencies": {
|
|
6728
6792
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
6729
6793
|
"cron-parser": "^4.9.0",
|
|
6794
|
+
"imapflow": "^1.0.171",
|
|
6730
6795
|
"neo4j-driver": "^5.28.1",
|
|
6731
6796
|
"zod": "^3.24.0"
|
|
6732
6797
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: platform-architecture
|
|
3
3
|
description: Use when grounding any documented-surface claim about what Real Agent ships — plugins, skills, specialists, install/deploy flows, internals. This is the install catalogue, not evidence of what is enabled on the current account. For install state on this account, call `capabilities-here`; for documented surface, cite the `Source:` URL inline.
|
|
4
|
-
content-hash: sha256:
|
|
4
|
+
content-hash: sha256:b33ba78e174c3db35512c9544ba867083b4999a473806a6a9f2d329ba0fa3764
|
|
5
5
|
brand: realagent-code
|
|
6
6
|
product-name: Real Agent
|
|
7
7
|
---
|
|
@@ -1773,6 +1773,53 @@ The first-run dialog is answered for the session, and the watcher that guards ag
|
|
|
1773
1773
|
|
|
1774
1774
|
Two standing audits reconcile that chain rather than waiting for someone to notice. `op=public-notify-reconcile` reports `routed` against `answered`, so a visitor routed to an agent that never replied shows as `answerGap`. `op=spawn-census` reports attempts against successes. A non-zero gap, or attempts with no successes, is a fault even when nothing has been reported.
|
|
1775
1775
|
|
|
1776
|
+
## Delivery parity, and where its lines actually land
|
|
1777
|
+
|
|
1778
|
+
**The contract.** For any channel session, the set of answers delivered to the
|
|
1779
|
+
chat equals the transcript's assistant `text` blocks **for turns that answered a
|
|
1780
|
+
channel inbound**. An answer readable in the reader and absent from the chat is a
|
|
1781
|
+
defect. Turns that answered no inbound — subagent side-chains, turns driven from
|
|
1782
|
+
claude.ai — are deliberately outside that set: the credit guards are what keep
|
|
1783
|
+
them out of a customer's chat.
|
|
1784
|
+
|
|
1785
|
+
Each door's `src/parity.test.ts` asserts the contract end to end against a real
|
|
1786
|
+
JSONL and the real follower.
|
|
1787
|
+
|
|
1788
|
+
**Six discard sites, each now logged.** A follower outcome is dropped at:
|
|
1789
|
+
|
|
1790
|
+
| File | Guard | `reason=` |
|
|
1791
|
+
|---|---|---|
|
|
1792
|
+
| `telegram-channel/src/server.ts:241` | `pendingTurns <= 0` | `no-credit` |
|
|
1793
|
+
| `webchat-channel/src/server.ts:378` | `pendingTurns <= 0` | `no-credit` |
|
|
1794
|
+
| `whatsapp-channel/src/server.ts:481` | `pendingTurns <= 0` | `no-credit` |
|
|
1795
|
+
| `whatsapp-channel/src/server.ts:489` | `consumedInbounds <= 0` | `no-consumed-inbound` |
|
|
1796
|
+
| `whatsapp-channel/src/server.ts:617` | `pendingTurns <= 0` (2nd follower) | `no-credit` |
|
|
1797
|
+
| `whatsapp-channel/src/server.ts:620` | `consumedInbounds <= 0` (2nd follower) | `no-consumed-inbound` |
|
|
1798
|
+
|
|
1799
|
+
```
|
|
1800
|
+
[<door>-channel] op=turn-drop sessionId=… messageId=… finalBytes=… reason=…
|
|
1801
|
+
[<door>-turn-census] op=census sessionId=… pending=… held=<0|1> heldMessageId=… heldAgeMs=… lastMessageId=…
|
|
1802
|
+
```
|
|
1803
|
+
|
|
1804
|
+
Any `op=turn-drop` with `finalBytes>0` is a lost answer. The census runs every
|
|
1805
|
+
60 s per follower; `held=1` with `heldAgeMs` rising across ticks is a hold that
|
|
1806
|
+
never resolved, and `pending` not returning to 0 with no inbound in flight is
|
|
1807
|
+
credit drift.
|
|
1808
|
+
|
|
1809
|
+
**Read them in the right file.** Both lines are emitted by the *channel MCP
|
|
1810
|
+
server*, whose stderr is teed to `${LOG_DIR}/mcp-<serverName>-<sessionId>.log`
|
|
1811
|
+
(`claude-session-manager/src/channel-spawn-tee.ts`). They are **never** in
|
|
1812
|
+
`server.log`, which carries the gateway-side half only — `op=turn-end`,
|
|
1813
|
+
`op=turn-answer-absent`, `delivered=`. Grepping `server.log` for a drop returns
|
|
1814
|
+
nothing and means nothing.
|
|
1815
|
+
|
|
1816
|
+
```bash
|
|
1817
|
+
# the discard and the hold, per session
|
|
1818
|
+
grep -E 'op=(turn-drop|census)' ~/.<brand>/logs/mcp-telegram-channel-*.log | tail -20
|
|
1819
|
+
# the gateway's view of the same turn
|
|
1820
|
+
grep -E 'op=(turn-end|turn-answer-absent)' ~/.<brand>/logs/server.log | grep <sessionId>
|
|
1821
|
+
```
|
|
1822
|
+
|
|
1776
1823
|
---
|
|
1777
1824
|
# Settings
|
|
1778
1825
|
Source: https://docs.getmaxy.com/settings.md
|
|
@@ -47,6 +47,10 @@ Each agent lives at `{accountDir}/agents/{slug}/`:
|
|
|
47
47
|
}
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
### model
|
|
51
|
+
|
|
52
|
+
`model` is live. A public spawn reads it from this file and passes it to the agent's process as `--model`; changing it here changes the next spawn's model with no code change and no restart. An id outside the three listed below is ignored, and the spawn falls back to the account's `publicModel`.
|
|
53
|
+
|
|
50
54
|
### Toolless by construction
|
|
51
55
|
|
|
52
56
|
The public agent has no tools. It cannot search the graph, read files, run commands, or load skills mid-conversation. Everything it knows is the KNOWLEDGE.md and SOUL assembled into its system prompt at spawn time. There is no operator toggle for this — it is the fixed posture for every public agent on every channel. If the agent needs to surface graph content created after deployment, refresh its KNOWLEDGE.md (see Update knowledge below); the agent itself never reaches the live graph.
|
|
@@ -83,7 +87,7 @@ Tagging routes a node to the suggestion surface; it does not publish it. A tagge
|
|
|
83
87
|
|
|
84
88
|
### Model Options
|
|
85
89
|
|
|
86
|
-
Present as a `select` field within the agent configuration `form` during creation:
|
|
90
|
+
Present as a `select` field within the agent configuration `form` during creation. The chosen id is written to `config.json` `model` and is what the agent's spawns actually run on:
|
|
87
91
|
|
|
88
92
|
| Model | ID | Suitability | Cost |
|
|
89
93
|
|-------|-----|------------|------|
|
|
@@ -9,6 +9,12 @@ Invoked by the admin agent directly.
|
|
|
9
9
|
|
|
10
10
|
This is the platform's release timeline, newest first. Each entry shows the date it shipped and the version it shipped in, so you can tell the operator how current their install is. To compare, read the installed version from `capabilities-here` and match it against the versions below. Keep answers high level and in plain English; this is a summary, not a full commit log.
|
|
11
11
|
|
|
12
|
+
## 2026-08-05 (0.1.567)
|
|
13
|
+
|
|
14
|
+
- An answer you can see in the reader is now delivered to the channel it belongs to. A turn that ended on a thinking block was closing before its answer row arrived, and that answer was dropped. Every channel now holds a close that carries no message, merges a split answer back into one message, and records a line at each of the six points where a turn used to be discarded silently.
|
|
15
|
+
- A public agent now runs on the model it is configured with. Public conversations were ignoring the agent's own setting and inheriting the admin model instead.
|
|
16
|
+
- Retail installs can plan, not just record. A new inventory area adds stock positions, demand history, supplier terms and replenishment policy, and answers what to order and when, rather than only recording what has already been sold.
|
|
17
|
+
|
|
12
18
|
## 2026-08-05 (0.1.566)
|
|
13
19
|
|
|
14
20
|
- Installing or upgrading Real Agent on a machine that also runs another Real Agent-family product no longer fails because a browser is in the way. Real Agent's browser-automation port was the one every browser tool picks by default when nothing tells it otherwise, so an assistant on the other product could take it and the install would stop rather than write over a port in use. Real Agent now uses a port outside that range.
|
|
@@ -86,3 +86,50 @@ op=startup-watch state=disposed
|
|
|
86
86
|
The first-run dialog is answered for the session, and the watcher that guards against an *unanswered* one drops what it saw before that answer. `bufferCleared=false` means the confirm fired and the drop did not, which is the shape that killed a resumed spawn on 2026-08-01: the answered dialog's own footer stayed in the buffer, the replayed transcript slid past it, and the spawn was blocked by a line the agent itself had written the day before.
|
|
87
87
|
|
|
88
88
|
Two standing audits reconcile that chain rather than waiting for someone to notice. `op=public-notify-reconcile` reports `routed` against `answered`, so a visitor routed to an agent that never replied shows as `answerGap`. `op=spawn-census` reports attempts against successes. A non-zero gap, or attempts with no successes, is a fault even when nothing has been reported.
|
|
89
|
+
|
|
90
|
+
## Delivery parity, and where its lines actually land
|
|
91
|
+
|
|
92
|
+
**The contract.** For any channel session, the set of answers delivered to the
|
|
93
|
+
chat equals the transcript's assistant `text` blocks **for turns that answered a
|
|
94
|
+
channel inbound**. An answer readable in the reader and absent from the chat is a
|
|
95
|
+
defect. Turns that answered no inbound — subagent side-chains, turns driven from
|
|
96
|
+
claude.ai — are deliberately outside that set: the credit guards are what keep
|
|
97
|
+
them out of a customer's chat.
|
|
98
|
+
|
|
99
|
+
Each door's `src/parity.test.ts` asserts the contract end to end against a real
|
|
100
|
+
JSONL and the real follower.
|
|
101
|
+
|
|
102
|
+
**Six discard sites, each now logged.** A follower outcome is dropped at:
|
|
103
|
+
|
|
104
|
+
| File | Guard | `reason=` |
|
|
105
|
+
|---|---|---|
|
|
106
|
+
| `telegram-channel/src/server.ts:241` | `pendingTurns <= 0` | `no-credit` |
|
|
107
|
+
| `webchat-channel/src/server.ts:378` | `pendingTurns <= 0` | `no-credit` |
|
|
108
|
+
| `whatsapp-channel/src/server.ts:481` | `pendingTurns <= 0` | `no-credit` |
|
|
109
|
+
| `whatsapp-channel/src/server.ts:489` | `consumedInbounds <= 0` | `no-consumed-inbound` |
|
|
110
|
+
| `whatsapp-channel/src/server.ts:617` | `pendingTurns <= 0` (2nd follower) | `no-credit` |
|
|
111
|
+
| `whatsapp-channel/src/server.ts:620` | `consumedInbounds <= 0` (2nd follower) | `no-consumed-inbound` |
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
[<door>-channel] op=turn-drop sessionId=… messageId=… finalBytes=… reason=…
|
|
115
|
+
[<door>-turn-census] op=census sessionId=… pending=… held=<0|1> heldMessageId=… heldAgeMs=… lastMessageId=…
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Any `op=turn-drop` with `finalBytes>0` is a lost answer. The census runs every
|
|
119
|
+
60 s per follower; `held=1` with `heldAgeMs` rising across ticks is a hold that
|
|
120
|
+
never resolved, and `pending` not returning to 0 with no inbound in flight is
|
|
121
|
+
credit drift.
|
|
122
|
+
|
|
123
|
+
**Read them in the right file.** Both lines are emitted by the *channel MCP
|
|
124
|
+
server*, whose stderr is teed to `${LOG_DIR}/mcp-<serverName>-<sessionId>.log`
|
|
125
|
+
(`claude-session-manager/src/channel-spawn-tee.ts`). They are **never** in
|
|
126
|
+
`server.log`, which carries the gateway-side half only — `op=turn-end`,
|
|
127
|
+
`op=turn-answer-absent`, `delivered=`. Grepping `server.log` for a drop returns
|
|
128
|
+
nothing and means nothing.
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# the discard and the hold, per session
|
|
132
|
+
grep -E 'op=(turn-drop|census)' ~/.<brand>/logs/mcp-telegram-channel-*.log | tail -20
|
|
133
|
+
# the gateway's view of the same turn
|
|
134
|
+
grep -E 'op=(turn-end|turn-answer-absent)' ~/.<brand>/logs/server.log | grep <sessionId>
|
|
135
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "inventory",
|
|
3
|
+
"description": "Retail replenishment planning. Records measured stock and observed demand at a product-plus-location grain, holds supplier lead times and service-level policy, and computes what to reorder rather than storing it. Provides inventory-stock-record, inventory-demand-record, inventory-policy-set, inventory-supplier-terms-set, inventory-forecast, inventory-replenish-plan, inventory-purchase-order-record.",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Rubytech LLC"
|
|
7
|
+
},
|
|
8
|
+
"mcpServers": {
|
|
9
|
+
"inventory": {
|
|
10
|
+
"type": "stdio",
|
|
11
|
+
"command": "node",
|
|
12
|
+
"args": [
|
|
13
|
+
"${CLAUDE_PLUGIN_ROOT}/lib/mcp-spawn-tee/index.js",
|
|
14
|
+
"${CLAUDE_PLUGIN_ROOT}/mcp/dist/index.js"
|
|
15
|
+
],
|
|
16
|
+
"env": {
|
|
17
|
+
"MCP_SPAWN_TEE_NAME": "inventory"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: inventory
|
|
3
|
+
description: "Retail replenishment planning. Records measured stock and observed demand at a product-plus-location grain, holds supplier lead times and service-level policy, and computes what to reorder rather than storing it. Provides inventory-stock-record, inventory-demand-record, inventory-policy-set, inventory-supplier-terms-set, inventory-forecast, inventory-replenish-plan, inventory-purchase-order-record."
|
|
4
|
+
tools:
|
|
5
|
+
- name: inventory-stock-record
|
|
6
|
+
publicAllowlist: false
|
|
7
|
+
adminAllowlist: true
|
|
8
|
+
riskClass: write_local
|
|
9
|
+
- name: inventory-demand-record
|
|
10
|
+
publicAllowlist: false
|
|
11
|
+
adminAllowlist: true
|
|
12
|
+
riskClass: write_local
|
|
13
|
+
- name: inventory-policy-set
|
|
14
|
+
publicAllowlist: false
|
|
15
|
+
adminAllowlist: true
|
|
16
|
+
riskClass: write_local
|
|
17
|
+
- name: inventory-supplier-terms-set
|
|
18
|
+
publicAllowlist: false
|
|
19
|
+
adminAllowlist: true
|
|
20
|
+
riskClass: write_local
|
|
21
|
+
- name: inventory-forecast
|
|
22
|
+
publicAllowlist: false
|
|
23
|
+
adminAllowlist: true
|
|
24
|
+
riskClass: read
|
|
25
|
+
- name: inventory-replenish-plan
|
|
26
|
+
publicAllowlist: false
|
|
27
|
+
adminAllowlist: true
|
|
28
|
+
riskClass: read
|
|
29
|
+
- name: inventory-purchase-order-record
|
|
30
|
+
publicAllowlist: false
|
|
31
|
+
adminAllowlist: true
|
|
32
|
+
riskClass: write_local
|
|
33
|
+
always: false
|
|
34
|
+
embed: false
|
|
35
|
+
metadata: {"platform":{}}
|
|
36
|
+
mcp:
|
|
37
|
+
command: node
|
|
38
|
+
args:
|
|
39
|
+
- ${PLATFORM_ROOT}/lib/mcp-spawn-tee/dist/index.js
|
|
40
|
+
- ${PLATFORM_ROOT}/plugins/inventory/mcp/dist/index.js
|
|
41
|
+
env:
|
|
42
|
+
MCP_SPAWN_TEE_NAME: inventory
|
|
43
|
+
LOG_DIR: ${LOG_DIR}
|
|
44
|
+
PLATFORM_ROOT: ${PLATFORM_ROOT}
|
|
45
|
+
ACCOUNT_ID: ${ACCOUNT_ID}
|
|
46
|
+
SESSION_ID: ${SESSION_ID}
|
|
47
|
+
AGENT_SLUG: ${AGENT_SLUG}
|
|
48
|
+
mcp-manifest: auto
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
# Inventory
|
|
52
|
+
|
|
53
|
+
Replenishment planning for a retail account. Admin agent only.
|
|
54
|
+
|
|
55
|
+
Load `platform/plugins/memory/references/schema-retail.md` before writing: this plugin's nodes are declared there.
|
|
56
|
+
|
|
57
|
+
## Nothing it recommends is stored
|
|
58
|
+
|
|
59
|
+
The forecast and the reorder point are computed from recorded facts on every call. There is no `Forecast` node and no stored plan.
|
|
60
|
+
|
|
61
|
+
A stored recommendation drifts the moment stock moves by a path that forgets to update it, and nothing fails when it does: the plan simply reports a number that no longer reconciles against the positions it was computed from. A computed figure cannot disagree with the data it is computed from.
|
|
62
|
+
|
|
63
|
+
## The planning grain is a product at a location
|
|
64
|
+
|
|
65
|
+
Stock lives on `:StockPosition`, keyed on product plus location, not on `Product.stockLevel`. A retailer with a shop and a warehouse can say how much sits where; a single-site seller simply has one location.
|
|
66
|
+
|
|
67
|
+
No tool here reads `Product.stockLevel`.
|
|
68
|
+
|
|
69
|
+
## Nothing is defaulted
|
|
70
|
+
|
|
71
|
+
A line that cannot be computed, because the supplier has no lead time, the product has no policy, or there is no demand history, comes back named as skipped with the missing input. It is never computed from a substituted value: a default service level or a guessed lead time produces a confident, wrong order quantity, which is worse than no answer.
|
|
72
|
+
|
|
73
|
+
## Data age is returned, not assumed
|
|
74
|
+
|
|
75
|
+
Stock arrives by upload, so it is stale by construction. `inventory-replenish-plan` returns the oldest and newest `asOf` it actually read. Report that age to the operator as a fact from the tool rather than assuming the data is current.
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* MCP spawn-tee — in-process stderr capture + lifecycle observability.
|
|
5
|
+
*
|
|
6
|
+
* Claude Code spawns each MCP server itself; the platform never holds a
|
|
7
|
+
* ChildProcess handle. This shim sits between Claude Code and the real MCP
|
|
8
|
+
* server: Claude Code runs `node <this> <real-entry>`, and the shim runs the
|
|
9
|
+
* real entry IN ITS OWN PROCESS via dynamic import() — one node runtime, not
|
|
10
|
+
* two. Before importing, it replaces process.stderr.write with a tee so every
|
|
11
|
+
* stderr byte the server writes is mirrored to the log sinks; stdin and stdout
|
|
12
|
+
* (the JSON-RPC channel) are never touched.
|
|
13
|
+
*
|
|
14
|
+
* Claude Code CLI → shim (this file) = node running <real-entry> in-process
|
|
15
|
+
* stdin/stdout : untouched (JSON-RPC channel)
|
|
16
|
+
* stderr : process.stderr.write teed → raw sink + passthrough
|
|
17
|
+
*
|
|
18
|
+
* Destinations:
|
|
19
|
+
* - `${LOG_DIR}/mcp-<name>-<SESSION_ID>.log` — raw stderr + lifecycle lines.
|
|
20
|
+
* The sole raw sink. Task 1721 retired the per-date twin: its date was
|
|
21
|
+
* pinned at spawn, no reader ever parsed it, and a since-removed stderr
|
|
22
|
+
* tee wrote the same file, so every line landed twice.
|
|
23
|
+
* - `${LOG_DIR}/mcp-<name>-nosession.log` — the same, for a spawn with
|
|
24
|
+
* no SESSION_ID (enumeration). One fixed file per server.
|
|
25
|
+
* - `server.log` via the loopback log-ingest route — best-effort mirror of
|
|
26
|
+
* the [mcp-helper] lifecycle lines.
|
|
27
|
+
*
|
|
28
|
+
* Lifecycle lines, correlation key `session=<id8> server=<name>` — unchanged:
|
|
29
|
+
* [mcp-helper] op=spawn ... pid= entry=
|
|
30
|
+
* [mcp-helper] op=boot ... head=<first stderr bytes>
|
|
31
|
+
* [mcp-helper] op=exit ... code= signal= lifetimeMs= stderr-tail=
|
|
32
|
+
*
|
|
33
|
+
* Process model (Task 989): the shim IS the server's process. op=exit fires
|
|
34
|
+
* from process.on("exit"), so it covers a normal exit, a non-zero exit, an
|
|
35
|
+
* uncaught throw (code 1), and a catchable-signal exit (SIGTERM/SIGINT/SIGHUP,
|
|
36
|
+
* whose handlers record the signal name). An external SIGKILL is uncatchable
|
|
37
|
+
* and leaves no op=exit line — the per-session stderr tail already on disk and
|
|
38
|
+
* Claude Code's own transport-drop are the evidence for that death mode.
|
|
39
|
+
*
|
|
40
|
+
* The shim never writes to fd 1 (stdout) — that is the JSON-RPC channel.
|
|
41
|
+
*/
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
const node_fs_1 = require("node:fs");
|
|
44
|
+
const node_path_1 = require("node:path");
|
|
45
|
+
const node_url_1 = require("node:url");
|
|
46
|
+
const SERVER_NAME = process.env.MCP_SPAWN_TEE_NAME ?? "unknown";
|
|
47
|
+
const LOG_DIR = process.env.LOG_DIR;
|
|
48
|
+
const SESSION_ID = process.env.SESSION_ID;
|
|
49
|
+
const PLATFORM_PORT = process.env.PLATFORM_PORT;
|
|
50
|
+
const ENTRY = process.argv[2];
|
|
51
|
+
const SESSION_ID8 = SESSION_ID ? SESSION_ID.slice(0, 8) : "—";
|
|
52
|
+
const spawnStamp = Date.now();
|
|
53
|
+
// The one raw sink (Task 1721). A sessionless spawn (rc-daemon stamps
|
|
54
|
+
// SESSION_ID='' — rc-daemon.ts:513 — while still stamping LOG_DIR) shares one
|
|
55
|
+
// fixed file per server rather than a date-named one: the date was never read
|
|
56
|
+
// by any reader and named a process lifetime, not a day. Interleaved spawns in
|
|
57
|
+
// the nosession file are separated by the [mcp-helper] op=spawn pid= lines.
|
|
58
|
+
const rawSinkPath = LOG_DIR
|
|
59
|
+
? (0, node_path_1.resolve)(LOG_DIR, SESSION_ID ? `mcp-${SERVER_NAME}-${SESSION_ID}.log` : `mcp-${SERVER_NAME}-nosession.log`)
|
|
60
|
+
: undefined;
|
|
61
|
+
// Rolling tail of entry stderr for op=exit. Capped so a chatty server cannot
|
|
62
|
+
// grow the buffer without bound.
|
|
63
|
+
const TAIL_CAP = 2048;
|
|
64
|
+
let stderrTail = "";
|
|
65
|
+
let bootEmitted = false;
|
|
66
|
+
let exitEmitted = false;
|
|
67
|
+
let exitSignal;
|
|
68
|
+
// The real stderr writer, captured before the tee replaces it. Lifecycle lines
|
|
69
|
+
// and stderr passthrough both go through this so they are never re-teed into
|
|
70
|
+
// the raw sink nor recursed back into the patched writer.
|
|
71
|
+
const rawStderrWrite = process.stderr.write.bind(process.stderr);
|
|
72
|
+
// LOG_DIR is created once, lazily, on the first successful append — not per
|
|
73
|
+
// chunk. teeWrite runs on the server's own stderr hot path now, so a per-call
|
|
74
|
+
// mkdirSync would be two syscalls per log line for nothing.
|
|
75
|
+
let logDirReady = false;
|
|
76
|
+
function appendSafe(path, data) {
|
|
77
|
+
if (!path || !LOG_DIR)
|
|
78
|
+
return;
|
|
79
|
+
try {
|
|
80
|
+
if (!logDirReady) {
|
|
81
|
+
(0, node_fs_1.mkdirSync)(LOG_DIR, { recursive: true });
|
|
82
|
+
logDirReady = true;
|
|
83
|
+
}
|
|
84
|
+
(0, node_fs_1.appendFileSync)(path, data);
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
/* unwritable destination — never mask primary output */
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Best-effort mirror of a lifecycle line to server.log via the loopback
|
|
91
|
+
// log-ingest route. Fire-and-forget: the per-session file is authoritative, so
|
|
92
|
+
// a dropped POST loses nothing. On the "exit" event the loop is stopping, so
|
|
93
|
+
// the op=exit mirror may not flush — the per-session line, written sync, holds.
|
|
94
|
+
function postToServerLog(suffix, level) {
|
|
95
|
+
if (!PLATFORM_PORT)
|
|
96
|
+
return;
|
|
97
|
+
try {
|
|
98
|
+
const ctrl = new AbortController();
|
|
99
|
+
const t = setTimeout(() => ctrl.abort(), 500);
|
|
100
|
+
t.unref?.(); // never let the abort timer keep the shim's event loop alive
|
|
101
|
+
void fetch(`http://127.0.0.1:${PLATFORM_PORT}/api/admin/log-ingest`, {
|
|
102
|
+
method: "POST",
|
|
103
|
+
headers: { "content-type": "application/json" },
|
|
104
|
+
body: JSON.stringify({ tag: "mcp-helper", level, line: suffix }),
|
|
105
|
+
signal: ctrl.signal,
|
|
106
|
+
}).then(() => clearTimeout(t)).catch(() => clearTimeout(t));
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
/* fetch threw synchronously — best-effort only */
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Emit one [mcp-helper] lifecycle line: authoritative per-session file (sync,
|
|
113
|
+
// survives process.exit), the shim's own stderr via the RAW writer (journald /
|
|
114
|
+
// Claude Code visibility, never re-teed), and a best-effort server.log mirror.
|
|
115
|
+
// `suffix` is the line body after the tag and carries no newline (the
|
|
116
|
+
// log-ingest route rejects newlines).
|
|
117
|
+
function emitLifecycle(suffix, level) {
|
|
118
|
+
const line = `[mcp-helper] ${suffix}\n`;
|
|
119
|
+
appendSafe(rawSinkPath, line);
|
|
120
|
+
try {
|
|
121
|
+
rawStderrWrite(line);
|
|
122
|
+
}
|
|
123
|
+
catch { /* stderr closed */ }
|
|
124
|
+
postToServerLog(suffix, level);
|
|
125
|
+
}
|
|
126
|
+
if (!ENTRY) {
|
|
127
|
+
emitLifecycle(`op=error session=${SESSION_ID8} server=${SERVER_NAME} reason="no entry given (argv[2] missing)"`, "error");
|
|
128
|
+
process.exit(2);
|
|
129
|
+
}
|
|
130
|
+
// Replace process.stderr.write with a tee: mirror every server stderr byte to
|
|
131
|
+
// the raw sink, keep a rolling tail for op=exit, emit
|
|
132
|
+
// op=boot on the first bytes, then pass the write through to the real stderr.
|
|
133
|
+
const teeWrite = ((...args) => {
|
|
134
|
+
const chunk = args[0];
|
|
135
|
+
appendSafe(rawSinkPath, chunk); // raw sink (Task 1721)
|
|
136
|
+
const text = typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8");
|
|
137
|
+
stderrTail = (stderrTail + text).slice(-TAIL_CAP);
|
|
138
|
+
if (!bootEmitted) {
|
|
139
|
+
bootEmitted = true;
|
|
140
|
+
const head = text.split("\n")[0].slice(0, 200);
|
|
141
|
+
emitLifecycle(`op=boot session=${SESSION_ID8} server=${SERVER_NAME} head=${JSON.stringify(head)}`, "info");
|
|
142
|
+
}
|
|
143
|
+
return rawStderrWrite(...args); // passthrough
|
|
144
|
+
});
|
|
145
|
+
process.stderr.write = teeWrite;
|
|
146
|
+
// Catchable-signal handling. The shim drives the exit ONLY when it is the sole
|
|
147
|
+
// listener for the signal — i.e. the imported entry installed no handler of its
|
|
148
|
+
// own. In that case it records the signal (so op=exit carries signal=<sig>) and
|
|
149
|
+
// exits with 128+signum, mirroring the prior wrapper's exit-status convention.
|
|
150
|
+
//
|
|
151
|
+
// When the entry DID install a handler, the shim defers entirely and records
|
|
152
|
+
// nothing: the entry's handler decides the exit code, and op=exit reflects that
|
|
153
|
+
// exit verbatim. This matches the prior two-process model, where a child that
|
|
154
|
+
// caught the signal and exited cleanly was observed as code=0 signal=— (a clean
|
|
155
|
+
// self-exit), not as a signal death. Setting exitSignal here unconditionally
|
|
156
|
+
// would mislabel every graceful signal-driven shutdown as a signal kill.
|
|
157
|
+
function onSignal(sig, code) {
|
|
158
|
+
return () => {
|
|
159
|
+
if (process.listenerCount(sig) === 1) {
|
|
160
|
+
exitSignal = sig;
|
|
161
|
+
process.exit(code);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
process.on("SIGTERM", onSignal("SIGTERM", 143));
|
|
166
|
+
process.on("SIGINT", onSignal("SIGINT", 130));
|
|
167
|
+
process.on("SIGHUP", onSignal("SIGHUP", 129));
|
|
168
|
+
// op=exit, emitted once from the process "exit" event. Sync-only — the loop is
|
|
169
|
+
// stopping. When a catchable signal caused the exit, report code=— signal=<sig>
|
|
170
|
+
// to match the prior wrapper's format; otherwise code=<exit code> signal=—.
|
|
171
|
+
process.on("exit", (code) => {
|
|
172
|
+
if (exitEmitted)
|
|
173
|
+
return;
|
|
174
|
+
exitEmitted = true;
|
|
175
|
+
const lifetimeMs = Date.now() - spawnStamp;
|
|
176
|
+
const tail = stderrTail.slice(-200);
|
|
177
|
+
const codeField = exitSignal ? "—" : String(code);
|
|
178
|
+
const level = exitSignal || code !== 0 ? "error" : "info";
|
|
179
|
+
emitLifecycle(`op=exit session=${SESSION_ID8} server=${SERVER_NAME} pid=${process.pid} ` +
|
|
180
|
+
`code=${codeField} signal=${exitSignal ?? "—"} lifetimeMs=${lifetimeMs} stderr-tail=${JSON.stringify(tail)}`, level);
|
|
181
|
+
});
|
|
182
|
+
emitLifecycle(`op=spawn session=${SESSION_ID8} server=${SERVER_NAME} pid=${process.pid} entry=${ENTRY}`, "info");
|
|
183
|
+
// Task 2356 — present argv as a direct `node <entry>` invocation before the
|
|
184
|
+
// entry loads. The shim is meant to be transparent: an entry that asks the
|
|
185
|
+
// standard "am I the entry module?" question
|
|
186
|
+
// (`import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href`)
|
|
187
|
+
// must get the same answer it gets when Claude Code runs it without the shim.
|
|
188
|
+
// With the shim's own path left in argv[1] the answer is no, so such an entry
|
|
189
|
+
// loads, starts nothing, and exits 0 — measured on the three channel servers,
|
|
190
|
+
// which all gate main() that way. Plugin MCPs connect at module top level and
|
|
191
|
+
// never read argv, so this is inert for them. ENTRY was captured above, before
|
|
192
|
+
// the rewrite. Extra CLI args keep their positions after the entry slot.
|
|
193
|
+
process.argv = [process.argv[0], ENTRY, ...process.argv.slice(3)];
|
|
194
|
+
// Run the real MCP server in THIS process. Dynamic import() (not top-level
|
|
195
|
+
// await — this file compiles to CommonJS) loads the ESM entry; a load-time
|
|
196
|
+
// failure mirrors the old child spawn-error path (op=error, exit 127). The
|
|
197
|
+
// op=exit handler is suppressed on this path so op=error stays the sole record.
|
|
198
|
+
import((0, node_url_1.pathToFileURL)(ENTRY).href).catch((err) => {
|
|
199
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
200
|
+
exitEmitted = true;
|
|
201
|
+
emitLifecycle(`op=error session=${SESSION_ID8} server=${SERVER_NAME} reason=${JSON.stringify(`import error: ${msg}`)}`, "error");
|
|
202
|
+
process.exit(127);
|
|
203
|
+
});
|
|
204
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|