@agentshouse/app-bridge 0.1.0-alpha.8 → 0.1.0-c0079debc581d
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/LICENSE +21 -0
- package/README.md +21 -70
- package/dist/calls.d.ts +955 -0
- package/dist/calls.js +1 -0
- package/dist/index.d.ts +162 -0
- package/dist/index.js +1 -0
- package/dist/mdmodel/blocks.d.ts +10 -0
- package/dist/mdmodel/condition.d.ts +161 -0
- package/dist/mdmodel/definition.d.ts +80 -0
- package/dist/mdmodel/divide.d.ts +2 -0
- package/dist/mdmodel/document.d.ts +15 -0
- package/dist/mdmodel/fields.d.ts +5 -0
- package/dist/mdmodel/index.d.ts +19 -0
- package/dist/mdmodel/links.d.ts +28 -0
- package/dist/mdmodel/paths.d.ts +25 -0
- package/dist/mdmodel/profile.d.ts +5 -0
- package/dist/mdmodel/project.d.ts +21 -0
- package/dist/mdmodel/references.d.ts +3 -0
- package/dist/mdmodel/types.d.ts +166 -0
- package/dist/mdmodel/validate.d.ts +10 -0
- package/dist/mdmodel/version.d.ts +1 -0
- package/dist/mdmodel/yaml.d.ts +55 -0
- package/dist/mdruntime/adapter.d.ts +507 -0
- package/dist/mdruntime/binary.d.ts +22 -0
- package/dist/mdruntime/change-set.d.ts +37 -0
- package/dist/mdruntime/change.d.ts +118 -0
- package/dist/mdruntime/client.d.ts +89 -0
- package/dist/mdruntime/collection.d.ts +39 -0
- package/dist/mdruntime/connection.d.ts +150 -0
- package/dist/mdruntime/conversation.d.ts +116 -0
- package/dist/mdruntime/durability.d.ts +14 -0
- package/dist/mdruntime/failure.d.ts +12 -0
- package/dist/mdruntime/file.d.ts +11 -0
- package/dist/mdruntime/model.d.ts +57 -0
- package/dist/mdruntime/observation.d.ts +31 -0
- package/dist/mdruntime/open.d.ts +1 -0
- package/dist/mdruntime/outcome.d.ts +71 -0
- package/dist/mdruntime/overlay.d.ts +27 -0
- package/dist/mdruntime/query.d.ts +274 -0
- package/dist/mdruntime/reach.d.ts +48 -0
- package/dist/mdruntime/readiness.d.ts +52 -0
- package/dist/mdruntime/recovery.d.ts +24 -0
- package/dist/mdruntime/replica.d.ts +50 -0
- package/dist/mdruntime/room-draft.d.ts +157 -0
- package/dist/mdruntime/rows.d.ts +38 -0
- package/dist/mdruntime/save.d.ts +101 -0
- package/dist/mdruntime/search.d.ts +104 -0
- package/dist/mdruntime/seed.d.ts +15 -0
- package/dist/mdruntime/shared.d.ts +18 -0
- package/dist/mdruntime/status.d.ts +26 -0
- package/dist/mdruntime/store.d.ts +171 -0
- package/dist/mdruntime/tables.d.ts +180 -0
- package/dist/mdruntime/transfer.d.ts +9 -0
- package/dist/mdruntime/turn.d.ts +8 -0
- package/dist/mdruntime/wire.d.ts +230 -0
- package/dist/test-host.d.ts +33 -0
- package/dist/test-host.js +200 -0
- package/docs/families.md +149 -0
- package/package.json +11 -14
- package/client/src/bridge.d.ts +0 -32
- package/client/src/bridge.js +0 -206
- package/client/src/index.d.ts +0 -3
- package/client/src/index.js +0 -2
- package/client/src/test-host.d.ts +0 -30
- package/client/src/test-host.js +0 -156
- package/client/src/wire.d.ts +0 -69
- package/client/src/wire.js +0 -1
- package/src/apps/remainder.d.ts +0 -2
- package/src/apps/remainder.js +0 -16
- package/src/apps/tab.d.ts +0 -6
- package/src/apps/tab.js +0 -27
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Anton (trof3039)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,62 +1,26 @@
|
|
|
1
1
|
# @agentshouse/app-bridge
|
|
2
2
|
|
|
3
|
-
The
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
The types of the agents.house App bridge, an accessor and an in-page test host.
|
|
4
|
+
House builds the bridge object in every App it serves and hands it to the page
|
|
5
|
+
before the App's own scripts run; `houseBridge()` returns that object, so an App
|
|
6
|
+
carries no bridge code of its own. It carries eleven families: navigation,
|
|
7
|
+
ceremonies, installation, notifications, status, Site image reads, App release
|
|
8
|
+
code, external calls, App messages and App and Site screenshot reads.
|
|
9
|
+
[docs/families.md](docs/families.md) describes each and the test host.
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
sets its tab's title and icon with `setTab({ title, icon })`, either or both:
|
|
11
|
-
a title of at most 200 characters and an icon given as a base64 `data:` URL
|
|
12
|
-
of an SVG, PNG, GIF or WebP image of at most 1,048,576 characters. The shell
|
|
13
|
-
shows them over the App's display name, or a Site's title, and its tab icon
|
|
14
|
-
until the next load, and ignores a request outside those bounds.
|
|
15
|
-
- **Ceremony** - the App asks the shell to leave for one of House's own
|
|
16
|
-
purpose-bound authenticated pages. The shell navigates only to a same-origin
|
|
17
|
-
absolute path, carries its current address as the return target, and the page
|
|
18
|
-
returns there when it completes. An App names an address House gave it in a
|
|
19
|
-
reading and composes none.
|
|
20
|
-
- **Status** - the App reference the Runtime port is attached under, sync
|
|
21
|
-
state, credential state, release availability and observed failure, `ga`:
|
|
22
|
-
whether the page measures and the visitor's stored analytics choice, and
|
|
23
|
-
`service_mode`: `open`, `write-halted` while House refuses writes, so the
|
|
24
|
-
App can stop retrying them, or `null` while the runtime holds no House
|
|
25
|
-
connection.
|
|
26
|
-
The App reports the visitor's choice with `gaConsent('accept')` or
|
|
27
|
-
`gaConsent('decline')`; the shell hands it to House's analytics loader, and
|
|
28
|
-
the choice never reaches House.
|
|
29
|
-
- **Site image read** - given a Published Room and an original attachment
|
|
30
|
-
reference, it answers the web copy's path and metadata, or `null` when no
|
|
31
|
-
copy exists. The original bytes never cross this bridge at a Site.
|
|
32
|
-
- **App release code** - `sourceTop(app, release)` answers the top level of
|
|
33
|
-
the latest successful release of an App the User may use: its folders, its
|
|
34
|
-
files with their sizes and its root README's text, or `null` for none;
|
|
35
|
-
`sourceDownload(app, release)` answers every file of that release with its
|
|
36
|
-
path, its size and its `text`, or its bytes as `base64`. The browser keeps
|
|
37
|
-
each answer per App and release: a read naming a release it holds answers
|
|
38
|
-
without asking House, and keeping a newer release drops the earlier one. A
|
|
39
|
-
refusal is House's `{ error: { code } }`, `app_release_not_found` for an
|
|
40
|
-
App with no release; a read House does not answer, or one that outlived
|
|
41
|
-
the browser's signed-in User, is `null`.
|
|
42
|
-
- **App screenshot read** - given an App reference, `readScreenshot(app)`
|
|
43
|
-
answers the image this browser captured of that App's screen the first time
|
|
44
|
-
it ran its current release, as a PNG `Blob` at most 1200 pixels wide, or
|
|
45
|
-
`null` when this browser holds none. The image stays in the browser; a Site
|
|
46
|
-
holds none.
|
|
11
|
+
The bridge carries no credential handling and no Runtime family. House builds
|
|
12
|
+
the MD Runtime client into the page beside the bridge, and `bridge.runtime`
|
|
13
|
+
resolves to that client, so the App imports and constructs none.
|
|
47
14
|
|
|
48
|
-
|
|
49
|
-
the dedicated Runtime port the worker transfers over the bridge as a plain
|
|
50
|
-
message port, which the App hands to the MD Runtime client entry.
|
|
15
|
+
House's `find_command` "App" is the guide to building an App or a Site.
|
|
51
16
|
|
|
52
17
|
## Use
|
|
53
18
|
|
|
54
19
|
```js
|
|
55
|
-
import {
|
|
56
|
-
import { connectMdRuntime } from '@agentshouse/mdruntime/client';
|
|
20
|
+
import { houseBridge } from '@agentshouse/app-bridge';
|
|
57
21
|
|
|
58
|
-
const bridge =
|
|
59
|
-
const md =
|
|
22
|
+
const bridge = houseBridge();
|
|
23
|
+
const md = await bridge.runtime;
|
|
60
24
|
|
|
61
25
|
bridge.onAddress((address) => render(address));
|
|
62
26
|
bridge.onStatus((status) => showSync(status.sync));
|
|
@@ -71,38 +35,25 @@ async function manageSecurity(securityPath) {
|
|
|
71
35
|
try {
|
|
72
36
|
await bridge.ceremony(securityPath);
|
|
73
37
|
} catch (refusal) {
|
|
74
|
-
report(refusal);
|
|
38
|
+
if (refusal.name === 'HouseCeremonyRefused') report(refusal.path);
|
|
75
39
|
}
|
|
76
40
|
}
|
|
77
41
|
```
|
|
78
42
|
|
|
79
|
-
`bridge.runtime` resolves
|
|
80
|
-
|
|
81
|
-
|
|
43
|
+
`bridge.runtime` resolves to the `MdRuntimeClient` of `@agentshouse/mdruntime/client`,
|
|
44
|
+
whose README describes its members. Its `call(method, params)` is a remote procedure call
|
|
45
|
+
to a House act, such as `call('member.list', { room_ref })`: `HouseMethods` names each
|
|
46
|
+
with its `params`, `HouseParams<Name>`, and its `result`, `HouseResult<Name>`.
|
|
82
47
|
|
|
83
48
|
## Test without a House
|
|
84
49
|
|
|
85
50
|
```js
|
|
86
|
-
import {
|
|
51
|
+
import { houseBridge } from '@agentshouse/app-bridge';
|
|
87
52
|
import { createHouseBridgeTestHost } from '@agentshouse/app-bridge/test-host';
|
|
88
53
|
|
|
89
54
|
const host = createHouseBridgeTestHost({ address: '/rooms/atlas' });
|
|
90
|
-
const bridge =
|
|
55
|
+
const bridge = houseBridge();
|
|
91
56
|
|
|
92
57
|
bridge.push('/rooms/atlas/members');
|
|
93
58
|
host.open('/rooms/atlas');
|
|
94
59
|
```
|
|
95
|
-
|
|
96
|
-
The host plays the shell and the worker: it delivers the address the App starts
|
|
97
|
-
at and each address `open` plays as Back or Forward through the shell's own
|
|
98
|
-
slice below the App's path, admitting nothing, so it delivers `//notes` exactly
|
|
99
|
-
as a browser at `/apps/<app>//notes` does. It records every push and replace
|
|
100
|
-
and answers each with the address the shell would then show, records an
|
|
101
|
-
admitted ceremony, refuses a push, replace or ceremony that is not a
|
|
102
|
-
same-origin absolute path, publishes a status, its `service_mode` included,
|
|
103
|
-
records in `consents` each
|
|
104
|
-
`gaConsent` it takes while that status measures and publishes the status the
|
|
105
|
-
choice leaves, records in `tabs` each `setTab` the shell would take and ignores
|
|
106
|
-
any other, answers a release code read from the `sources` it was given, or
|
|
107
|
-
`null`, answers `readScreenshot` from the `screenshots` it was given by App
|
|
108
|
-
reference, and attaches a Runtime port.
|