borgmcp-shared 0.4.3 → 0.5.1
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/README.md +11 -9
- package/dist/conformance/index.d.ts +6 -0
- package/dist/conformance/index.d.ts.map +1 -1
- package/dist/conformance/index.js +23 -0
- package/dist/conformance/index.js.map +1 -1
- package/dist/protocol/contract.d.ts +1 -2
- package/dist/protocol/contract.d.ts.map +1 -1
- package/dist/protocol/contract.js +2 -3
- package/dist/protocol/contract.js.map +1 -1
- package/dist/protocol/version.d.ts +1 -1
- package/dist/protocol/version.js +1 -1
- package/dist/templates.d.ts +13 -13
- package/dist/templates.d.ts.map +1 -1
- package/dist/templates.js +342 -673
- package/dist/templates.js.map +1 -1
- package/docs/compatibility.md +6 -0
- package/docs/enrollment.md +5 -5
- package/docs/releasing.md +7 -2
- package/package.json +1 -1
- package/src/conformance/index.ts +33 -1
- package/src/protocol/contract.ts +8 -11
- package/src/protocol/version.ts +2 -2
- package/src/templates.ts +365 -803
package/dist/templates.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAsCA,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;yFAOoD,CAAC;AAI1F,MAAM,CAAC,MAAM,gCAAgC,GAAG;;;;;;iFAMiC,CAAC;AAElF,MAAM,CAAC,MAAM,mCAAmC,GAAG;;;;;;;;8GAQ2D,CAAC;AAE/G,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;iHAM6E,CAAC;AAElH,MAAM,CAAC,MAAM,kCAAkC,GAAG;;;;;6HAK2E,CAAC;AAE9H,MAAM,CAAC,MAAM,sCAAsC,GAAG;;;;;sFAKgC,CAAC;AAEvF,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;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qBAAqB,EAAE;SACvF;QACD;YACE,IAAI,EAAE,UAAU;YAChB,aAAa,EAAE,IAAI;YACnB,iBAAiB,EAAE,iGAAiG;YACpH,oBAAoB,EAAE;;;;;;8CAMkB,qBAAqB,EAAE;SAChE;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAA6B;IACjD,OAAO,EAAE,OAAO;IAChB,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;AAED,MAAM,UAAU,6BAA6B,CAC3C,gBAAwB,EACxB,QAAyB;IAEzB,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,gBAAgB,CAAC;IAChF,OAAO,QAAQ,EAAE,cAAc,IAAI,gBAAgB,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,oBAA+C,EAC/C,QAAkB;IAElB,IAAI,oBAAoB,IAAI,oBAAoB,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IAC5E,OAAO,QAAQ,CAAC,cAAc,IAAI,IAAI,CAAC;AACzC,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"}
|
package/docs/compatibility.md
CHANGED
|
@@ -31,6 +31,12 @@ A wire-shape change must include:
|
|
|
31
31
|
3. A package version bump so the new protocol tag never ships under a version
|
|
32
32
|
whose already-published artifact carries a different tag.
|
|
33
33
|
|
|
34
|
+
Protocol v3 is carried by the published `borgmcp-shared@0.5.0` release. It
|
|
35
|
+
removes `session.expires_at` from attach responses: the exact session shape is
|
|
36
|
+
`{ "id": "<UUID>" }`. A v2 peer rejects v3 at preflight and envelope boundaries
|
|
37
|
+
before it decodes this response; a v3 peer likewise rejects v2. There is no
|
|
38
|
+
field-level fallback.
|
|
39
|
+
|
|
34
40
|
Removing or reinterpreting an existing field is a protocol-breaking change even
|
|
35
41
|
when TypeScript permits it. Implementations must not infer compatibility from a
|
|
36
42
|
successful build alone — they must run the shared conformance suite against the
|
package/docs/enrollment.md
CHANGED
|
@@ -9,11 +9,11 @@ This contract replaced the server-generated bearer response used by the
|
|
|
9
9
|
published `borgmcp-shared@0.3.0` v1 baseline and shipped in the immutable
|
|
10
10
|
`0.4.0` clean-slate v2 release. The immutable `v0.4.1` verification artifact
|
|
11
11
|
failed its cross-platform SBOM audit and must never be published or rerun.
|
|
12
|
-
`borgmcp-shared@0.4.2`
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
`borgmcp-shared@0.4.2`, `borgmcp-shared@0.4.3`, and `borgmcp-shared@0.5.0` are
|
|
13
|
+
published and immutable. This source now identifies the unpublished `0.5.1`
|
|
14
|
+
package release. The version bump grants no tag or publication authority: creating
|
|
15
|
+
the `v0.5.1` tag and publishing the reviewed artifact remain separate,
|
|
16
|
+
independently gated steps.
|
|
17
17
|
There is no compatibility path that returns a bearer from the server.
|
|
18
18
|
|
|
19
19
|
A client verifies the credential-free `GET /api/protocol` tag preflight before
|
package/docs/releasing.md
CHANGED
|
@@ -122,5 +122,10 @@ These records remain evidence, not reusable release inputs:
|
|
|
122
122
|
postpublish check reconstructed the wrong workflow identity and is the reason
|
|
123
123
|
that machinery was removed.
|
|
124
124
|
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
`borgmcp-shared@0.4.3` and `borgmcp-shared@0.5.0` are published and immutable.
|
|
126
|
+
This source identifies the unpublished `0.5.1` package release. Its release
|
|
127
|
+
requires reviewed source and explicit publication authorization through one
|
|
128
|
+
protected publish run, followed by
|
|
129
|
+
postpublish registry integrity, signature, and attestation verification. Consumers
|
|
130
|
+
must update the reviewed shared artifact before adopting the matching server and
|
|
131
|
+
client releases; protocol v2 and v3 peers fail closed at credential-free preflight.
|
package/package.json
CHANGED
package/src/conformance/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BroadcastHwm } from '../log-stream-hwm.js';
|
|
2
|
-
import type { EnrollmentExchangeRequest } from '../protocol/contract.js';
|
|
2
|
+
import type { AttachResponse, EnrollmentExchangeRequest } from '../protocol/contract.js';
|
|
3
3
|
|
|
4
4
|
export * from './adapter.js';
|
|
5
5
|
|
|
@@ -205,3 +205,35 @@ export const ENROLLMENT_REDACTION_CONFORMANCE: readonly ConformanceVector<string
|
|
|
205
205
|
expected: `cube_id=${ENROLLMENT_RETRY_KEY}`,
|
|
206
206
|
},
|
|
207
207
|
];
|
|
208
|
+
|
|
209
|
+
export interface AttachSessionConformanceVector {
|
|
210
|
+
name: string;
|
|
211
|
+
response: unknown;
|
|
212
|
+
accepts: boolean;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const ATTACH_RESPONSE = {
|
|
216
|
+
result: 'created',
|
|
217
|
+
cube: { id: '10000000-0000-4000-8000-000000000001', name: 'test-cube' },
|
|
218
|
+
role: { id: '20000000-0000-4000-8000-000000000001', name: 'Coordinator' },
|
|
219
|
+
drone: { id: '30000000-0000-4000-8000-000000000001', label: 'one-of-one-coordinator' },
|
|
220
|
+
session: { id: '40000000-0000-4000-8000-000000000001' },
|
|
221
|
+
} satisfies AttachResponse;
|
|
222
|
+
|
|
223
|
+
/** Wire vectors for the v3 non-expiring attach-session response. */
|
|
224
|
+
export const ATTACH_SESSION_CONFORMANCE: readonly AttachSessionConformanceVector[] = [
|
|
225
|
+
{ name: 'accepts exact non-expiring session id', response: ATTACH_RESPONSE, accepts: true },
|
|
226
|
+
{
|
|
227
|
+
name: 'rejects retired expires_at field',
|
|
228
|
+
response: {
|
|
229
|
+
...ATTACH_RESPONSE,
|
|
230
|
+
session: { ...ATTACH_RESPONSE.session, expires_at: '2026-07-18T15:00:00.000Z' },
|
|
231
|
+
},
|
|
232
|
+
accepts: false,
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name: 'rejects session fields beyond id',
|
|
236
|
+
response: { ...ATTACH_RESPONSE, session: { ...ATTACH_RESPONSE.session, extra: 'value' } },
|
|
237
|
+
accepts: false,
|
|
238
|
+
},
|
|
239
|
+
];
|
package/src/protocol/contract.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ErrorCode } from './errors.js';
|
|
|
2
2
|
import { PROTOCOL_VERSION, type ProtocolVersion } from './version.js';
|
|
3
3
|
|
|
4
4
|
export const SHARED_PACKAGE_NAME = 'borgmcp-shared' as const;
|
|
5
|
-
export const SHARED_PACKAGE_VERSION = '0.
|
|
5
|
+
export const SHARED_PACKAGE_VERSION = '0.5.1' as const;
|
|
6
6
|
|
|
7
7
|
export const HEALTH_PATH = '/healthz' as const;
|
|
8
8
|
export const PROTOCOL_INFO_PATH = '/api/protocol' as const;
|
|
@@ -607,7 +607,7 @@ export function maxLogCursor(a: LogCursor | null, b: LogCursor | null): LogCurso
|
|
|
607
607
|
return compareLogCursor(a, b) >= 0 ? decodeLogCursor(a) : decodeLogCursor(b);
|
|
608
608
|
}
|
|
609
609
|
|
|
610
|
-
// ──
|
|
610
|
+
// ── v3 clean-slate wire types ──────────────────────────────────────────────
|
|
611
611
|
|
|
612
612
|
export const ATTACH_PATH = '/api/client/attach' as const;
|
|
613
613
|
|
|
@@ -639,7 +639,6 @@ export interface AttachDrone {
|
|
|
639
639
|
|
|
640
640
|
export interface AttachSession {
|
|
641
641
|
id: string;
|
|
642
|
-
expires_at: string;
|
|
643
642
|
}
|
|
644
643
|
|
|
645
644
|
export interface AttachResponse {
|
|
@@ -692,15 +691,14 @@ function decodeAttachDrone(value: unknown, path: readonly (string | number)[]):
|
|
|
692
691
|
|
|
693
692
|
function decodeAttachSession(value: unknown, path: readonly (string | number)[]): AttachSession {
|
|
694
693
|
const input = record(value, path);
|
|
695
|
-
exactKeys(input, ['id'
|
|
694
|
+
exactKeys(input, ['id'], ['id'], path);
|
|
696
695
|
return {
|
|
697
696
|
id: decodeUuid(input.id, [...path, 'id']),
|
|
698
|
-
expires_at: decodeCanonicalTimestamp(input.expires_at, [...path, 'expires_at']),
|
|
699
697
|
};
|
|
700
698
|
}
|
|
701
699
|
|
|
702
700
|
/**
|
|
703
|
-
* Decode a
|
|
701
|
+
* Decode a v3 attach request. Strict: exact keys, bounded sizes,
|
|
704
702
|
* session_credential is token-safe and never echoed in errors.
|
|
705
703
|
*/
|
|
706
704
|
export function decodeAttachRequest(value: unknown): AttachRequest {
|
|
@@ -722,7 +720,7 @@ export function decodeAttachRequest(value: unknown): AttachRequest {
|
|
|
722
720
|
}
|
|
723
721
|
|
|
724
722
|
/**
|
|
725
|
-
* Create a
|
|
723
|
+
* Create a v3 attach request envelope. Stamps the canonical protocol version.
|
|
726
724
|
*/
|
|
727
725
|
export function createAttachRequestEnvelope(
|
|
728
726
|
requestId: string,
|
|
@@ -736,7 +734,7 @@ export function createAttachRequestEnvelope(
|
|
|
736
734
|
}
|
|
737
735
|
|
|
738
736
|
/**
|
|
739
|
-
* Decode a
|
|
737
|
+
* Decode a v3 attach request envelope. Verifies protocol_version === PROTOCOL_VERSION
|
|
740
738
|
* BEFORE decoding the payload — a wrong tag never invokes the payload decoder
|
|
741
739
|
* and never exposes or returns the supplied session_credential.
|
|
742
740
|
* Uses a static token-safe diagnostic; does not interpolate attacker-controlled text.
|
|
@@ -766,8 +764,7 @@ export function decodeAttachRequestEnvelope(
|
|
|
766
764
|
}
|
|
767
765
|
|
|
768
766
|
/**
|
|
769
|
-
* Decode a
|
|
770
|
-
* expires_at required non-null finite ISO-8601.
|
|
767
|
+
* Decode a v3 attach response. Strict: exact keys and result discriminant.
|
|
771
768
|
*/
|
|
772
769
|
export function decodeAttachResponse(value: unknown): AttachResponse {
|
|
773
770
|
const input = record(value);
|
|
@@ -791,7 +788,7 @@ export function decodeAttachResponse(value: unknown): AttachResponse {
|
|
|
791
788
|
}
|
|
792
789
|
|
|
793
790
|
/**
|
|
794
|
-
* Decode a
|
|
791
|
+
* Decode a v3 attach response wrapped in a ProtocolEnvelope.
|
|
795
792
|
* Verifies protocol_version === PROTOCOL_VERSION before decoding payload.
|
|
796
793
|
*/
|
|
797
794
|
export function decodeAttachResponseEnvelope(value: unknown): ProtocolEnvelope<AttachResponse> {
|
package/src/protocol/version.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Current Borg coordination protocol generation. Clean-slate
|
|
2
|
-
export const PROTOCOL_VERSION = '
|
|
1
|
+
/** Current Borg coordination protocol generation. Clean-slate v3. */
|
|
2
|
+
export const PROTOCOL_VERSION = '3' as const;
|
|
3
3
|
|
|
4
4
|
export type ProtocolVersion = typeof PROTOCOL_VERSION;
|