@cleocode/contracts 2026.10.4 → 2026.10.5-rc.ci.672
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/dist/__tests__/cloud-replica-retirement.test.d.ts +10 -0
- package/dist/__tests__/cloud-replica-retirement.test.d.ts.map +1 -0
- package/dist/__tests__/cloud-replica-retirement.test.js +111 -0
- package/dist/__tests__/cloud-replica-retirement.test.js.map +1 -0
- package/dist/__tests__/cloud-status-checkpoint-reads.test.d.ts +10 -0
- package/dist/__tests__/cloud-status-checkpoint-reads.test.d.ts.map +1 -0
- package/dist/__tests__/cloud-status-checkpoint-reads.test.js +49 -0
- package/dist/__tests__/cloud-status-checkpoint-reads.test.js.map +1 -0
- package/dist/agent-registry.d.ts +5 -1
- package/dist/agent-registry.d.ts.map +1 -1
- package/dist/cloud/api.d.ts +156 -0
- package/dist/cloud/api.d.ts.map +1 -1
- package/dist/cloud/api.js +99 -1
- package/dist/cloud/api.js.map +1 -1
- package/dist/cloud/envelope.d.ts +3 -3
- package/dist/dispatch/operations-registry.js +1 -1
- package/dist/dispatch/operations-registry.js.map +1 -1
- package/dist/doctor.d.ts +76 -3
- package/dist/doctor.d.ts.map +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/invariants/sync-write-invariants.d.ts.map +1 -1
- package/dist/invariants/sync-write-invariants.js +31 -6
- package/dist/invariants/sync-write-invariants.js.map +1 -1
- package/dist/ledger/index.d.ts +211 -0
- package/dist/ledger/index.d.ts.map +1 -0
- package/dist/ledger/index.js +122 -0
- package/dist/ledger/index.js.map +1 -0
- package/dist/nexus-account.d.ts +9 -0
- package/dist/nexus-account.d.ts.map +1 -1
- package/dist/nexus-cloud.d.ts +171 -0
- package/dist/nexus-cloud.d.ts.map +1 -1
- package/dist/nexus-cloud.js +10 -0
- package/dist/nexus-cloud.js.map +1 -1
- package/dist/nexus-vault.d.ts +113 -1
- package/dist/nexus-vault.d.ts.map +1 -1
- package/dist/nexus-vault.js +27 -0
- package/dist/nexus-vault.js.map +1 -1
- package/dist/operations/admin.d.ts +14 -1
- package/dist/operations/admin.d.ts.map +1 -1
- package/dist/operations/docs-lifecycle.d.ts +23 -0
- package/dist/operations/docs-lifecycle.d.ts.map +1 -0
- package/dist/operations/docs-lifecycle.js +29 -0
- package/dist/operations/docs-lifecycle.js.map +1 -0
- package/dist/operations/docs.d.ts +2 -11
- package/dist/operations/docs.d.ts.map +1 -1
- package/dist/operations/docs.js +3 -17
- package/dist/operations/docs.js.map +1 -1
- package/dist/project-context.d.ts +7 -0
- package/dist/project-context.d.ts.map +1 -1
- package/dist/release/evidence-atoms.d.ts +15 -7
- package/dist/release/evidence-atoms.d.ts.map +1 -1
- package/dist/release/evidence-atoms.js +16 -12
- package/dist/release/evidence-atoms.js.map +1 -1
- package/dist/resource-governor.d.ts +39 -0
- package/dist/resource-governor.d.ts.map +1 -1
- package/dist/resource-governor.js.map +1 -1
- package/dist/row-identity.d.ts +81 -0
- package/dist/row-identity.d.ts.map +1 -1
- package/dist/store-restore.d.ts +66 -0
- package/dist/store-restore.d.ts.map +1 -0
- package/dist/store-restore.js +9 -0
- package/dist/store-restore.js.map +1 -0
- package/dist/task.d.ts +6 -0
- package/dist/task.d.ts.map +1 -1
- package/package.json +6 -2
- package/src/__tests__/cloud-replica-retirement.test.ts +135 -0
- package/src/__tests__/cloud-status-checkpoint-reads.test.ts +60 -0
- package/src/agent-registry.ts +5 -1
- package/src/cloud/api.ts +125 -1
- package/src/dispatch/operations-registry.ts +1 -1
- package/src/doctor.ts +82 -3
- package/src/index.ts +33 -0
- package/src/invariants/sync-write-invariants.ts +81 -42
- package/src/ledger/index.ts +141 -0
- package/src/nexus-account.ts +9 -0
- package/src/nexus-cloud.ts +186 -0
- package/src/nexus-vault.ts +124 -1
- package/src/operations/admin.ts +14 -1
- package/src/operations/conduit.ts +1 -1
- package/src/operations/docs-lifecycle.ts +31 -0
- package/src/operations/docs.ts +4 -19
- package/src/project-context.ts +7 -0
- package/src/release/evidence-atoms.ts +16 -12
- package/src/resource-governor.ts +40 -0
- package/src/row-identity.ts +98 -0
- package/src/store-restore.ts +70 -0
- package/src/task.ts +6 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloud contract mirror of cleo-nexus #41 (T123 replica retirement, contract
|
|
3
|
+
* v2.28; T13284): the E31 request and answer, the stored retirement, and the
|
|
4
|
+
* `retiredAt` / `successor` fields home replicas gain, as the server validates
|
|
5
|
+
* them.
|
|
6
|
+
*
|
|
7
|
+
* @task T13284
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=cloud-replica-retirement.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-replica-retirement.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/cloud-replica-retirement.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloud contract mirror of cleo-nexus #41 (T123 replica retirement, contract
|
|
3
|
+
* v2.28; T13284): the E31 request and answer, the stored retirement, and the
|
|
4
|
+
* `retiredAt` / `successor` fields home replicas gain, as the server validates
|
|
5
|
+
* them.
|
|
6
|
+
*
|
|
7
|
+
* @task T13284
|
|
8
|
+
*/
|
|
9
|
+
import { describe, expect, it } from 'vitest';
|
|
10
|
+
import { AttachHomeReplicaResult, HomeReplica, ListHomeReplicasResult, ReplicaRetirement, RetireReplicaRequest, RetireReplicaResult, } from '../cloud/index.js';
|
|
11
|
+
import { NEXUS_REPLICA_RETIREMENT_REASONS } from '../nexus-vault.js';
|
|
12
|
+
const DEVICE = '0192f1c2-7d3e-4abc-8def-0000000000b0';
|
|
13
|
+
const R1 = '0192f1c2-7d3e-7abc-8def-0000000000a1';
|
|
14
|
+
const R2 = '0192f1c2-7d3e-7abc-8def-0000000000b1';
|
|
15
|
+
const STREAM = 'project:0192f1c2-7d3e-7abc-8def-0123456789ab';
|
|
16
|
+
const SIG = Buffer.alloc(64, 7).toString('base64');
|
|
17
|
+
const request = {
|
|
18
|
+
deviceId: DEVICE,
|
|
19
|
+
successor: R2,
|
|
20
|
+
lastReplicaSeq: 4,
|
|
21
|
+
txnId: `${R1}:17`,
|
|
22
|
+
signature: SIG,
|
|
23
|
+
};
|
|
24
|
+
describe('RetireReplicaRequest (T13284)', () => {
|
|
25
|
+
it('takes a successor, lastReplicaSeq and txn id, each nullable', () => {
|
|
26
|
+
expect(RetireReplicaRequest.safeParse(request).success).toBe(true);
|
|
27
|
+
expect(RetireReplicaRequest.safeParse({
|
|
28
|
+
...request,
|
|
29
|
+
successor: null,
|
|
30
|
+
lastReplicaSeq: null,
|
|
31
|
+
txnId: null,
|
|
32
|
+
}).success).toBe(true);
|
|
33
|
+
});
|
|
34
|
+
it('refuses a negative or fractional lastReplicaSeq and a malformed txn id', () => {
|
|
35
|
+
expect(RetireReplicaRequest.safeParse({ ...request, lastReplicaSeq: -1 }).success).toBe(false);
|
|
36
|
+
expect(RetireReplicaRequest.safeParse({ ...request, lastReplicaSeq: 1.5 }).success).toBe(false);
|
|
37
|
+
for (const txnId of [
|
|
38
|
+
R1,
|
|
39
|
+
`${R1}:`,
|
|
40
|
+
`${R1}:01`,
|
|
41
|
+
`${R1}:-1`,
|
|
42
|
+
`not-a-uuid:3`,
|
|
43
|
+
`${R1}:12345678901234567`,
|
|
44
|
+
]) {
|
|
45
|
+
expect(RetireReplicaRequest.safeParse({ ...request, txnId }).success).toBe(false);
|
|
46
|
+
}
|
|
47
|
+
// Any UUID may emit the transaction (the successor on a rebind), not only a v7 replica id.
|
|
48
|
+
expect(RetireReplicaRequest.safeParse({ ...request, txnId: `${DEVICE}:0` }).success).toBe(true);
|
|
49
|
+
});
|
|
50
|
+
it('a successor must be a replica id (UUIDv7)', () => {
|
|
51
|
+
expect(RetireReplicaRequest.safeParse({ ...request, successor: DEVICE }).success).toBe(false);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
describe('ReplicaRetirement and RetireReplicaResult (T13284)', () => {
|
|
55
|
+
const stored = {
|
|
56
|
+
streamId: STREAM,
|
|
57
|
+
replicaId: R1,
|
|
58
|
+
successor: R2,
|
|
59
|
+
lastReplicaSeq: null,
|
|
60
|
+
signerDeviceId: DEVICE,
|
|
61
|
+
txnId: null,
|
|
62
|
+
signature: SIG,
|
|
63
|
+
retiredAt: '2026-10-06T07:00:00.000Z',
|
|
64
|
+
};
|
|
65
|
+
it('is the stored record, wrapped as { retirement }', () => {
|
|
66
|
+
expect(ReplicaRetirement.safeParse(stored).success).toBe(true);
|
|
67
|
+
expect(RetireReplicaResult.safeParse({ retirement: stored }).success).toBe(true);
|
|
68
|
+
expect(RetireReplicaResult.safeParse(stored).success).toBe(false);
|
|
69
|
+
const { retiredAt: _retiredAt, ...undated } = stored;
|
|
70
|
+
expect(ReplicaRetirement.safeParse(undated).success).toBe(false);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
describe('home replicas carry retiredAt and successor (T13284)', () => {
|
|
74
|
+
const replica = {
|
|
75
|
+
replicaId: R1,
|
|
76
|
+
deviceId: DEVICE,
|
|
77
|
+
deviceState: 'active',
|
|
78
|
+
attachedAt: '2026-10-01T00:00:00.000Z',
|
|
79
|
+
lastSyncAt: null,
|
|
80
|
+
presence: null,
|
|
81
|
+
presenceAt: null,
|
|
82
|
+
};
|
|
83
|
+
it('parses an older server without them, and a retired replica with them', () => {
|
|
84
|
+
expect(HomeReplica.safeParse(replica).success).toBe(true);
|
|
85
|
+
const retired = { ...replica, retiredAt: '2026-10-06T07:00:00.000Z', successor: R2 };
|
|
86
|
+
expect(HomeReplica.parse(retired)).toMatchObject({
|
|
87
|
+
retiredAt: retired.retiredAt,
|
|
88
|
+
successor: R2,
|
|
89
|
+
});
|
|
90
|
+
expect(HomeReplica.safeParse({ ...replica, retiredAt: null, successor: null }).success).toBe(true);
|
|
91
|
+
expect(HomeReplica.safeParse({ ...replica, successor: DEVICE }).success).toBe(false);
|
|
92
|
+
});
|
|
93
|
+
it('the attach answer and the list follow HomeReplica', () => {
|
|
94
|
+
expect(AttachHomeReplicaResult).toBe(HomeReplica);
|
|
95
|
+
expect(ListHomeReplicasResult.shape.replicas.element).toBe(HomeReplica);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
describe('E31 refusal reasons (T13284)', () => {
|
|
99
|
+
it('are the seven server reasons', () => {
|
|
100
|
+
expect([...NEXUS_REPLICA_RETIREMENT_REASONS].sort()).toEqual([
|
|
101
|
+
'not-pinned-or-owner',
|
|
102
|
+
'replica-retired',
|
|
103
|
+
'retire-below-head',
|
|
104
|
+
'retired',
|
|
105
|
+
'successor-other-user',
|
|
106
|
+
'successor-retired',
|
|
107
|
+
'successor-taken',
|
|
108
|
+
].sort());
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
//# sourceMappingURL=cloud-replica-retirement.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-replica-retirement.test.js","sourceRoot":"","sources":["../../src/__tests__/cloud-replica-retirement.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,uBAAuB,EACvB,WAAW,EACX,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAErE,MAAM,MAAM,GAAG,sCAAsC,CAAC;AACtD,MAAM,EAAE,GAAG,sCAAsC,CAAC;AAClD,MAAM,EAAE,GAAG,sCAAsC,CAAC;AAClD,MAAM,MAAM,GAAG,8CAA8C,CAAC;AAC9D,MAAM,GAAG,GAAG,MAAM,C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ACvF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC3D,MAAM,CAAC,uBAAuB,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAClD,MAAM,CAAC,sBAAsB,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC5C,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC,MAAM,CAAC,CAAC,GAAG,gCAAgC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAC1D;YACE,qBAAqB;YACrB,iBAAiB;YACjB,mBAAmB;YACnB,SAAS;YACT,sBAAsB;YACtB,mBAAmB;YACnB,iBAAiB;SAClB,CAAC,IAAI,EAAE,CACT,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloud contract mirrors of cleo-nexus #38 (`DeviceScope`, `StatusQuery`;
|
|
3
|
+
* T13282) and #39 (`GetCheckpointResult`; T13283): the shapes the server
|
|
4
|
+
* validates, so a client that parses with them agrees with it.
|
|
5
|
+
*
|
|
6
|
+
* @task T13282
|
|
7
|
+
* @task T13283
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=cloud-status-checkpoint-reads.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-status-checkpoint-reads.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/cloud-status-checkpoint-reads.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloud contract mirrors of cleo-nexus #38 (`DeviceScope`, `StatusQuery`;
|
|
3
|
+
* T13282) and #39 (`GetCheckpointResult`; T13283): the shapes the server
|
|
4
|
+
* validates, so a client that parses with them agrees with it.
|
|
5
|
+
*
|
|
6
|
+
* @task T13282
|
|
7
|
+
* @task T13283
|
|
8
|
+
*/
|
|
9
|
+
import { describe, expect, it } from 'vitest';
|
|
10
|
+
import { DeviceScope, GetCheckpointResult, ListCheckpointsResult, StatusQuery, } from '../cloud/index.js';
|
|
11
|
+
const PROJECT = '0190a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b';
|
|
12
|
+
const REPLICA = '0198a1b2-0000-7000-8000-0000000000a1';
|
|
13
|
+
describe('DeviceScope and StatusQuery (T13282)', () => {
|
|
14
|
+
it('DeviceScope is the eight §2.3 scopes and nothing else', () => {
|
|
15
|
+
expect(DeviceScope.options).toEqual([
|
|
16
|
+
'account:read',
|
|
17
|
+
'devices:read',
|
|
18
|
+
'projects:read',
|
|
19
|
+
'projects:write',
|
|
20
|
+
'sync:read',
|
|
21
|
+
'sync:write',
|
|
22
|
+
'keys:read',
|
|
23
|
+
'keys:write',
|
|
24
|
+
]);
|
|
25
|
+
expect(DeviceScope.safeParse('admin').success).toBe(false);
|
|
26
|
+
});
|
|
27
|
+
it('StatusQuery: both optional, replicaId requires projectId and must be a UUIDv7', () => {
|
|
28
|
+
expect(StatusQuery.safeParse({}).success).toBe(true);
|
|
29
|
+
expect(StatusQuery.safeParse({ projectId: PROJECT }).success).toBe(true);
|
|
30
|
+
expect(StatusQuery.safeParse({ projectId: PROJECT, replicaId: REPLICA }).success).toBe(true);
|
|
31
|
+
const orphan = StatusQuery.safeParse({ replicaId: REPLICA });
|
|
32
|
+
expect(orphan.success).toBe(false);
|
|
33
|
+
expect(orphan.error?.issues[0]?.message).toBe('replicaId requires projectId');
|
|
34
|
+
// A UUIDv4 is not a replica id.
|
|
35
|
+
expect(StatusQuery.safeParse({
|
|
36
|
+
projectId: PROJECT,
|
|
37
|
+
replicaId: '0198a1b2-0000-4000-8000-0000000000a1',
|
|
38
|
+
}).success).toBe(false);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
describe('GetCheckpointResult (T13283)', () => {
|
|
42
|
+
it('is one checkpoint shaped exactly as a list item', () => {
|
|
43
|
+
const listItem = ListCheckpointsResult.shape.checkpoints.element;
|
|
44
|
+
expect(GetCheckpointResult.shape.checkpoint).toBe(listItem);
|
|
45
|
+
expect(Object.keys(GetCheckpointResult.shape)).toEqual(['checkpoint']);
|
|
46
|
+
expect(GetCheckpointResult.safeParse({ checkpoints: [] }).success).toBe(false);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=cloud-status-checkpoint-reads.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-status-checkpoint-reads.test.js","sourceRoot":"","sources":["../../src/__tests__/cloud-status-checkpoint-reads.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAE3B,MAAM,OAAO,GAAG,sCAAsC,CAAC;AACvD,MAAM,OAAO,GAAG,sCAAsC,CAAC;AAEvD,QAAQ,CAAC,sCAAsC,EAAE,GAAG,EAAE;IACpD,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;QAC/D,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;YAClC,cAAc;YACd,cAAc;YACd,eAAe;YACf,gBAAgB;YAChB,WAAW;YACX,YAAY;YACZ,WAAW;YACX,YAAY;SACb,CAAC,CAAC;QACH,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7D,CAAC,CAAC,CA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,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;QACvE,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/agent-registry.d.ts
CHANGED
|
@@ -37,7 +37,11 @@ export interface AgentCredential {
|
|
|
37
37
|
* device). Re-register with `cleo agent register --id <id> --api-key <key>`.
|
|
38
38
|
*/
|
|
39
39
|
requiresReauth?: boolean;
|
|
40
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Base URL of the cloud messaging API, or `'local'` for none. Rows from
|
|
42
|
+
* before T13169 may still hold the retired `https://api.signaldock.io`;
|
|
43
|
+
* CLEO never calls a SignalDock host.
|
|
44
|
+
*/
|
|
41
45
|
apiBaseUrl: string;
|
|
42
46
|
/** Agent classification from the registry (e.g. 'code_dev', 'orchestrator'). */
|
|
43
47
|
classification?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-registry.d.ts","sourceRoot":"","sources":["../src/agent-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,oEAAoE;AACpE,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAMD,oDAAoD;AACpD,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB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AEvC,mFAAmF;IACnF,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAE5E,gFAAgF;IAChF,SAAS,IAAI,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;IAE7C,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1C"}
|
package/dist/cloud/api.d.ts
CHANGED
|
@@ -81,12 +81,45 @@ export declare const ListDevicesResult: z.ZodObject<{
|
|
|
81
81
|
}, z.core.$strip>>;
|
|
82
82
|
}, z.core.$strip>;
|
|
83
83
|
export type ListDevicesResult = z.infer<typeof ListDevicesResult>;
|
|
84
|
+
/** What a device credential may do (§2.3). A signed-in session holds every scope. */
|
|
85
|
+
export declare const DeviceScope: z.ZodEnum<{
|
|
86
|
+
"account:read": "account:read";
|
|
87
|
+
"devices:read": "devices:read";
|
|
88
|
+
"projects:read": "projects:read";
|
|
89
|
+
"projects:write": "projects:write";
|
|
90
|
+
"sync:read": "sync:read";
|
|
91
|
+
"sync:write": "sync:write";
|
|
92
|
+
"keys:read": "keys:read";
|
|
93
|
+
"keys:write": "keys:write";
|
|
94
|
+
}>;
|
|
95
|
+
/** One device credential scope. */
|
|
96
|
+
export type DeviceScope = z.infer<typeof DeviceScope>;
|
|
97
|
+
/** E3 `GET /v1/status` query (§4.1): `replicaId` (a UUIDv7) requires `projectId`. */
|
|
98
|
+
export declare const StatusQuery: z.ZodObject<{
|
|
99
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
100
|
+
replicaId: z.ZodOptional<z.ZodString>;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
/** The E3 status query. */
|
|
103
|
+
export type StatusQuery = z.infer<typeof StatusQuery>;
|
|
104
|
+
/**
|
|
105
|
+
* A new project's first data key, stored in the same transaction as its registration (onboarding B): key
|
|
106
|
+
* version 1, wrapped by the registrant's account master key. Needs keys:write on top of projects:write, and is
|
|
107
|
+
* honoured only when the call creates the project. Later versions stay rotations
|
|
108
|
+
* (PUT /v1/projects/:projectId/keys/:userId).
|
|
109
|
+
*/
|
|
110
|
+
export declare const InitialProjectKey: z.ZodObject<{
|
|
111
|
+
wrappedProjectKey: z.ZodString;
|
|
112
|
+
}, z.core.$strip>;
|
|
113
|
+
export type InitialProjectKey = z.infer<typeof InitialProjectKey>;
|
|
84
114
|
export declare const RegisterProjectRequest: z.ZodObject<{
|
|
85
115
|
projectId: z.ZodString;
|
|
86
116
|
label: z.ZodOptional<z.ZodString>;
|
|
87
117
|
encryptedName: z.ZodOptional<z.ZodString>;
|
|
88
118
|
remoteUrl: z.ZodOptional<z.ZodString>;
|
|
89
119
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
120
|
+
initialKey: z.ZodOptional<z.ZodObject<{
|
|
121
|
+
wrappedProjectKey: z.ZodString;
|
|
122
|
+
}, z.core.$strip>>;
|
|
90
123
|
}, z.core.$strip>;
|
|
91
124
|
export type RegisterProjectRequest = z.infer<typeof RegisterProjectRequest>;
|
|
92
125
|
export declare const Project: z.ZodObject<{
|
|
@@ -110,6 +143,7 @@ export declare const RegisterProjectResult: z.ZodObject<{
|
|
|
110
143
|
createdAt: z.ZodISODateTime;
|
|
111
144
|
}, z.core.$strip>;
|
|
112
145
|
streamId: z.ZodString;
|
|
146
|
+
initialKeyVersion: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
113
147
|
}, z.core.$strip>;
|
|
114
148
|
export type RegisterProjectResult = z.infer<typeof RegisterProjectResult>;
|
|
115
149
|
/**
|
|
@@ -186,6 +220,8 @@ export declare const HomeReplica: z.ZodObject<{
|
|
|
186
220
|
observedAt: z.ZodISODateTime;
|
|
187
221
|
}, z.core.$strip>>;
|
|
188
222
|
presenceAt: z.ZodNullable<z.ZodISODateTime>;
|
|
223
|
+
retiredAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
224
|
+
successor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
189
225
|
}, z.core.$strip>;
|
|
190
226
|
export type HomeReplica = z.infer<typeof HomeReplica>;
|
|
191
227
|
/**
|
|
@@ -223,6 +259,8 @@ export declare const AttachHomeReplicaResult: z.ZodObject<{
|
|
|
223
259
|
observedAt: z.ZodISODateTime;
|
|
224
260
|
}, z.core.$strip>>;
|
|
225
261
|
presenceAt: z.ZodNullable<z.ZodISODateTime>;
|
|
262
|
+
retiredAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
263
|
+
successor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
226
264
|
}, z.core.$strip>;
|
|
227
265
|
export type AttachHomeReplicaResult = z.infer<typeof AttachHomeReplicaResult>;
|
|
228
266
|
/** `PUT /v1/account/home/replicas/:replicaId/presence` (body: ReplicaPresence). */
|
|
@@ -264,6 +302,8 @@ export declare const ListHomeReplicasResult: z.ZodObject<{
|
|
|
264
302
|
observedAt: z.ZodISODateTime;
|
|
265
303
|
}, z.core.$strip>>;
|
|
266
304
|
presenceAt: z.ZodNullable<z.ZodISODateTime>;
|
|
305
|
+
retiredAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
306
|
+
successor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
267
307
|
}, z.core.$strip>>;
|
|
268
308
|
}, z.core.$strip>;
|
|
269
309
|
export type ListHomeReplicasResult = z.infer<typeof ListHomeReplicasResult>;
|
|
@@ -770,6 +810,79 @@ export declare const ListCheckpointsResult: z.ZodObject<{
|
|
|
770
810
|
}, z.core.$strip>>;
|
|
771
811
|
}, z.core.$strip>;
|
|
772
812
|
export type ListCheckpointsResult = z.infer<typeof ListCheckpointsResult>;
|
|
813
|
+
/**
|
|
814
|
+
* E29 `GET …/checkpoints/head` and E30 `GET …/checkpoints/:checkpointId` (cleo-nexus T122, contract
|
|
815
|
+
* v2.27): one checkpoint, shaped as a list item. Both answer 404 when there is no head, or the id is
|
|
816
|
+
* unknown, malformed or on another stream.
|
|
817
|
+
*/
|
|
818
|
+
export declare const GetCheckpointResult: z.ZodObject<{
|
|
819
|
+
checkpoint: z.ZodObject<{
|
|
820
|
+
checkpointId: z.ZodString;
|
|
821
|
+
streamId: z.ZodString;
|
|
822
|
+
parentCheckpointId: z.ZodNullable<z.ZodString>;
|
|
823
|
+
replicaId: z.ZodString;
|
|
824
|
+
deviceId: z.ZodString;
|
|
825
|
+
coversSeq: z.ZodNumber;
|
|
826
|
+
manifest: z.ZodObject<{
|
|
827
|
+
schemaVersion: z.ZodNumber;
|
|
828
|
+
tables: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
829
|
+
rows: z.ZodNumber;
|
|
830
|
+
hash: z.ZodString;
|
|
831
|
+
}, z.core.$strip>>;
|
|
832
|
+
pending: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
833
|
+
replicaId: z.ZodString;
|
|
834
|
+
replicaSeq: z.ZodNumber;
|
|
835
|
+
txn: z.ZodNumber;
|
|
836
|
+
}, z.core.$strip>>>;
|
|
837
|
+
voided: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
838
|
+
ref: z.ZodObject<{
|
|
839
|
+
replicaId: z.ZodString;
|
|
840
|
+
replicaSeq: z.ZodNumber;
|
|
841
|
+
txn: z.ZodNumber;
|
|
842
|
+
}, z.core.$strip>;
|
|
843
|
+
deltas: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
844
|
+
created: z.ZodNumber;
|
|
845
|
+
deleted: z.ZodNumber;
|
|
846
|
+
}, z.core.$strip>>;
|
|
847
|
+
}, z.core.$strip>>>;
|
|
848
|
+
revived: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
849
|
+
ref: z.ZodObject<{
|
|
850
|
+
replicaId: z.ZodString;
|
|
851
|
+
replicaSeq: z.ZodNumber;
|
|
852
|
+
txn: z.ZodNumber;
|
|
853
|
+
}, z.core.$strip>;
|
|
854
|
+
deltas: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
855
|
+
created: z.ZodNumber;
|
|
856
|
+
deleted: z.ZodNumber;
|
|
857
|
+
}, z.core.$strip>>;
|
|
858
|
+
}, z.core.$strip>>>;
|
|
859
|
+
pruned: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
860
|
+
replayPin: z.ZodOptional<z.ZodObject<{
|
|
861
|
+
journal: z.ZodString;
|
|
862
|
+
triggerSetHash: z.ZodString;
|
|
863
|
+
transitions: z.ZodArray<z.ZodObject<{
|
|
864
|
+
seq: z.ZodNumber;
|
|
865
|
+
schemaVersion: z.ZodNumber;
|
|
866
|
+
journal: z.ZodString;
|
|
867
|
+
}, z.core.$strip>>;
|
|
868
|
+
}, z.core.$strip>>;
|
|
869
|
+
}, z.core.$strip>;
|
|
870
|
+
replicas: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
871
|
+
deviceId: z.ZodString;
|
|
872
|
+
lastReplicaSeq: z.ZodNumber;
|
|
873
|
+
}, z.core.$strip>>;
|
|
874
|
+
blobSha256: z.ZodString;
|
|
875
|
+
sizeBytes: z.ZodNumber;
|
|
876
|
+
signature: z.ZodString;
|
|
877
|
+
endorsements: z.ZodArray<z.ZodObject<{
|
|
878
|
+
deviceId: z.ZodString;
|
|
879
|
+
signature: z.ZodString;
|
|
880
|
+
}, z.core.$strip>>;
|
|
881
|
+
createdAt: z.ZodISODateTime;
|
|
882
|
+
}, z.core.$strip>;
|
|
883
|
+
}, z.core.$strip>;
|
|
884
|
+
/** One checkpoint read by id or as the head. */
|
|
885
|
+
export type GetCheckpointResult = z.infer<typeof GetCheckpointResult>;
|
|
773
886
|
export declare const PresignUploadRequest: z.ZodObject<{
|
|
774
887
|
sha256: z.ZodString;
|
|
775
888
|
sizeBytes: z.ZodNumber;
|
|
@@ -879,6 +992,49 @@ export declare const ListLeasesResult: z.ZodObject<{
|
|
|
879
992
|
}, z.core.$strip>>;
|
|
880
993
|
}, z.core.$strip>;
|
|
881
994
|
export type ListLeasesResult = z.infer<typeof ListLeasesResult>;
|
|
995
|
+
/**
|
|
996
|
+
* E31 `POST /v1/streams/:streamId/replicas/:replicaId/retirements` (cleo-nexus T123, contract v2.28): the replica
|
|
997
|
+
* writes no segment past `lastReplicaSeq` (none at all when it is null). The journal's own `retire` transaction
|
|
998
|
+
* travels E2E-encrypted; this is the server's signed copy, so it can refuse later appends and show the retirement in
|
|
999
|
+
* the reads.
|
|
1000
|
+
*/
|
|
1001
|
+
export declare const RetireReplicaRequest: z.ZodObject<{
|
|
1002
|
+
deviceId: z.ZodString;
|
|
1003
|
+
successor: z.ZodNullable<z.ZodString>;
|
|
1004
|
+
lastReplicaSeq: z.ZodNullable<z.ZodNumber>;
|
|
1005
|
+
txnId: z.ZodNullable<z.ZodString>;
|
|
1006
|
+
signature: z.ZodString;
|
|
1007
|
+
}, z.core.$strip>;
|
|
1008
|
+
/** The E31 request body. */
|
|
1009
|
+
export type RetireReplicaRequest = z.infer<typeof RetireReplicaRequest>;
|
|
1010
|
+
/** A stored retirement: one per (stream, replica), insert-only. */
|
|
1011
|
+
export declare const ReplicaRetirement: z.ZodObject<{
|
|
1012
|
+
streamId: z.ZodString;
|
|
1013
|
+
replicaId: z.ZodString;
|
|
1014
|
+
successor: z.ZodNullable<z.ZodString>;
|
|
1015
|
+
lastReplicaSeq: z.ZodNullable<z.ZodNumber>;
|
|
1016
|
+
signerDeviceId: z.ZodString;
|
|
1017
|
+
txnId: z.ZodNullable<z.ZodString>;
|
|
1018
|
+
signature: z.ZodString;
|
|
1019
|
+
retiredAt: z.ZodISODateTime;
|
|
1020
|
+
}, z.core.$strip>;
|
|
1021
|
+
/** A stored replica retirement. */
|
|
1022
|
+
export type ReplicaRetirement = z.infer<typeof ReplicaRetirement>;
|
|
1023
|
+
/** 201 for a new retirement, 200 with the stored one for a repeat with the same successor and lastReplicaSeq. */
|
|
1024
|
+
export declare const RetireReplicaResult: z.ZodObject<{
|
|
1025
|
+
retirement: z.ZodObject<{
|
|
1026
|
+
streamId: z.ZodString;
|
|
1027
|
+
replicaId: z.ZodString;
|
|
1028
|
+
successor: z.ZodNullable<z.ZodString>;
|
|
1029
|
+
lastReplicaSeq: z.ZodNullable<z.ZodNumber>;
|
|
1030
|
+
signerDeviceId: z.ZodString;
|
|
1031
|
+
txnId: z.ZodNullable<z.ZodString>;
|
|
1032
|
+
signature: z.ZodString;
|
|
1033
|
+
retiredAt: z.ZodISODateTime;
|
|
1034
|
+
}, z.core.$strip>;
|
|
1035
|
+
}, z.core.$strip>;
|
|
1036
|
+
/** The E31 answer. */
|
|
1037
|
+
export type RetireReplicaResult = z.infer<typeof RetireReplicaResult>;
|
|
882
1038
|
/**
|
|
883
1039
|
* Bounds on Argon2id parameters. The server stores the parameters, so a client must not trust them: too
|
|
884
1040
|
* low weakens the passphrase, too high is a denial of service (a 64 GiB allocation). Both sides enforce these.
|
package/dist/cloud/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/cloud/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;GAMG;AAEH,eAAO,MAAM,WAAW,EAAG,IAAa,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,eAAe,UAAY,CAAC;AAEzC,wFAAwF;AACxF,eAAO,MAAM,UAAU,aAAmD,CAAC;AAE3E,+FAA+F;AAC/F,eAAO,MAAM,wBAAwB,UAAY,CAAC;AAClD,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,6FAA6F;AAC7F,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAC3C,gFAAgF;AAChF,eAAO,MAAM,iBAAiB,SAAU,CAAC;AAIzC,eAAO,MAAM,QAAQ;;;;;EAAgD,CAAC;AAEtE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;iBAShC,CAAC;AACH,MAAM,MAAM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|
|
56
56
|
});
|
|
57
57
|
export const ListDevicesResult = z.object({ devices: z.array(Device) });
|
|
58
|
+
// ---------- device credential scopes and E3 status (§4.1) ----------
|
|
59
|
+
/** What a device credential may do (§2.3). A signed-in session holds every scope. */
|
|
60
|
+
export const DeviceScope = z.enum([
|
|
61
|
+
'account:read',
|
|
62
|
+
'devices:read',
|
|
63
|
+
'projects:read',
|
|
64
|
+
'projects:write',
|
|
65
|
+
'sync:read',
|
|
66
|
+
'sync:write',
|
|
67
|
+
'keys:read',
|
|
68
|
+
'keys:write',
|
|
69
|
+
]);
|
|
70
|
+
/** E3 `GET /v1/status` query (§4.1): `replicaId` (a UUIDv7) requires `projectId`. */
|
|
71
|
+
export const StatusQuery = z
|
|
72
|
+
.object({ projectId: ProjectId.optional(), replicaId: ReplicaId.optional() })
|
|
73
|
+
.refine((q) => q.replicaId === undefined || q.projectId !== undefined, {
|
|
74
|
+
message: 'replicaId requires projectId',
|
|
75
|
+
});
|
|
58
76
|
// ---------- projects ----------
|
|
77
|
+
/**
|
|
78
|
+
* A new project's first data key, stored in the same transaction as its registration (onboarding B): key
|
|
79
|
+
* version 1, wrapped by the registrant's account master key. Needs keys:write on top of projects:write, and is
|
|
80
|
+
* honoured only when the call creates the project. Later versions stay rotations
|
|
81
|
+
* (PUT /v1/projects/:projectId/keys/:userId).
|
|
82
|
+
*/
|
|
83
|
+
export const InitialProjectKey = z.object({
|
|
84
|
+
/** The project data key, wrapped by the registrant's master key at key version 1. */
|
|
85
|
+
wrappedProjectKey: Base64,
|
|
86
|
+
});
|
|
59
87
|
export const RegisterProjectRequest = z.object({
|
|
60
88
|
projectId: ProjectId,
|
|
61
89
|
/**
|
|
@@ -72,6 +100,8 @@ export const RegisterProjectRequest = z.object({
|
|
|
72
100
|
* caller's personal organization, which every account has.
|
|
73
101
|
*/
|
|
74
102
|
organizationId: z.string().uuid().optional(),
|
|
103
|
+
/** The project's first data key (onboarding B). Honoured only when this call creates the project. */
|
|
104
|
+
initialKey: InitialProjectKey.optional(),
|
|
75
105
|
});
|
|
76
106
|
export const Project = z.object({
|
|
77
107
|
projectId: ProjectId,
|
|
@@ -84,7 +114,16 @@ export const Project = z.object({
|
|
|
84
114
|
createdByUserId: z.string().uuid().nullable(),
|
|
85
115
|
createdAt: z.iso.datetime(),
|
|
86
116
|
});
|
|
87
|
-
export const RegisterProjectResult = z.object({
|
|
117
|
+
export const RegisterProjectResult = z.object({
|
|
118
|
+
project: Project,
|
|
119
|
+
streamId: StreamId,
|
|
120
|
+
/**
|
|
121
|
+
* The key version `initialKey` is stored at for the caller: 1 when this call created the project with it,
|
|
122
|
+
* or repeated the caller's identical version 1; null when no initialKey was sent, or the project already
|
|
123
|
+
* existed with no key (initialKey ignored). Absent from servers older than initialKey.
|
|
124
|
+
*/
|
|
125
|
+
initialKeyVersion: KeyVersion.nullable().optional(),
|
|
126
|
+
});
|
|
88
127
|
/**
|
|
89
128
|
* Which devices hold a project. The server stores NO filesystem path, not even as a hint.
|
|
90
129
|
* Paths are per-device local state (cleo-dev review, 2026-09-27).
|
|
@@ -135,6 +174,10 @@ export const HomeReplica = z.object({
|
|
|
135
174
|
lastSyncAt: z.iso.datetime().nullable(),
|
|
136
175
|
presence: ReplicaPresence.nullable(),
|
|
137
176
|
presenceAt: z.iso.datetime().nullable(),
|
|
177
|
+
/** When the replica was retired (T123), else null. Absent from servers older than retirement. */
|
|
178
|
+
retiredAt: z.iso.datetime().nullable().optional(),
|
|
179
|
+
/** The retired replica's named successor, else null (not retired, or retired with none). */
|
|
180
|
+
successor: ReplicaId.nullable().optional(),
|
|
138
181
|
});
|
|
139
182
|
/**
|
|
140
183
|
* `POST /v1/account/home/replicas`: the attached replica, flat like the project attach answer (`replicaId` at the
|
|
@@ -404,6 +447,12 @@ export const EndorseCheckpointRequest = z.object({ deviceId: DeviceId, signature
|
|
|
404
447
|
export const CreateCheckpointResult = z.object({ checkpoint: Checkpoint });
|
|
405
448
|
/** Newest first, at most 100. */
|
|
406
449
|
export const ListCheckpointsResult = z.object({ checkpoints: z.array(Checkpoint) });
|
|
450
|
+
/**
|
|
451
|
+
* E29 `GET …/checkpoints/head` and E30 `GET …/checkpoints/:checkpointId` (cleo-nexus T122, contract
|
|
452
|
+
* v2.27): one checkpoint, shaped as a list item. Both answer 404 when there is no head, or the id is
|
|
453
|
+
* unknown, malformed or on another stream.
|
|
454
|
+
*/
|
|
455
|
+
export const GetCheckpointResult = z.object({ checkpoint: Checkpoint });
|
|
407
456
|
// ---------- blobs ----------
|
|
408
457
|
export const PresignUploadRequest = z.object({
|
|
409
458
|
sha256: Sha256Hex,
|
|
@@ -472,6 +521,55 @@ export const ListedLease = Lease.extend({
|
|
|
472
521
|
});
|
|
473
522
|
/** `GET /v1/streams/:streamId/leases`: the stream's live leases, by role. Expired leases are omitted. */
|
|
474
523
|
export const ListLeasesResult = z.object({ leases: z.array(ListedLease) });
|
|
524
|
+
// ---------- replica retirement (T123; cleocode journal spec §1.3, §3.5 D5) ----------
|
|
525
|
+
/**
|
|
526
|
+
* A journal transaction id, `<emittingReplicaId>:<localTxnSeq>`: the replica that emitted the transaction and its own
|
|
527
|
+
* transaction counter. Only the format is checked: the emitting replica may be the successor (a rebind), not the
|
|
528
|
+
* retired one.
|
|
529
|
+
*/
|
|
530
|
+
const JournalTxnId = z
|
|
531
|
+
.string()
|
|
532
|
+
.regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}:(0|[1-9][0-9]{0,15})$/, 'expected <uuid>:<non-negative integer>');
|
|
533
|
+
/**
|
|
534
|
+
* E31 `POST /v1/streams/:streamId/replicas/:replicaId/retirements` (cleo-nexus T123, contract v2.28): the replica
|
|
535
|
+
* writes no segment past `lastReplicaSeq` (none at all when it is null). The journal's own `retire` transaction
|
|
536
|
+
* travels E2E-encrypted; this is the server's signed copy, so it can refuse later appends and show the retirement in
|
|
537
|
+
* the reads.
|
|
538
|
+
*/
|
|
539
|
+
export const RetireReplicaRequest = z.object({
|
|
540
|
+
/** The signing device. It must be the calling device. */
|
|
541
|
+
deviceId: DeviceId,
|
|
542
|
+
/** The replica that carries on this one's history, or null. Never the retired replica itself. */
|
|
543
|
+
successor: ReplicaId.nullable(),
|
|
544
|
+
/**
|
|
545
|
+
* The replica's last segment: at least its highest appended replicaSeq, and late segments up to it still land. Null
|
|
546
|
+
* when the replica wrote nothing: then no segment of it is stored, and none may land.
|
|
547
|
+
*/
|
|
548
|
+
lastReplicaSeq: z.number().int().nonnegative().nullable(),
|
|
549
|
+
/**
|
|
550
|
+
* The journal transaction that carries the retire (`${emittingReplicaId}:${localTxnSeq}`), or null for an owner's
|
|
551
|
+
* retirement with no journal transaction.
|
|
552
|
+
*/
|
|
553
|
+
txnId: JournalTxnId.nullable(),
|
|
554
|
+
/** Ed25519 by the calling device over replicaRetireMessage(...). */
|
|
555
|
+
signature: Base64,
|
|
556
|
+
});
|
|
557
|
+
/** A stored retirement: one per (stream, replica), insert-only. */
|
|
558
|
+
export const ReplicaRetirement = z.object({
|
|
559
|
+
streamId: StreamId,
|
|
560
|
+
replicaId: ReplicaId,
|
|
561
|
+
successor: ReplicaId.nullable(),
|
|
562
|
+
/** Null: the replica wrote nothing. */
|
|
563
|
+
lastReplicaSeq: z.number().int().nonnegative().nullable(),
|
|
564
|
+
/** The device that signed it: the replica's own, a project owner's, or (home streams) another of the account's. */
|
|
565
|
+
signerDeviceId: DeviceId,
|
|
566
|
+
txnId: JournalTxnId.nullable(),
|
|
567
|
+
/** The signer's Ed25519 over replicaRetireMessage(...), so a client or an auditor can verify the record. */
|
|
568
|
+
signature: Base64,
|
|
569
|
+
retiredAt: z.iso.datetime(),
|
|
570
|
+
});
|
|
571
|
+
/** 201 for a new retirement, 200 with the stored one for a repeat with the same successor and lastReplicaSeq. */
|
|
572
|
+
export const RetireReplicaResult = z.object({ retirement: ReplicaRetirement });
|
|
475
573
|
// ---------- keys (wrapped project keys; the account master key is escrowed on the server, T082: encryption at rest, not end-to-end) ----------
|
|
476
574
|
/**
|
|
477
575
|
* Bounds on Argon2id parameters. The server stores the parameters, so a client must not trust them: too
|