@nervur-org/dock 0.4.1 → 0.6.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 +17 -15
- package/api/route.ts +4 -72
- package/beings/avatar.ts +11 -7
- package/beings/carry.ts +129 -116
- package/beings/clock.ts +11 -7
- package/beings/desk.ts +7 -6
- package/beings/doorbell.ts +36 -7
- package/beings/index.ts +17 -4
- package/beings/join.ts +7 -4
- package/beings/link.ts +1 -1
- package/beings/porter.ts +5 -1
- package/beings/presence.ts +15 -5
- package/beings/setup.ts +27 -21
- package/beings/user.ts +26 -17
- package/beings/way.ts +1 -1
- package/{dock → box}/agents.ts +37 -44
- package/{dock → box}/apns.ts +4 -4
- package/box/box.ts +31 -0
- package/box/contract.ts +41 -0
- package/box/dialers.ts +88 -0
- package/box/dock.ts +148 -0
- package/box/envoy.ts +96 -0
- package/box/faculty.ts +111 -0
- package/{dock → box}/fcm.ts +1 -1
- package/box/grants.ts +90 -0
- package/box/http.ts +93 -0
- package/{dock → box}/http2.ts +7 -7
- package/box/index.ts +201 -0
- package/box/join.ts +78 -0
- package/box/local.ts +37 -0
- package/{dock → box}/location.ts +15 -3
- package/{dock → box}/notifications.ts +17 -5
- package/box/push.ts +85 -0
- package/box/ring.ts +85 -0
- package/{dock → box}/service.ts +2 -2
- package/box/timer.ts +150 -0
- package/box/tree.ts +22 -0
- package/{dock → box}/webpush.ts +2 -2
- package/cli/client.ts +1 -1
- package/cli/daemon.ts +101 -103
- package/cli/estate.ts +2 -3
- package/cli/nervur.ts +44 -25
- package/cli/stand.ts +1 -1
- package/dist/api/route.d.ts +1 -2
- package/dist/api/route.js +4 -76
- package/dist/beings/avatar.d.ts +4 -3
- package/dist/beings/avatar.js +9 -6
- package/dist/beings/carry.d.ts +10 -12
- package/dist/beings/carry.js +119 -127
- package/dist/beings/clock.js +10 -7
- package/dist/beings/desk.js +8 -7
- package/dist/beings/doorbell.d.ts +3 -1
- package/dist/beings/doorbell.js +37 -4
- package/dist/beings/index.d.ts +24 -4
- package/dist/beings/index.js +15 -4
- package/dist/beings/join.d.ts +1 -0
- package/dist/beings/join.js +6 -4
- package/dist/beings/link.d.ts +0 -1
- package/dist/beings/link.js +1 -1
- package/dist/beings/porter.js +5 -1
- package/dist/beings/presence.d.ts +1 -0
- package/dist/beings/presence.js +12 -3
- package/dist/beings/setup.d.ts +5 -2
- package/dist/beings/setup.js +16 -15
- package/dist/beings/user.d.ts +4 -3
- package/dist/beings/user.js +18 -11
- package/dist/{dock → box}/agents.d.ts +7 -4
- package/dist/{dock → box}/agents.js +30 -37
- package/dist/{dock → box}/apns.d.ts +1 -1
- package/dist/{dock → box}/apns.js +3 -3
- package/dist/box/box.d.ts +9 -0
- package/dist/box/box.js +18 -0
- package/dist/box/contract.d.ts +6 -0
- package/dist/box/contract.js +35 -0
- package/dist/{dock → box}/dialers.d.ts +7 -4
- package/dist/box/dialers.js +76 -0
- package/dist/box/dock.d.ts +182 -0
- package/dist/box/dock.js +128 -0
- package/dist/box/envoy.d.ts +44 -0
- package/dist/box/envoy.js +75 -0
- package/dist/box/faculty.d.ts +68 -0
- package/dist/box/faculty.js +97 -0
- package/dist/{dock → box}/fcm.d.ts +1 -1
- package/dist/{dock → box}/grants.d.ts +4 -3
- package/dist/box/grants.js +78 -0
- package/dist/box/http.d.ts +26 -0
- package/dist/box/http.js +89 -0
- package/dist/{dock → box}/http2.d.ts +1 -1
- package/dist/{dock → box}/http2.js +6 -6
- package/dist/box/index.d.ts +46 -0
- package/dist/box/index.js +179 -0
- package/dist/box/join.d.ts +19 -0
- package/dist/box/join.js +67 -0
- package/dist/{dock → box}/local.d.ts +3 -2
- package/dist/box/local.js +27 -0
- package/dist/{dock → box}/location.d.ts +3 -0
- package/dist/box/location.js +21 -0
- package/dist/{dock → box}/notifications.d.ts +3 -0
- package/dist/{dock → box}/notifications.js +14 -4
- package/dist/{dock → box}/push.d.ts +12 -18
- package/dist/box/push.js +83 -0
- package/dist/box/ring.d.ts +18 -0
- package/dist/box/ring.js +55 -0
- package/dist/{dock → box}/service.d.ts +1 -1
- package/dist/{dock → box}/service.js +1 -1
- package/dist/{dock → box}/timer.d.ts +2 -0
- package/dist/box/timer.js +127 -0
- package/dist/box/tree.d.ts +5 -0
- package/dist/box/tree.js +14 -0
- package/dist/{dock → box}/webpush.d.ts +1 -1
- package/dist/cli/client.d.ts +1 -0
- package/dist/cli/daemon.d.ts +2 -8
- package/dist/cli/daemon.js +102 -107
- package/dist/cli/estate.js +2 -3
- package/dist/cli/nervur.js +44 -24
- package/dist/cli/stand.d.ts +0 -14
- package/dist/cli/stand.js +1 -1
- package/dist/harbor/browser.d.ts +8 -5
- package/dist/harbor/browser.js +20 -21
- package/dist/harbor/capacitor.d.ts +3 -3
- package/dist/harbor/capacitor.js +9 -8
- package/dist/harbor/disk.d.ts +9 -9
- package/dist/harbor/disk.js +56 -51
- package/dist/harbor/edge/alarm.d.ts +4 -2
- package/dist/harbor/edge/alarm.js +9 -19
- package/dist/harbor/edge/edge.d.ts +7 -6
- package/dist/harbor/edge/edge.js +58 -53
- package/dist/harbor/edge/exercise.js +4 -4
- package/dist/harbor/edge/given.d.ts +0 -1
- package/dist/harbor/edge/given.js +0 -29
- package/dist/harbor/edge/storage.d.ts +0 -2
- package/dist/harbor/edge/storage.js +2 -2
- package/dist/harbor/http.js +4 -2
- package/dist/harbor/sealed.d.ts +0 -5
- package/dist/harbor/sealed.js +0 -39
- package/dist/harbor/tauri.d.ts +2 -2
- package/dist/harbor/tauri.js +13 -10
- package/dist/human/app.d.ts +1 -1
- package/dist/human/app.js +10 -12
- package/dist/human/door.d.ts +0 -1
- package/dist/human/door.js +1 -1
- package/dist/human/html.js +1 -1
- package/dist/human/move.js +1 -1
- package/dist/human/tab.bundle.txt +3629 -2824
- package/dist/human/wake.d.ts +5 -2
- package/dist/human/wake.js +23 -14
- package/dist/human/web.d.ts +0 -1
- package/dist/human/web.js +3 -3
- package/dist/human/worker.bundle.txt +2945 -2118
- package/dist/human/worlds.js +3 -3
- package/dist/mcp/agent.d.ts +0 -1
- package/dist/mcp/agent.js +1 -1
- package/dist/mcp/allow.js +3 -2
- package/dist/mcp/http.d.ts +0 -1
- package/dist/mcp/http.js +1 -1
- package/dist/mcp/oauth.d.ts +3 -4
- package/dist/mcp/oauth.js +4 -4
- package/dist/mcp/route.d.ts +1 -1
- package/dist/mcp/runner.d.ts +0 -1
- package/dist/mcp/runner.js +1 -1
- package/dist/mcp/server.d.ts +0 -1
- package/dist/mcp/server.js +1 -1
- package/harbor/browser.ts +22 -24
- package/harbor/capacitor.ts +9 -8
- package/harbor/disk.ts +53 -48
- package/harbor/edge/alarm.ts +15 -12
- package/harbor/edge/edge.ts +61 -55
- package/harbor/edge/exercise.ts +4 -4
- package/harbor/edge/given.ts +3 -33
- package/harbor/edge/storage.ts +2 -2
- package/harbor/http.ts +5 -3
- package/harbor/sealed.ts +0 -35
- package/harbor/tauri.ts +13 -10
- package/human/app.ts +12 -13
- package/human/door.ts +1 -1
- package/human/html.ts +1 -1
- package/human/local.ts +1 -1
- package/human/move.ts +1 -1
- package/human/tab.bundle.txt +3629 -2824
- package/human/wake.ts +36 -16
- package/human/web.ts +4 -4
- package/human/worker.bundle.txt +2945 -2118
- package/human/worlds.ts +3 -3
- package/mcp/agent.ts +1 -1
- package/mcp/allow.ts +2 -1
- package/mcp/http.ts +1 -1
- package/mcp/oauth.ts +4 -4
- package/mcp/route.ts +1 -1
- package/mcp/runner.ts +1 -1
- package/mcp/server.ts +1 -1
- package/package.json +10 -18
- package/GETTING_STARTED.md +0 -138
- package/GLOSSARY.md +0 -118
- package/WORLDS.md +0 -569
- package/beings/envoy.ts +0 -218
- package/dist/beings/envoy.d.ts +0 -54
- package/dist/beings/envoy.js +0 -211
- package/dist/dock/console.d.ts +0 -6
- package/dist/dock/console.js +0 -20
- package/dist/dock/dialers.js +0 -75
- package/dist/dock/faculty.d.ts +0 -24
- package/dist/dock/faculty.js +0 -142
- package/dist/dock/grants.js +0 -99
- package/dist/dock/index.d.ts +0 -41
- package/dist/dock/index.js +0 -113
- package/dist/dock/local.js +0 -44
- package/dist/dock/location.js +0 -11
- package/dist/dock/push.js +0 -132
- package/dist/dock/timer.js +0 -149
- package/dock/console.ts +0 -23
- package/dock/dialers.ts +0 -85
- package/dock/faculty.ts +0 -148
- package/dock/grants.ts +0 -111
- package/dock/index.ts +0 -133
- package/dock/local.ts +0 -48
- package/dock/push.ts +0 -161
- package/dock/timer.ts +0 -174
- package/quo-api.md +0 -196
- package/quo-app-bells.md +0 -280
- package/quo-dock.md +0 -1945
- package/quo-harbor.md +0 -874
- package/quo-human.md +0 -1042
- package/quo-mcp.md +0 -343
- /package/dist/{dock → box}/fcm.js +0 -0
- /package/dist/{dock → box}/webpush.js +0 -0
package/human/wake.ts
CHANGED
|
@@ -20,9 +20,8 @@
|
|
|
20
20
|
import { isInvitation, isSilence, isWord } from 'nervur';
|
|
21
21
|
import type { Invitation, JsonObject, Standing } from 'nervur';
|
|
22
22
|
import type { Harbor } from 'nervur/harbor';
|
|
23
|
-
import {
|
|
24
|
-
import
|
|
25
|
-
import { banner } from '../dock/push.ts';
|
|
23
|
+
import { BOX, BOX_SEED, NOTIFICATIONS, Notifications, lent, type Token } from '../box/index.ts';
|
|
24
|
+
import { banner } from '../box/ring.ts';
|
|
26
25
|
import { localName, relations } from './worlds.ts';
|
|
27
26
|
|
|
28
27
|
// The token a browser's push service hands a page: the endpoint, and the
|
|
@@ -54,7 +53,21 @@ const said = (out: unknown): JsonObject | null => (out === undefined || isSilenc
|
|
|
54
53
|
// The box's own being, as the device's own code reaches its own object in
|
|
55
54
|
// its own process. Nothing of this crosses an edge.
|
|
56
55
|
const box = (harbor: Harbor): { standings: { knock(i: Invitation, m?: string, a?: JsonObject): Promise<unknown> } & Record<string, Standing | undefined> } | undefined =>
|
|
57
|
-
harbor.wards.get(
|
|
56
|
+
harbor.wards.get(BOX_SEED)?.being(BOX) as never;
|
|
57
|
+
|
|
58
|
+
// Why this device has no doorbell, one word per way it can fail to take
|
|
59
|
+
// one. A closed set and never prose: it is read by the code that walks a
|
|
60
|
+
// device and by a bench, never printed for a person, because a human who
|
|
61
|
+
// has no doorbell is owed the one sentence her shell already writes and not
|
|
62
|
+
// the move that did not happen.
|
|
63
|
+
//
|
|
64
|
+
// `unbuilt` is a build that names no bell. `unhoused` is a harbor with no
|
|
65
|
+
// box ward or no box being, which is a device that has not stood up.
|
|
66
|
+
// `unanswered` is a bell that said nothing at all: a dead tunnel, a refused
|
|
67
|
+
// socket, a pk nothing answers on. `unmade` is a bell that answered and
|
|
68
|
+
// handed out no way in, which is a porter out of room or a being who is not
|
|
69
|
+
// a porter. `untaken` is a way in this ward did not come away holding.
|
|
70
|
+
export type Why = 'unbuilt' | 'unhoused' | 'unanswered' | 'unmade' | 'untaken';
|
|
58
71
|
|
|
59
72
|
// The doorbell this device holds, taken the first time and kept after that.
|
|
60
73
|
// A stranger phone knocks the bell's public being, is booted a doorbell of
|
|
@@ -63,25 +76,32 @@ const box = (harbor: Harbor): { standings: { knock(i: Invitation, m?: string, a?
|
|
|
63
76
|
//
|
|
64
77
|
// Null is a device with no bell behind it, which is what a build that names
|
|
65
78
|
// none looks like and what a bell that will not answer looks like. Each of
|
|
66
|
-
// them works in every other way.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
79
|
+
// them works in every other way. The reason comes back beside the null, in
|
|
80
|
+
// `note`, so a caller that wants to know which of them it is can ask and one
|
|
81
|
+
// that does not passes nothing.
|
|
82
|
+
export async function doorbell(harbor: Harbor, bell?: Bell, note?: { why?: Why }): Promise<Held | null> {
|
|
83
|
+
const no = (why: Why): null => {
|
|
84
|
+
if (note) note.why = why;
|
|
85
|
+
return null;
|
|
86
|
+
};
|
|
87
|
+
if (!bell) return no('unbuilt');
|
|
88
|
+
const ward = harbor.wards.get(BOX_SEED);
|
|
70
89
|
const me = box(harbor);
|
|
71
|
-
if (!ward || !me) return
|
|
90
|
+
if (!ward || !me) return no('unhoused');
|
|
72
91
|
if (!me.standings[DOORBELL]) {
|
|
73
|
-
const hello = said(await me.standings.knock({ ward: bell.pk }
|
|
74
|
-
|
|
75
|
-
|
|
92
|
+
const hello = said(await me.standings.knock({ ward: bell.pk }, 'hello', {}));
|
|
93
|
+
if (!hello) return no('unanswered');
|
|
94
|
+
const inv = hello.invitation;
|
|
95
|
+
if (!isInvitation(inv)) return no('unmade');
|
|
76
96
|
// The ward's own knock, which knocks and takes in one act: an
|
|
77
97
|
// invitation is taken only where it was answered, so the two halves are
|
|
78
98
|
// never split.
|
|
79
|
-
const took = said(await ward.ask('knock', { being:
|
|
99
|
+
const took = said(await ward.ask('knock', { being: BOX, id: DOORBELL, invitation: inv }));
|
|
80
100
|
await ward.save();
|
|
81
|
-
if (took?.taken !== DOORBELL) return
|
|
101
|
+
if (took?.taken !== DOORBELL) return no('untaken');
|
|
82
102
|
}
|
|
83
103
|
const mine = me.standings[DOORBELL];
|
|
84
|
-
if (!mine) return
|
|
104
|
+
if (!mine) return no('untaken');
|
|
85
105
|
return {
|
|
86
106
|
keep: async (token: Token) => {
|
|
87
107
|
const out = said(await mine.ask('keep', { token }));
|
|
@@ -92,7 +112,7 @@ export async function doorbell(harbor: Harbor, bell?: Bell): Promise<Held | null
|
|
|
92
112
|
// The banner key is minted on the first ask and kept, and a terrain
|
|
93
113
|
// whose banners are drawn by a second process plants the secret half
|
|
94
114
|
// where that process reads it while this is happening.
|
|
95
|
-
const keys =
|
|
115
|
+
const keys = await lent<Notifications>(harbor, NOTIFICATIONS);
|
|
96
116
|
const key = keys ? said(await keys.banner({}))?.banner : undefined;
|
|
97
117
|
if (typeof key !== 'string') return null;
|
|
98
118
|
const out = said(await mine.ask('admit', {}));
|
package/human/web.ts
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
// server. The config crosses in a JSON script, which the policy allows.
|
|
33
33
|
import type { Handler } from '../harbor/http.ts';
|
|
34
34
|
import type { Hosted } from 'nervur/harbor';
|
|
35
|
-
import {
|
|
35
|
+
import { BOX_SEED } from '../box/index.ts';
|
|
36
36
|
import { publicKey } from '../harbor/ward.ts';
|
|
37
37
|
import { ANDROID, APPLE, association, type Apps } from './apps.ts';
|
|
38
38
|
import { door } from './door.ts';
|
|
@@ -69,7 +69,7 @@ export type Folder = {
|
|
|
69
69
|
|
|
70
70
|
// A world with nothing beside its wards: no design, no code of its own. It
|
|
71
71
|
// is what a terrain hands the route when it holds no folder at all.
|
|
72
|
-
|
|
72
|
+
const BARE_FOLDER: Folder = {
|
|
73
73
|
wearing: () => Promise.resolve({ tokens: false, fonts: false }),
|
|
74
74
|
design: () => Promise.resolve(null),
|
|
75
75
|
serving: () => Promise.resolve(false),
|
|
@@ -84,7 +84,7 @@ export type WebOptions = {
|
|
|
84
84
|
code: { tab: string; worker: string };
|
|
85
85
|
// what the world keeps beside its wards; a world that keeps nothing is bare
|
|
86
86
|
folder?: Folder;
|
|
87
|
-
// the apps this world's links open, `
|
|
87
|
+
// the apps this world's links open, the Dock's `apps` cell
|
|
88
88
|
apps?: Apps | null;
|
|
89
89
|
// the public half of this world's doorbell key, which a page subscribes
|
|
90
90
|
// to a push service with. A world whose device holds no bell key sends
|
|
@@ -174,7 +174,7 @@ ${await design()}
|
|
|
174
174
|
// public being still answers a proof and a link still knocks, but a hidden
|
|
175
175
|
// ward's page is the plain door page and its root line is not written.
|
|
176
176
|
const shown = o.shown ?? (() => true);
|
|
177
|
-
const wards = async () => Object.fromEntries(await Promise.all([...harbor.wards].filter(([n]) => n !==
|
|
177
|
+
const wards = async () => Object.fromEntries(await Promise.all([...harbor.wards].filter(([n]) => n !== BOX_SEED).map(async ([n, h]) => [n, { pk: h.pk, public: shown(n) && (await publicKey(h)) !== null }] as const)));
|
|
178
178
|
const config = async (ward?: string, being?: string): Promise<Config> => ({ quo: o.at.quo, web: o.at.web, wards: await wards(), beings: await folder.serving(), ...(o.bell ? { bell: o.bell } : {}), ...(ward ? { ward } : {}), ...(being ? { being } : {}) });
|
|
179
179
|
const tab = async (ward?: string, being?: string) => {
|
|
180
180
|
return `<script id="nervur" type="application/json">${JSON.stringify(await config(ward, being)).replace(/</g, '\\u003c')}</script><script type="module" src="${o.at.web}/tab.js"></script>`;
|