borgmcp-shared 0.10.1 → 0.11.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.
package/CONTRIBUTING.md CHANGED
@@ -19,9 +19,9 @@ Use Node.js 20 or newer, then run:
19
19
 
20
20
  ```sh
21
21
  npm install
22
- npm test
23
- npm run check
24
22
  npm run build
23
+ npm run check
24
+ npm test
25
25
  npm pack --dry-run
26
26
  ```
27
27
 
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # borgmcp-shared
2
2
 
3
3
  `borgmcp-shared` is the implementation-neutral contract package for Borg MCP.
4
- It contains protocol types, domain helpers, built-in cube templates, and
5
- portable conformance vectors used by Borg MCP clients and server implementations.
4
+ It contains protocol types, domain helpers, built-in cube templates, and portable
5
+ conformance vectors that Borg MCP client and server implementations can run.
6
6
  Its pure ESM helpers and generated TypeScript declarations run consistently
7
7
  across host environments with zero runtime dependencies.
8
8
 
@@ -12,7 +12,7 @@ across host environments with zero runtime dependencies.
12
12
  npm install borgmcp-shared
13
13
  ```
14
14
 
15
- The package is ESM-only and supports Node.js 20 or newer.
15
+ The package is ESM-only and supports Node.js 22.12.0 or newer.
16
16
 
17
17
  ## Public API
18
18
 
@@ -53,9 +53,9 @@ The supported subpaths are:
53
53
  - `borgmcp-shared/drone-address`: stable short drone-address rendering.
54
54
  - `borgmcp-shared/runtime-metadata`: pure validation and canonical repository
55
55
  identity helpers for advisory local seat metadata.
56
+ - `borgmcp-shared/package.json`: package metadata.
56
57
 
57
- Generated declaration files are included in every published package. Public
58
- functions and contracts include API documentation in their TypeScript sources.
58
+ Generated declaration files are included in the published package.
59
59
 
60
60
  ## Handshake
61
61
 
@@ -99,11 +99,12 @@ authority: there is no capability negotiation, and client and server ship and
99
99
  update together as one clean-slate product. The attach request envelope still
100
100
  decodes its version before any payload as defense in depth.
101
101
 
102
- Every JSON coordination request and successful JSON response is carried inside
103
- `ProtocolEnvelope<T>`. Failures use `ProtocolErrorEnvelope`. The only bodyless
104
- exceptions are the `204` liveness and acknowledgement responses. Payload codecs
105
- are exported separately so adapters can validate the envelope first and then
106
- validate the operation-specific payload without accepting ambiguous fields.
102
+ Versioned JSON coordination requests and successful responses are carried inside
103
+ `ProtocolEnvelope<T>`. Failures use `ProtocolErrorEnvelope`. The credential-free
104
+ protocol preflight uses its exact tag-only shape; `204` liveness and
105
+ acknowledgement responses are bodyless. Payload codecs are exported separately
106
+ so adapters can validate the envelope first and then validate the
107
+ operation-specific payload without accepting ambiguous fields.
107
108
  Cube managers reassign a seat with `PATCH /api/cubes/:cubeId/drones/:droneId`
108
109
  and evict one with `DELETE` on the same path. Both operations use strict
109
110
  versioned request and success envelopes. An evicted seat's former bearer receives
@@ -121,8 +122,8 @@ ordinary ungranted enrollment, cube creation, pending enrollment, and retry cont
121
122
  ## Conformance
122
123
 
123
124
  Server and client implementations should run the vectors exported from
124
- `borgmcp-shared/conformance` against their adapters. The vectors and runner are
125
- readonly data rather than Vitest-specific helpers, so they work with any test
125
+ `borgmcp-shared/conformance` against their adapters. The vectors are readonly
126
+ data, and the runner is test-runner-independent code, so they work with any test
126
127
  runner supported by the implementation. Cases cover HTTP and canonical errors,
127
128
  credential misuse, isolation and revocation, SSE framing/replay/cursor ordering,
128
129
  executable enrollment authority/retry/mismatch/redaction and cube-create
@@ -144,9 +145,9 @@ historical values so existing registry entries remain compatible.
144
145
  Implement `ConformanceEnvironment` with raw responses from the target adapter,
145
146
  then call `runAdapterConformance`. The runner creates and decodes envelopes,
146
147
  drives state transitions, and decides pass/fail; adapters do not submit expected
147
- results. Each server or client adapter runs this single portable suite against
148
- its local/self-hosted implementation. The package does not define a second
149
- authority, migration target, or fallback implementation.
148
+ results. A server or client adapter can run the portable suite against its
149
+ local/self-hosted implementation. The package does not define a second authority,
150
+ migration target, or fallback implementation.
150
151
 
151
152
  The package's own suite covers built-in templates, role-section patching,
152
153
  broadcast high-water-mark ordering, drone-address formatting, runtime metadata
@@ -2,7 +2,7 @@ import { ErrorCode } from './errors.js';
2
2
  import { type ProtocolVersion } from './version.js';
3
3
  import type { DroneRuntimeMetadata, DroneRuntimeMetadataPatch } from './types.js';
4
4
  export declare const SHARED_PACKAGE_NAME: "borgmcp-shared";
5
- export declare const SHARED_PACKAGE_VERSION: "0.10.1";
5
+ export declare const SHARED_PACKAGE_VERSION: "0.11.0";
6
6
  export declare const DECISION_TEXT_MAX_BYTES: 512;
7
7
  export declare const ROLE_TEXT_MAX_BYTES: 51200;
8
8
  export declare const HEALTH_PATH: "/healthz";
@@ -2,7 +2,7 @@ import { ErrorCode } from './errors.js';
2
2
  import { PROTOCOL_VERSION } from './version.js';
3
3
  import { canonicalizeRepositoryIdentity, RuntimeMetadataValidationError, validateRuntimeMetadata, validateRuntimeMetadataPatch, validateRuntimeMetadataReportState, } from '../runtime-metadata.js';
4
4
  export const SHARED_PACKAGE_NAME = 'borgmcp-shared';
5
- export const SHARED_PACKAGE_VERSION = '0.10.1';
5
+ export const SHARED_PACKAGE_VERSION = '0.11.0';
6
6
  export const DECISION_TEXT_MAX_BYTES = 512;
7
7
  export const ROLE_TEXT_MAX_BYTES = 51_200;
8
8
  export const HEALTH_PATH = '/healthz';
@@ -51,7 +51,7 @@ export declare const WAKE_PATH_MONITOR_DISCIPLINE = "\n\nWake discipline:\n- Use
51
51
  export declare const WORKER_BUNDLE_DRY_RUN_DISCIPLINE = "\n\nEnvironment-owned verification:\n- When a required check needs permissions or an environment this seat lacks, report the exact check and revision.\n- The coordinating seat routes that one check to an authorized operator; it does not broaden the implementation slice.\n- A result from another revision does not satisfy the gate.";
52
52
  export declare const PUSH_DISCIPLINE_COORDINATOR = "\n\nPush discipline:\n- Before pushing an integration result, fetch, verify the target and exact revision, and confirm the worktree is clean.\n- Do not force-push or move an existing tag without explicit recovery authority.";
53
53
  export declare const PUSH_DISCIPLINE_BUILDER = "\n\nPush discipline:\n- Push only the assigned branch after verifying the staged paths and final diff.\n- Do not force-push, rebase a shared branch, or publish from a local substitute artifact.";
54
- export declare const SAME_REPOSITORY_WORKFLOW_DISCIPLINE = "\n\nSame-repository worktrees and handover:\n- One seat uses one stable worktree, created once at assimilation under the standard worktree root and approved once by the operator. All seats for a repository are worktrees of the same clone family, sharing its object database and refs.\n- Start each new work item by switching branches in that seat's worktree with `git checkout -b <branch>`; never create a new worktree or folder per work item.\n- Create a branch only for a routed work item and announce its name in STARTING. One branch equals one work item and one owning seat; hand a branch to another seat only through an explicit log event.\n- Use merge-only history: no rebases and no force-pushes, because another seat may have the branch checked out or fetched.\n- Hand over a ref and exact commit SHA, never a filesystem path. Reviewers check out the SHA in their own worktree with `git checkout --detach <SHA>`; never read another seat's folder. Each review round binds to one exact SHA, and a new SHA restarts the gate sequence.\n- With a hosted origin, push the branch at creation with `git push -u origin <branch>`; a branch is cube-visible and REVIEW-READY only after that push.\n- With no hosted remote, the commit itself is the durable handover artifact because clone-family worktrees share refs; omit the push step. If push/fetch semantics are needed locally, use a local bare repository as the origin path.\n- Put all scratch work \u2014 detached review checkouts, clean-environment verification rigs, fake HOMEs, unpacked artifacts, and throwaway worktrees \u2014 under `~/.borg/scratch/<your-seat-label>/`; never use `/tmp` or an ad-hoc path. Scratch contents are disposable and must be cleaned up with the work.\n- After every merge to the protected or main branch, broadcast the merge SHA. When an origin exists, include `git fetch origin && git merge origin/main` as the merge-only sync instruction.";
54
+ export declare const SAME_REPOSITORY_WORKFLOW_DISCIPLINE = "\n\nSame-repository workflow policy:\n- Start a routed work item on its own branch with `git checkout -b <branch>`. Announce its name in STARTING. One branch equals one work item and one owning seat.\n- Use merge-only history: no rebases and no force-pushes.\n- Hand over the exact commit SHA. Each review round binds to one exact SHA, and a new SHA restarts the gate sequence.\n- Run `git remote get-url origin` to determine whether a hosted origin exists.\n- When that command succeeds, publish the branch with `git push -u origin <branch>`; the branch is REVIEW-READY only after that push and exact remote-head verification.\n- When that command fails because no origin exists, omit the push; the work is REVIEW-READY when its exact commit SHA is available through the project review mechanism.\n- After every merge to the protected or main branch, broadcast the merge SHA.";
55
55
  export declare const UNIVERSAL_SAFETY_DISCIPLINES: string[];
56
56
  export declare const ROLE_SCOPED_SAFETY_DISCIPLINES: string[];
57
57
  export declare const DRONE_ADDRESSING_CONVENTION = "\n\nDrone addressing:\n- Route directed work with the stable short UUID shown by Borg, not a mutable display label.\n- Keep each dispatch self-contained: recipient, exact item, first action, and completion evidence.";
@@ -1 +1 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,WAAW,GAAG,UAAU,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;CACvC;AAED,MAAM,MAAM,eAAe,GAAG,oBAAoB,EAAE,CAAC;AAErD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,eAAe,CAAC;CACpC;AAED,eAAO,MAAM,6BAA6B,qBAAqB,CAAC;AAEhE,eAAO,MAAM,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