borgmcp-shared 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/CONTRIBUTING.md +40 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +2 -0
  4. package/README.md +159 -0
  5. package/SECURITY.md +25 -0
  6. package/dist/conformance/adapter.d.ts +112 -0
  7. package/dist/conformance/adapter.d.ts.map +1 -0
  8. package/dist/conformance/adapter.js +417 -0
  9. package/dist/conformance/adapter.js.map +1 -0
  10. package/dist/conformance/index.d.ts +15 -0
  11. package/dist/conformance/index.d.ts.map +1 -0
  12. package/dist/conformance/index.js +49 -0
  13. package/dist/conformance/index.js.map +1 -0
  14. package/dist/domain/index.d.ts +5 -0
  15. package/dist/domain/index.d.ts.map +1 -0
  16. package/dist/domain/index.js +4 -0
  17. package/dist/domain/index.js.map +1 -0
  18. package/dist/drone-address.d.ts +3 -0
  19. package/dist/drone-address.d.ts.map +1 -0
  20. package/dist/drone-address.js +7 -0
  21. package/dist/drone-address.js.map +1 -0
  22. package/dist/index.d.ts +5 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +5 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/log-stream-hwm.d.ts +6 -0
  27. package/dist/log-stream-hwm.d.ts.map +1 -0
  28. package/dist/log-stream-hwm.js +12 -0
  29. package/dist/log-stream-hwm.js.map +1 -0
  30. package/dist/protocol/contract.d.ts +127 -0
  31. package/dist/protocol/contract.d.ts.map +1 -0
  32. package/dist/protocol/contract.js +434 -0
  33. package/dist/protocol/contract.js.map +1 -0
  34. package/dist/protocol/coordination.d.ts +38 -0
  35. package/dist/protocol/coordination.d.ts.map +1 -0
  36. package/dist/protocol/coordination.js +176 -0
  37. package/dist/protocol/coordination.js.map +1 -0
  38. package/dist/protocol/errors.d.ts +33 -0
  39. package/dist/protocol/errors.d.ts.map +1 -0
  40. package/dist/protocol/errors.js +26 -0
  41. package/dist/protocol/errors.js.map +1 -0
  42. package/dist/protocol/index.d.ts +8 -0
  43. package/dist/protocol/index.d.ts.map +1 -0
  44. package/dist/protocol/index.js +7 -0
  45. package/dist/protocol/index.js.map +1 -0
  46. package/dist/protocol/sse.d.ts +44 -0
  47. package/dist/protocol/sse.d.ts.map +1 -0
  48. package/dist/protocol/sse.js +246 -0
  49. package/dist/protocol/sse.js.map +1 -0
  50. package/dist/protocol/types.d.ts +174 -0
  51. package/dist/protocol/types.d.ts.map +1 -0
  52. package/dist/protocol/types.js +2 -0
  53. package/dist/protocol/types.js.map +1 -0
  54. package/dist/protocol/version.d.ts +11 -0
  55. package/dist/protocol/version.d.ts.map +1 -0
  56. package/dist/protocol/version.js +14 -0
  57. package/dist/protocol/version.js.map +1 -0
  58. package/dist/role-section.d.ts +24 -0
  59. package/dist/role-section.d.ts.map +1 -0
  60. package/dist/role-section.js +114 -0
  61. package/dist/role-section.js.map +1 -0
  62. package/dist/templates.d.ts +44 -0
  63. package/dist/templates.d.ts.map +1 -0
  64. package/dist/templates.js +771 -0
  65. package/dist/templates.js.map +1 -0
  66. package/docs/compatibility.md +38 -0
  67. package/docs/releasing.md +220 -0
  68. package/package.json +89 -0
  69. package/src/conformance/adapter.ts +717 -0
  70. package/src/conformance/index.ts +68 -0
  71. package/src/domain/index.ts +9 -0
  72. package/src/drone-address.ts +25 -0
  73. package/src/index.ts +4 -0
  74. package/src/log-stream-hwm.ts +16 -0
  75. package/src/protocol/contract.ts +608 -0
  76. package/src/protocol/coordination.ts +249 -0
  77. package/src/protocol/errors.ts +36 -0
  78. package/src/protocol/index.ts +7 -0
  79. package/src/protocol/sse.ts +295 -0
  80. package/src/protocol/types.ts +201 -0
  81. package/src/protocol/version.ts +31 -0
  82. package/src/role-section.ts +270 -0
  83. package/src/templates.ts +953 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAsEA,MAAM,8BAA8B,GAAG;;;;;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;;;wEAO4C,8BAA8B,GAAG,8BAA8B,GAAG,4BAA4B,EAAE;SACnK;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAA6B;IACjD,SAAS,EAAE,OAAO;IAClB,cAAc,EAAE,YAAY;CAC7B,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAChC,CAAC;AAaD,MAAM,UAAU,6BAA6B,CAC3C,gBAAwB,EACxB,QAAyB;IAEzB,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACvD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD,OAAO,QAAQ,EAAE,cAAc,IAAI,gBAAgB,CAAC;AACtD,CAAC;AAaD,MAAM,UAAU,4BAA4B,CAC1C,oBAA+C,EAC/C,QAAkB;IAElB,IAAI,oBAAoB,IAAI,oBAAoB,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC/D,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,QAAQ,CAAC,cAAc,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,gBAAoD,EACpD,QAAyB;IAEzB,OAAO,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE,gBAAgB,IAAI,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC;AAChG,CAAC"}
@@ -0,0 +1,38 @@
1
+ # Protocol Compatibility
2
+
3
+ `borgmcp-shared` versions the contracts shared by Borg MCP clients and server
4
+ implementations. Package versions and protocol generations are related but are
5
+ not interchangeable: a package release can add helpers without changing the
6
+ wire protocol.
7
+
8
+ | Package range | Protocol generation | Status |
9
+ | --- | --- | --- |
10
+ | `>=0.2.0 <0.3.0` | `1` | Versioned envelope, runtime codecs, and adapter conformance |
11
+
12
+ ## Change Policy
13
+
14
+ Consumers must pin `^0.2.0`, which npm interprets as `>=0.2.0 <0.3.0`. During
15
+ the pre-1.0 series, a breaking envelope or wire-contract change requires a
16
+ minor release (`0.3.0`); additive compatible contracts and corrections use a
17
+ patch release (`0.2.x`). Consumers widen the minor range only after deliberate
18
+ compatibility review. A broad `<1.0.0` range is unsafe because pre-1.0 minor
19
+ versions may break the wire contract.
20
+
21
+ A wire-shape change must include all of the following:
22
+
23
+ 1. A new or updated implementation-neutral conformance vector.
24
+ 2. A documented client and server rollout order.
25
+ 3. A compatibility entry that identifies the affected package and protocol
26
+ versions.
27
+ 4. A migration window when older deployed clients or servers can still be in
28
+ use.
29
+
30
+ Removing or reinterpreting an existing field is a protocol-breaking change even
31
+ when TypeScript permits it. Implementations must not infer compatibility from a
32
+ successful build alone; they should check the declared protocol generation and
33
+ run the shared conformance suite.
34
+
35
+ Model/provider selection is intentionally absent from the `0.2.x` coordination
36
+ contract. Agent CLIs own model configuration; Borg servers may expose the
37
+ separate advisory `reported_model` field for session observability, but clients
38
+ must not use it for routing, launch configuration, or authorization.
@@ -0,0 +1,220 @@
1
+ # Publishing `borgmcp-shared`
2
+
3
+ This repository publishes immutable public releases from a protected GitHub
4
+ Actions environment. A release is built once, audited as a tarball, and then
5
+ published from that exact tarball. Local publication and publication from an
6
+ unreviewed branch are not supported.
7
+
8
+ The active release policy is governed by the ratified
9
+ `shared-package-consumption` and `npm-publish-sole-operator-approval` decisions.
10
+ This document describes the operator procedure; it does not authorize a release.
11
+
12
+ ## Permanent Repository Configuration
13
+
14
+ Configure these controls before creating a release tag:
15
+
16
+ 1. Keep `.github/workflows/publish.yml` as the only npm trusted-publisher
17
+ workflow. The workflow uses a GitHub-hosted runner, exact Node and npm
18
+ versions, no dependency cache, and only `contents: read` plus
19
+ `id-token: write` in the protected publish job. npm is installed with
20
+ lifecycle scripts disabled under an isolated `${RUNNER_TEMP}` prefix; only
21
+ that prefix's bin directory enters `GITHUB_PATH`. Never update the active
22
+ global npm installation from within npm itself.
23
+ 2. Create a GitHub environment named `npm-publish`. Require an authorized
24
+ approval from the sole operator `TheodorStorm`, allow self-review so that the
25
+ sole-operator path remains executable, and prevent administrators from
26
+ bypassing its protection rules. Store npm bootstrap credentials only in this
27
+ environment. This exact shape is ratified by
28
+ `npm-publish-sole-operator-approval`; adding any other reviewer or bypass
29
+ actor requires a new decision.
30
+ 3. Add an active tag ruleset whose only included ref is
31
+ `refs/tags/v*.*.*`. Enable creation, update (without fetch-and-merge),
32
+ deletion, and non-fast-forward restrictions. The sole bypass actor is the
33
+ release-operator user `TheodorStorm` (GitHub user ID `12745431`), with no
34
+ role, administrator, team, application, or deploy-key bypass. Require an
35
+ annotated tag; the workflow rejects lightweight tags and tags whose commit is
36
+ not on `main`.
37
+ 4. Set the environment variable `NPM_EXPECTED_OWNER` to `byteventures`, the npm
38
+ maintainer returned by `npm view borgmcp maintainers`. Do not infer this value
39
+ from package metadata.
40
+ 5. Keep the GitHub repository public when provenance is generated. npm cannot
41
+ issue provenance for a public package built from a private GitHub repository,
42
+ and the workflow stops if the repository is private.
43
+ 6. Protect `refs/heads/main` with an active ruleset and no bypass actors. Require
44
+ resolved review threads and the `package (20)` and `package (22)` checks from
45
+ GitHub Actions application ID `15368`, with strict status checking. Set the
46
+ GitHub approval count to zero and disable stale-review dismissal, code-owner
47
+ review, and last-push approval: the separately recorded cube CR, Security,
48
+ and Release Quality gates are the human evidence, while a GitHub approval
49
+ requirement would be inoperable for the sole repository operator. Allow
50
+ merge commits only and protect deletion and non-fast-forward operations. Do
51
+ not add a restrictive update rule, which would block normal pull-request
52
+ merges without a bypass.
53
+ 7. Restrict Actions to selected GitHub-owned actions and require full commit-SHA
54
+ pins. Do not allow all verified Marketplace publishers or any custom pattern.
55
+ The CI and publish workflows need only `actions/checkout`,
56
+ `actions/setup-node`, `actions/upload-artifact`, and
57
+ `actions/download-artifact`, each pinned in source. Keep workflow tokens
58
+ read-only and prohibit them from approving pull requests.
59
+ 8. Enable GitHub private vulnerability reporting, secret scanning, push
60
+ protection, and Dependabot security updates unconditionally. Enable secret
61
+ validity checks and non-provider pattern detection whenever the organization
62
+ plan licenses them. GitHub requires a paid plan with GitHub Secret Protection
63
+ for [validity checks](https://docs.github.com/en/code-security/how-tos/secure-your-secrets/customize-leak-detection/enable-validity-checks)
64
+ and [non-provider patterns](https://docs.github.com/en/code-security/secret-scanning/using-advanced-secret-scanning-and-push-protection-features/non-provider-patterns/enabling-secret-scanning-for-non-provider-patterns).
65
+ The configuration guard accepts those two controls as disabled only while the
66
+ live organization plan is exactly `free`; a plan change makes them mandatory.
67
+ `SECURITY.md` directs reporters to the private reporting path, so disabled
68
+ reporting is always a release-blocking documentation failure.
69
+
70
+ The environment approval is the final technical control. Approval must remain
71
+ pending while Security reviews the artifact produced by the `verify` job.
72
+ GitHub's ephemeral workflow token cannot read every repository-administration
73
+ setting checked by `scripts/verify-release-configuration.mjs`. An authorized
74
+ operator must run the guard with an administration-capable token before creating
75
+ the tag and again immediately before approving the environment:
76
+
77
+ ```sh
78
+ GITHUB_TOKEN="$(gh auth token)" node scripts/verify-release-configuration.mjs
79
+ ```
80
+
81
+ The token is read from the operator's credential store and must not be written
82
+ to the repository, an artifact, or workflow output. Any guard failure blocks the
83
+ tag or environment approval.
84
+
85
+ Every release and verification-only run must be a first attempt. The workflow
86
+ logs `GITHUB_RUN_ID` and `GITHUB_RUN_ATTEMPT`, rejects any attempt other than `1`
87
+ before dependency installation, and includes the same values in the uploaded
88
+ `RUN_EVIDENCE` file. Never use the Actions rerun controls to advance a failed
89
+ immutable tag or proof run.
90
+
91
+ Both jobs reject a repository-root `.npmrc` before their first npm command. The
92
+ exact npm bootstrap uses isolated runner-temp prefix, user config, and cache
93
+ paths, forces `https://registry.npmjs.org`, disables scripts, and verifies both
94
+ the installed npm version and registry before adding its bin directory to
95
+ `GITHUB_PATH`.
96
+
97
+ ## First-Publish Bootstrap
98
+
99
+ npm trusted publishing cannot be configured until the unscoped package exists.
100
+ The initial `v0.2.0` bootstrap run, `29353763609`, failed during verification
101
+ before producing an artifact or reaching publication. The failed `v0.2.0` tag is
102
+ immutable and MUST NOT be moved, reused, or rerun. The separately authorized
103
+ `v0.2.1` tag run, `29355823822`, also failed verification before dependency
104
+ installation or artifact creation because the checkout action replaced its local
105
+ annotated-tag ref with the peeled commit. The remote `v0.2.1` tag remains valid
106
+ and immutable and MUST NOT be moved, reused, or rerun.
107
+
108
+ The first protected-main verification-only proof run, `29356980492`, confirmed
109
+ the repaired tag/source trust checks, then failed before artifact upload because
110
+ npm 11 interpreted the bare `release/<tarball>` argument as a package/GitHub spec
111
+ instead of a local file. It produced no auditable artifact and MUST NOT be rerun.
112
+ The workflow now passes generated tarballs to both npm dry-run and publication as
113
+ explicit `./release/<tarball>` filesystem paths.
114
+
115
+ The next protected-main proof run, `29357632667`, passed every verification gate
116
+ against immutable `v0.2.1`, structurally skipped the publish job, and produced an
117
+ exact artifact that passed Security audit. This proved the corrected tag,
118
+ protected-main, input, artifact, and npm local-file handling without reusing the
119
+ tag for publication.
120
+
121
+ Under the ratified `borgmcp-shared-recovery-version` decision, `0.2.2` is the
122
+ selected recovery version. The source bump does not itself authorize a tag,
123
+ environment approval, or publication.
124
+
125
+ The eventual first publication will use one temporary credential while still
126
+ generating provenance from GitHub Actions.
127
+
128
+ Before creating the tag, the release operator must verify all of the following:
129
+
130
+ - The npm account is the account that owns `borgmcp`, uses authentication-and-
131
+ writes 2FA, and has tested, protected recovery methods.
132
+ - `borgmcp-shared` is still unclaimed. An `E404` is expected. Any package or
133
+ ownership result that differs from the reviewed state is a stop condition.
134
+ - Code Review, load-bearing Security Review, and Release Quality approved the
135
+ exact commit on `main`.
136
+ - The Queen explicitly authorized generating the final release artifact. This
137
+ authorization does not by itself approve the later environment deployment.
138
+
139
+ Create a short-lived, least-privilege npm publish token under the verified owner
140
+ account. Store it as the `NPM_TOKEN` secret in the `npm-publish` environment;
141
+ never place it in repository variables, workflow files, shell history,
142
+ `package.json`, a committed `.npmrc`, or an issue. Set the protected environment
143
+ variable `ALLOW_UNCLAIMED_FIRST_PUBLISH` to `true` only for this bootstrap.
144
+
145
+ The `0.2.2` package, lockfile, runbook, and version assertions must pass fresh CR,
146
+ Security, and Release Quality gates and merge to protected `main` before the
147
+ Coordinator creates its matching annotated tag under
148
+ `borgmcp-shared-first-publish-autonomy`. The tag starts the workflow but does not
149
+ immediately publish. The unprivileged `verify` job performs the following gates
150
+ first:
151
+
152
+ - verifies the public repository, annotated tag, exact package version, and
153
+ ancestry on `main`;
154
+ - installs the lockfile without lifecycle scripts and runs audit, type checks,
155
+ all tests, a clean build, and the tracked-`dist` drift check;
156
+ - creates one tarball with lifecycle scripts disabled;
157
+ - enforces the explicit public file allowlist, legal files, dependency and
158
+ lifecycle policy, size limits, and resolvable source maps;
159
+ - exercises npm's publish metadata in dry-run mode; and
160
+ - installs the exact tarball with scripts disabled in a clean consumer, verifies
161
+ its production tree, and imports every reviewed public export; and
162
+ - uploads the tarball, verifier report, and SHA-512 checksum for seven days.
163
+
164
+ Security must download and audit that exact workflow artifact. After Security
165
+ approves the tarball, Release Quality confirms the operator procedure, and the
166
+ Queen explicitly authorizes the public flip, an authorized reviewer may approve
167
+ the waiting `npm-publish` environment deployment. The publish job downloads and
168
+ checksum-verifies the same artifact, repeats the artifact verifier, checks that
169
+ `0.2.2` is absent and the name is unclaimed as expected, and publishes only the
170
+ downloaded tarball with `--access public --provenance`.
171
+
172
+ Immediately after a successful first publish:
173
+
174
+ 1. Confirm the workflow's registry-integrity, owner, and SLSA provenance checks
175
+ passed before changing any consumer dependency.
176
+ 2. Configure npm's trusted publisher for organization `Byte-Ventures`, repository
177
+ `borg-mcp-shared`, workflow filename `publish.yml`, environment
178
+ `npm-publish`, and the `npm publish` action.
179
+ 3. Remove the `NPM_TOKEN` environment secret, revoke the bootstrap token at npm,
180
+ and set `ALLOW_UNCLAIMED_FIRST_PUBLISH` to `false`.
181
+ 4. Configure npm publishing access to require 2FA and disallow traditional
182
+ tokens. Future releases authenticate through short-lived OIDC credentials.
183
+ 5. Only then replace consumers' exact Git SHA dependencies with
184
+ `borgmcp-shared@^0.2.0` and commit their registry lockfiles.
185
+
186
+ ## Later Releases
187
+
188
+ Later releases follow the same source gates, annotated protected tag, exact
189
+ tarball audit, Queen authorization, and environment approval. The registry
190
+ preflight requires the package to be owned by `NPM_EXPECTED_OWNER` and rejects
191
+ an existing target version. It also fails if
192
+ `ALLOW_UNCLAIMED_FIRST_PUBLISH` is not `false` or any `NPM_TOKEN` remains;
193
+ npm must exchange the workflow's OIDC identity through the configured trusted
194
+ publisher.
195
+
196
+ ## Stop and Recovery Conditions
197
+
198
+ Stop without approving the environment when any of these conditions occurs:
199
+
200
+ - the repository is private, the tag is lightweight or unprotected, the tag
201
+ does not exactly match `v<package version>`, or its commit is not on `main`;
202
+ - the approved commit, tag target, tarball checksum, or audit artifact differs;
203
+ - `GITHUB_RUN_ATTEMPT` is not `1`, or run/attempt evidence is missing;
204
+ - tests, audit, build, tracked output, artifact policy, legal metadata, or dry
205
+ run fails;
206
+ - the npm name, expected owner, account 2FA, recovery methods, credential scope,
207
+ trusted-publisher configuration, or environment protection cannot be verified;
208
+ - the target version already exists, npm returns anything other than the
209
+ expected ownership/availability response, or npm/GitHub is degraded; or
210
+ - final CR, Security, Release Quality, exact-tarball Security approval, or Queen
211
+ authorization is missing.
212
+
213
+ npm versions are immutable. Never retry by overwriting `0.2.0`, moving the tag,
214
+ force-pushing a branch, or publishing from a local rebuild. A failed verification
215
+ before publication requires fixing the source and beginning again with a new
216
+ reviewed version/tag plan. If npm accepted the version but integrity or
217
+ provenance verification failed, block every consumer migration, preserve the
218
+ workflow logs and artifact, and escalate as a release incident. Do not unpublish,
219
+ deprecate, or publish a replacement version without a separately reviewed and
220
+ authorized recovery decision.
package/package.json ADDED
@@ -0,0 +1,89 @@
1
+ {
2
+ "name": "borgmcp-shared",
3
+ "version": "0.2.2",
4
+ "description": "Shared protocol, domain, templates, and conformance contracts for Borg MCP implementations.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./templates": {
14
+ "types": "./dist/templates.d.ts",
15
+ "import": "./dist/templates.js"
16
+ },
17
+ "./role-section": {
18
+ "types": "./dist/role-section.d.ts",
19
+ "import": "./dist/role-section.js"
20
+ },
21
+ "./log-stream-hwm": {
22
+ "types": "./dist/log-stream-hwm.d.ts",
23
+ "import": "./dist/log-stream-hwm.js"
24
+ },
25
+ "./drone-address": {
26
+ "types": "./dist/drone-address.d.ts",
27
+ "import": "./dist/drone-address.js"
28
+ },
29
+ "./protocol": {
30
+ "types": "./dist/protocol/index.d.ts",
31
+ "import": "./dist/protocol/index.js"
32
+ },
33
+ "./domain": {
34
+ "types": "./dist/domain/index.d.ts",
35
+ "import": "./dist/domain/index.js"
36
+ },
37
+ "./conformance": {
38
+ "types": "./dist/conformance/index.d.ts",
39
+ "import": "./dist/conformance/index.js"
40
+ },
41
+ "./package.json": "./package.json"
42
+ },
43
+ "files": [
44
+ "dist",
45
+ "src",
46
+ "README.md",
47
+ "LICENSE",
48
+ "NOTICE",
49
+ "SECURITY.md",
50
+ "CONTRIBUTING.md",
51
+ "docs"
52
+ ],
53
+ "scripts": {
54
+ "clean": "rm -rf dist",
55
+ "build": "npm run clean && tsc -p tsconfig.json",
56
+ "check": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit",
57
+ "test": "vitest run",
58
+ "verify:artifact": "node scripts/verify-packed-artifact.mjs",
59
+ "prepack": "npm run check && npm test && npm run build"
60
+ },
61
+ "keywords": [
62
+ "borgmcp",
63
+ "mcp",
64
+ "multi-agent",
65
+ "protocol",
66
+ "conformance"
67
+ ],
68
+ "author": "Byte Ventures IO AB",
69
+ "license": "Apache-2.0",
70
+ "homepage": "https://borgmcp.ai",
71
+ "repository": {
72
+ "type": "git",
73
+ "url": "git+https://github.com/Byte-Ventures/borg-mcp-shared.git"
74
+ },
75
+ "bugs": {
76
+ "url": "https://github.com/Byte-Ventures/borg-mcp-shared/issues"
77
+ },
78
+ "publishConfig": {
79
+ "access": "public"
80
+ },
81
+ "devDependencies": {
82
+ "@types/node": "^22.10.2",
83
+ "typescript": "^6.0.3",
84
+ "vitest": "^3.2.4"
85
+ },
86
+ "engines": {
87
+ "node": ">=20"
88
+ }
89
+ }