nervur 0.19.2 → 0.20.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/README.md +66 -101
- package/dist/being/being.d.ts +7 -15
- package/dist/being/being.js +16 -67
- package/dist/being/digest.d.ts +1 -1
- package/dist/being/digest.js +7 -27
- package/dist/being/faculty.d.ts +9 -0
- package/dist/being/faculty.js +68 -0
- package/dist/being/index.d.ts +4 -5
- package/dist/being/index.js +5 -5
- package/dist/being/types.d.ts +35 -62
- package/dist/being/types.js +3 -57
- package/dist/being/words.d.ts +13 -0
- package/dist/being/words.js +14 -0
- package/dist/contract/index.d.ts +26 -0
- package/dist/contract/index.js +19 -0
- package/dist/crypto/aes.d.ts +3 -0
- package/dist/crypto/aes.js +24 -0
- package/dist/crypto/bytes.d.ts +6 -0
- package/dist/crypto/bytes.js +33 -0
- package/dist/crypto/ed25519.d.ts +3 -0
- package/dist/crypto/ed25519.js +85 -0
- package/dist/crypto/hash.d.ts +2 -0
- package/dist/crypto/hash.js +11 -0
- package/dist/crypto/index.d.ts +7 -0
- package/dist/crypto/index.js +10 -0
- package/dist/crypto/json.d.ts +8 -0
- package/dist/crypto/json.js +250 -0
- package/dist/crypto/mlkem.d.ts +12 -0
- package/dist/crypto/mlkem.js +36 -0
- package/dist/crypto/subtle.d.ts +10 -0
- package/dist/crypto/subtle.js +29 -0
- package/dist/crypto/x25519.d.ts +2 -0
- package/dist/crypto/x25519.js +21 -0
- package/dist/folder/index.d.ts +13 -0
- package/dist/folder/index.js +125 -0
- package/dist/harbor/dock.d.ts +19 -0
- package/dist/harbor/dock.js +92 -0
- package/dist/harbor/harbor.d.ts +22 -0
- package/dist/harbor/harbor.js +84 -0
- package/dist/harbor/index.d.ts +4 -10
- package/dist/harbor/index.js +5 -18
- package/dist/harbor/registry.d.ts +7 -0
- package/dist/harbor/registry.js +13 -0
- package/dist/harbor/terrain.d.ts +8 -0
- package/dist/harbor/terrain.js +2 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +14 -0
- package/dist/pointer/bodies.d.ts +20 -0
- package/dist/pointer/bodies.js +45 -0
- package/dist/pointer/index.d.ts +2 -0
- package/dist/pointer/index.js +4 -0
- package/dist/pointer/world.d.ts +34 -0
- package/dist/pointer/world.js +76 -0
- package/dist/quo/door.d.ts +34 -0
- package/dist/quo/door.js +172 -0
- package/dist/quo/index.d.ts +8 -0
- package/dist/quo/index.js +11 -0
- package/dist/quo/invitation.d.ts +7 -0
- package/dist/quo/invitation.js +15 -0
- package/dist/quo/keys.d.ts +40 -0
- package/dist/quo/keys.js +79 -0
- package/dist/quo/payload.d.ts +15 -0
- package/dist/quo/payload.js +55 -0
- package/dist/quo/relations.d.ts +40 -0
- package/dist/quo/relations.js +33 -0
- package/dist/quo/reply.d.ts +13 -0
- package/dist/quo/reply.js +35 -0
- package/dist/quo/seal.d.ts +42 -0
- package/dist/quo/seal.js +78 -0
- package/dist/quo/standing.d.ts +39 -0
- package/dist/quo/standing.js +90 -0
- package/dist/ward/allowance.d.ts +13 -9
- package/dist/ward/allowance.js +28 -67
- package/dist/ward/cells.d.ts +6 -6
- package/dist/ward/cells.js +67 -179
- package/dist/ward/index.d.ts +5 -10
- package/dist/ward/index.js +6 -13
- package/dist/ward/partition.d.ts +44 -60
- package/dist/ward/partition.js +56 -285
- package/dist/ward/stance.d.ts +29 -20
- package/dist/ward/stance.js +173 -406
- package/dist/ward/ward-being.d.ts +33 -0
- package/dist/ward/ward-being.js +76 -0
- package/dist/ward/ward.d.ts +43 -11
- package/dist/ward/ward.js +215 -363
- package/package.json +19 -33
- package/src/being/being.ts +31 -78
- package/src/being/digest.ts +7 -35
- package/src/being/faculty.ts +66 -0
- package/src/being/index.ts +5 -6
- package/src/being/types.ts +47 -145
- package/src/being/words.ts +31 -0
- package/src/contract/index.ts +44 -0
- package/src/crypto/aes.ts +26 -0
- package/src/crypto/bytes.ts +37 -0
- package/src/crypto/ed25519.ts +84 -0
- package/src/crypto/hash.ts +14 -0
- package/src/crypto/index.ts +10 -0
- package/src/crypto/json.ts +241 -0
- package/src/crypto/mlkem.ts +38 -0
- package/src/crypto/subtle.ts +33 -0
- package/src/crypto/x25519.ts +21 -0
- package/src/folder/index.ts +134 -0
- package/src/harbor/dock.ts +101 -0
- package/src/harbor/harbor.ts +105 -0
- package/src/harbor/index.ts +5 -19
- package/src/harbor/registry.ts +20 -0
- package/src/harbor/terrain.ts +13 -0
- package/src/index.ts +20 -0
- package/src/pointer/bodies.ts +47 -0
- package/src/pointer/index.ts +4 -0
- package/src/pointer/world.ts +91 -0
- package/src/quo/door.ts +178 -0
- package/src/quo/index.ts +11 -0
- package/src/quo/invitation.ts +15 -0
- package/src/quo/keys.ts +91 -0
- package/src/quo/payload.ts +61 -0
- package/src/quo/relations.ts +62 -0
- package/src/quo/reply.ts +38 -0
- package/src/quo/seal.ts +101 -0
- package/src/quo/standing.ts +111 -0
- package/src/stand/main.ts +19 -0
- package/src/stand/stand.ts +178 -0
- package/src/ward/allowance.ts +37 -75
- package/src/ward/cells.ts +63 -176
- package/src/ward/index.ts +6 -17
- package/src/ward/partition.ts +86 -326
- package/src/ward/stance.ts +185 -420
- package/src/ward/ward-being.ts +97 -0
- package/src/ward/ward.ts +229 -363
- package/dist/being/lent.d.ts +0 -32
- package/dist/being/lent.js +0 -72
- package/dist/being/silence.d.ts +0 -12
- package/dist/being/silence.js +0 -41
- package/dist/conformance/assert.d.ts +0 -11
- package/dist/conformance/assert.js +0 -106
- package/dist/conformance/beings.d.ts +0 -199
- package/dist/conformance/beings.js +0 -188
- package/dist/conformance/estate.d.ts +0 -5
- package/dist/conformance/estate.js +0 -388
- package/dist/conformance/index.d.ts +0 -80
- package/dist/conformance/index.js +0 -819
- package/dist/conformance/reach.d.ts +0 -10
- package/dist/conformance/reach.js +0 -72
- package/dist/conformance/store.d.ts +0 -5
- package/dist/conformance/store.js +0 -113
- package/dist/harbor/box.d.ts +0 -121
- package/dist/harbor/box.js +0 -121
- package/dist/harbor/core.d.ts +0 -55
- package/dist/harbor/core.js +0 -662
- package/dist/harbor/dial.d.ts +0 -9
- package/dist/harbor/dial.js +0 -81
- package/dist/harbor/memory.d.ts +0 -29
- package/dist/harbor/memory.js +0 -104
- package/dist/harbor/reach.d.ts +0 -36
- package/dist/harbor/reach.js +0 -199
- package/dist/harbor/store.d.ts +0 -35
- package/dist/harbor/store.js +0 -62
- package/dist/vector/cases.d.ts +0 -42
- package/dist/vector/cases.js +0 -223
- package/dist/vector/index.d.ts +0 -6
- package/dist/vector/index.js +0 -8
- package/dist/vector/stand.d.ts +0 -9
- package/dist/vector/stand.js +0 -77
- package/dist/vector/world.d.ts +0 -144
- package/dist/vector/world.js +0 -209
- package/dist/ward/arithmetic.d.ts +0 -31
- package/dist/ward/arithmetic.js +0 -249
- package/dist/ward/door.d.ts +0 -18
- package/dist/ward/door.js +0 -186
- package/dist/ward/ground.d.ts +0 -29
- package/dist/ward/ground.js +0 -56
- package/dist/ward/heirs.d.ts +0 -13
- package/dist/ward/heirs.js +0 -117
- package/dist/ward/json.d.ts +0 -2
- package/dist/ward/json.js +0 -163
- package/dist/ward/owner.d.ts +0 -13
- package/dist/ward/owner.js +0 -220
- package/dist/ward/seal.d.ts +0 -52
- package/dist/ward/seal.js +0 -150
- package/src/being/lent.ts +0 -72
- package/src/being/silence.ts +0 -46
- package/src/conformance/assert.ts +0 -100
- package/src/conformance/beings.ts +0 -188
- package/src/conformance/estate.ts +0 -412
- package/src/conformance/index.ts +0 -965
- package/src/conformance/reach.ts +0 -83
- package/src/conformance/store.ts +0 -125
- package/src/harbor/box.ts +0 -131
- package/src/harbor/core.ts +0 -699
- package/src/harbor/dial.ts +0 -112
- package/src/harbor/memory.ts +0 -123
- package/src/harbor/reach.ts +0 -221
- package/src/harbor/store.ts +0 -91
- package/src/vector/cases.ts +0 -257
- package/src/vector/index.ts +0 -11
- package/src/vector/stand.ts +0 -76
- package/src/vector/world.ts +0 -232
- package/src/ward/arithmetic.ts +0 -251
- package/src/ward/door.ts +0 -186
- package/src/ward/ground.ts +0 -142
- package/src/ward/heirs.ts +0 -116
- package/src/ward/json.ts +0 -144
- package/src/ward/owner.ts +0 -214
- package/src/ward/seal.ts +0 -178
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// The ward-being: the first being of every ward, the ward itself. Her asks
|
|
3
|
+
// are the root's, shown and answered to `OWNER` alone.
|
|
4
|
+
import { Being, isSilence, isWord, OWNER, told } from '../being/index.js';
|
|
5
|
+
// Whoever pilots a ward: the root, holding its unsealed ask, or an owner,
|
|
6
|
+
// an occupant of the ward-being the root invited as one.
|
|
7
|
+
export const pilots = (asker, notes) => asker.id === OWNER || notes?.owner === true;
|
|
8
|
+
// An ask whoever pilots the ward may make.
|
|
9
|
+
export const ownerAsk = (description, input = {}) => ({ description, input: { type: 'object', ...input }, for: pilots });
|
|
10
|
+
// An ask the root alone may make, so a carried key pilots but never hands
|
|
11
|
+
// piloting on.
|
|
12
|
+
const rootAsk = (description, input = {}) => ({ description, input: { type: 'object', ...input }, for: (asker) => asker.id === OWNER });
|
|
13
|
+
const text = (v) => typeof v === 'string';
|
|
14
|
+
const object = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
15
|
+
export class WardBeing extends Being {
|
|
16
|
+
static asks = {
|
|
17
|
+
boot: ownerAsk('a new being of this ward', { required: ['key', 'class'] }),
|
|
18
|
+
unboot: ownerAsk('a being out, with every relation she holds', { required: ['being'] }),
|
|
19
|
+
public: ownerAsk('the being a stranger reaches, or none', { required: ['key'] }),
|
|
20
|
+
invite: ownerAsk('an invitation on a being of this ward', { required: ['being', 'id'] }),
|
|
21
|
+
ask: ownerAsk('a being of this ward, asked as the owner; with no being, the public being asked as nobody'),
|
|
22
|
+
own: rootAsk('an invitation for an owner of this ward, under an id', { required: ['id'] }),
|
|
23
|
+
disown: rootAsk('an owner no more', { required: ['id'] }),
|
|
24
|
+
};
|
|
25
|
+
steward;
|
|
26
|
+
constructor(stance) {
|
|
27
|
+
super(stance);
|
|
28
|
+
this.steward = stance.steward;
|
|
29
|
+
}
|
|
30
|
+
describe(asker) {
|
|
31
|
+
const { asks } = super.describe(asker);
|
|
32
|
+
return { asks, notes: pilots(asker, this.notes(asker)) ? { pk: this.steward.pk(), beings: this.steward.beings() } : {} };
|
|
33
|
+
}
|
|
34
|
+
async own(args) {
|
|
35
|
+
if (!text(args.id))
|
|
36
|
+
return { error: 'id is text' };
|
|
37
|
+
return (await this.stance.occupants.invite(args.id, { owner: true })) ?? { error: 'id taken' };
|
|
38
|
+
}
|
|
39
|
+
disown(args) {
|
|
40
|
+
if (!text(args.id) || this.stance.occupants.notes(args.id)?.owner !== true)
|
|
41
|
+
return { error: 'no such owner' };
|
|
42
|
+
this.stance.occupants.remove(args.id);
|
|
43
|
+
return { disowned: args.id };
|
|
44
|
+
}
|
|
45
|
+
async boot(args) {
|
|
46
|
+
if (!text(args.key) || !text(args.class))
|
|
47
|
+
return { error: 'key and class are text' };
|
|
48
|
+
const out = await this.steward.boot(args.key, args.class);
|
|
49
|
+
return out === 'booted' ? { booted: args.key } : { error: out };
|
|
50
|
+
}
|
|
51
|
+
unboot(args) {
|
|
52
|
+
return text(args.being) && this.steward.unboot(args.being) ? { unbooted: args.being } : { error: 'no such being' };
|
|
53
|
+
}
|
|
54
|
+
public(args) {
|
|
55
|
+
if (args.key !== null && !text(args.key))
|
|
56
|
+
return { error: 'key is text or null' };
|
|
57
|
+
return this.steward.publish(args.key) ? { public: args.key } : { error: 'no such being' };
|
|
58
|
+
}
|
|
59
|
+
async invite(args) {
|
|
60
|
+
if (!text(args.being) || !text(args.id) || (args.notes !== undefined && !object(args.notes)))
|
|
61
|
+
return { error: 'being and id are text, notes an object' };
|
|
62
|
+
const invitation = await this.steward.invite(args.being, args.id, args.notes ?? {});
|
|
63
|
+
return invitation ?? { error: 'not invited' };
|
|
64
|
+
}
|
|
65
|
+
async ask(args) {
|
|
66
|
+
if ((args.being !== undefined && !text(args.being)) || (args.method !== undefined && !text(args.method)) || (args.args !== undefined && !object(args.args))) {
|
|
67
|
+
return { error: 'being and method are text, args an object' };
|
|
68
|
+
}
|
|
69
|
+
const out = await this.steward.ask(args.being ?? null, args.method, args.args ?? {});
|
|
70
|
+
if (isSilence(out))
|
|
71
|
+
return { error: 'silence' };
|
|
72
|
+
if (isWord(out))
|
|
73
|
+
return { error: told(out) };
|
|
74
|
+
return { answer: out };
|
|
75
|
+
}
|
|
76
|
+
}
|
package/dist/ward/ward.d.ts
CHANGED
|
@@ -1,12 +1,44 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
3
|
-
import { type
|
|
4
|
-
import { type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { Door, WardKey, type Behind, type Choice, type Invitation, type Payload } from '../quo/index.ts';
|
|
2
|
+
import type { Carrier, Clock, Entropy, Rows } from '../contract/index.ts';
|
|
3
|
+
import { type Answer, type BeingClass, type JsonObject } from '../being/index.ts';
|
|
4
|
+
import { Partition, type BeingRow } from './partition.ts';
|
|
5
|
+
import { type Inside } from './stance.ts';
|
|
6
|
+
import { WardBeing, type WardBeingStance } from './ward-being.ts';
|
|
7
|
+
export interface Catalogue {
|
|
8
|
+
classOf(name: string): BeingClass | undefined;
|
|
9
|
+
}
|
|
10
|
+
export type WardParts = {
|
|
11
|
+
readonly seed: Uint8Array | string;
|
|
12
|
+
readonly memory: Rows;
|
|
13
|
+
readonly catalogue: Catalogue;
|
|
14
|
+
readonly entropy: Entropy;
|
|
15
|
+
readonly clock: Clock;
|
|
16
|
+
readonly carrier: Carrier;
|
|
17
|
+
readonly root?: (stance: WardBeingStance) => WardBeing;
|
|
18
|
+
readonly dock?: Invitation;
|
|
11
19
|
};
|
|
12
|
-
export declare
|
|
20
|
+
export declare const DOCK = "dock";
|
|
21
|
+
export interface Lender {
|
|
22
|
+
offer(contract: string): Promise<Invitation | null>;
|
|
23
|
+
withdraw(contract: string, heir: string): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export declare class Ward implements Behind, Inside {
|
|
26
|
+
#private;
|
|
27
|
+
readonly key: WardKey;
|
|
28
|
+
readonly partition: Partition;
|
|
29
|
+
readonly door: Door;
|
|
30
|
+
readonly clock: Clock;
|
|
31
|
+
private constructor();
|
|
32
|
+
static unpack(parts: WardParts): Promise<Ward>;
|
|
33
|
+
get pk(): string;
|
|
34
|
+
get draw(): import("../quo/keys.ts").Draw;
|
|
35
|
+
get wardBeing(): WardBeing;
|
|
36
|
+
root(method?: string, args?: JsonObject): Promise<Answer>;
|
|
37
|
+
get zero(): boolean;
|
|
38
|
+
answer(heir: string | null, p: Payload): Promise<Choice>;
|
|
39
|
+
send(pk: string, bytes: Uint8Array): Promise<Uint8Array | null>;
|
|
40
|
+
offer(contract: string): Promise<Invitation | null>;
|
|
41
|
+
retract(contract: string, heir: string): Promise<void>;
|
|
42
|
+
live(key: string, row: BeingRow): boolean;
|
|
43
|
+
boot(maker: string, className: string, key: string, id?: string): Promise<string | null>;
|
|
44
|
+
}
|