@agentshouse/app-bridge 0.1.0-alpha.9 → 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.
Files changed (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +21 -79
  3. package/dist/calls.d.ts +955 -0
  4. package/dist/calls.js +1 -0
  5. package/dist/index.d.ts +162 -0
  6. package/dist/index.js +1 -0
  7. package/dist/mdmodel/blocks.d.ts +10 -0
  8. package/dist/mdmodel/condition.d.ts +161 -0
  9. package/dist/mdmodel/definition.d.ts +80 -0
  10. package/dist/mdmodel/divide.d.ts +2 -0
  11. package/dist/mdmodel/document.d.ts +15 -0
  12. package/dist/mdmodel/fields.d.ts +5 -0
  13. package/dist/mdmodel/index.d.ts +19 -0
  14. package/dist/mdmodel/links.d.ts +28 -0
  15. package/dist/mdmodel/paths.d.ts +25 -0
  16. package/dist/mdmodel/profile.d.ts +5 -0
  17. package/dist/mdmodel/project.d.ts +21 -0
  18. package/dist/mdmodel/references.d.ts +3 -0
  19. package/dist/mdmodel/types.d.ts +166 -0
  20. package/dist/mdmodel/validate.d.ts +10 -0
  21. package/dist/mdmodel/version.d.ts +1 -0
  22. package/dist/mdmodel/yaml.d.ts +55 -0
  23. package/dist/mdruntime/adapter.d.ts +507 -0
  24. package/dist/mdruntime/binary.d.ts +22 -0
  25. package/dist/mdruntime/change-set.d.ts +37 -0
  26. package/dist/mdruntime/change.d.ts +118 -0
  27. package/dist/mdruntime/client.d.ts +89 -0
  28. package/dist/mdruntime/collection.d.ts +39 -0
  29. package/dist/mdruntime/connection.d.ts +150 -0
  30. package/dist/mdruntime/conversation.d.ts +116 -0
  31. package/dist/mdruntime/durability.d.ts +14 -0
  32. package/dist/mdruntime/failure.d.ts +12 -0
  33. package/dist/mdruntime/file.d.ts +11 -0
  34. package/dist/mdruntime/model.d.ts +57 -0
  35. package/dist/mdruntime/observation.d.ts +31 -0
  36. package/dist/mdruntime/open.d.ts +1 -0
  37. package/dist/mdruntime/outcome.d.ts +71 -0
  38. package/dist/mdruntime/overlay.d.ts +27 -0
  39. package/dist/mdruntime/query.d.ts +274 -0
  40. package/dist/mdruntime/reach.d.ts +48 -0
  41. package/dist/mdruntime/readiness.d.ts +52 -0
  42. package/dist/mdruntime/recovery.d.ts +24 -0
  43. package/dist/mdruntime/replica.d.ts +50 -0
  44. package/dist/mdruntime/room-draft.d.ts +157 -0
  45. package/dist/mdruntime/rows.d.ts +38 -0
  46. package/dist/mdruntime/save.d.ts +101 -0
  47. package/dist/mdruntime/search.d.ts +104 -0
  48. package/dist/mdruntime/seed.d.ts +15 -0
  49. package/dist/mdruntime/shared.d.ts +18 -0
  50. package/dist/mdruntime/status.d.ts +26 -0
  51. package/dist/mdruntime/store.d.ts +171 -0
  52. package/dist/mdruntime/tables.d.ts +180 -0
  53. package/dist/mdruntime/transfer.d.ts +9 -0
  54. package/dist/mdruntime/turn.d.ts +8 -0
  55. package/dist/mdruntime/wire.d.ts +230 -0
  56. package/dist/test-host.d.ts +33 -0
  57. package/dist/test-host.js +200 -0
  58. package/docs/families.md +149 -0
  59. package/package.json +11 -14
  60. package/client/src/bridge.d.ts +0 -35
  61. package/client/src/bridge.js +0 -229
  62. package/client/src/index.d.ts +0 -3
  63. package/client/src/index.js +0 -2
  64. package/client/src/test-host.d.ts +0 -30
  65. package/client/src/test-host.js +0 -159
  66. package/client/src/wire.d.ts +0 -69
  67. package/client/src/wire.js +0 -1
  68. package/src/apps/remainder.d.ts +0 -2
  69. package/src/apps/remainder.js +0 -16
  70. package/src/apps/tab.d.ts +0 -6
  71. 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,70 +1,26 @@
1
1
  # @agentshouse/app-bridge
2
2
 
3
- The renderer-side client of the agents.house App bridge. An App served by House
4
- receives one message port before its own scripts run; this package is that
5
- port's one listener. It carries six families:
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
- - **Navigation** - the part of the shell's URL below the App's path, with its
8
- query and fragment. The shell delivers it when the App starts and whenever the
9
- User navigates; the App asks the shell to push or replace it. The App also
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
- - **Installation** - `install()` offers the page as a Home-screen app. Where the
21
- browser has an install prompt ready the shell shows it and the call resolves
22
- `'accepted'` or `'dismissed'` with the User's choice, spending that prompt;
23
- otherwise, as on every iPhone and iPad, it resolves `'manual'` and the App
24
- shows its own instructions. A prompt the browser refuses to show, as for a
25
- call made without a click, rejects with the browser's own `DOMException`
26
- and stays ready. Call it from a click. The standard
27
- `display-mode: standalone` media query tells the App it runs installed.
28
- - **Status** - the App reference the Runtime port is attached under, sync
29
- state, credential state, release availability and observed failure, `ga`:
30
- whether the page measures and the visitor's stored analytics choice, and
31
- `service_mode`: `open`, `write-halted` while House refuses writes, so the
32
- App can stop retrying them, or `null` while the runtime holds no House
33
- connection.
34
- The App reports the visitor's choice with `gaConsent('accept')` or
35
- `gaConsent('decline')`; the shell hands it to House's analytics loader, and
36
- the choice never reaches House.
37
- - **Site image read** - given a Published Room and an original attachment
38
- reference, it answers the web copy's path and metadata, or `null` when no
39
- copy exists. The original bytes never cross this bridge at a Site.
40
- - **App release code** - `sourceTop(app, release)` answers the top level of
41
- the latest successful release of an App the User may use: its folders, its
42
- files with their sizes and its root README's text, or `null` for none;
43
- `sourceDownload(app, release)` answers every file of that release with its
44
- path, its size and its `text`, or its bytes as `base64`. The browser keeps
45
- each answer per App and release: a read naming a release it holds answers
46
- without asking House, and keeping a newer release drops the earlier one. A
47
- refusal is House's `{ error: { code } }`, `app_release_not_found` for an
48
- App with no release; a read House does not answer, or one that outlived
49
- the browser's signed-in User, is `null`.
50
- - **App screenshot read** - given an App reference, `readScreenshot(app)`
51
- answers the image this browser captured of that App's screen the first time
52
- it ran its current release, as a PNG `Blob` at most 1200 pixels wide, or
53
- `null` when this browser holds none. The image stays in the browser; a Site
54
- 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.
55
14
 
56
- The package carries no credential handling and no Runtime family. It surfaces
57
- the dedicated Runtime port the worker transfers over the bridge as a plain
58
- 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.
59
16
 
60
17
  ## Use
61
18
 
62
19
  ```js
63
- import { connectHouseBridge } from '@agentshouse/app-bridge';
64
- import { connectMdRuntime } from '@agentshouse/mdruntime/client';
20
+ import { houseBridge } from '@agentshouse/app-bridge';
65
21
 
66
- const bridge = connectHouseBridge();
67
- const md = connectMdRuntime(await bridge.runtime);
22
+ const bridge = houseBridge();
23
+ const md = await bridge.runtime;
68
24
 
69
25
  bridge.onAddress((address) => render(address));
70
26
  bridge.onStatus((status) => showSync(status.sync));
@@ -79,39 +35,25 @@ async function manageSecurity(securityPath) {
79
35
  try {
80
36
  await bridge.ceremony(securityPath);
81
37
  } catch (refusal) {
82
- report(refusal);
38
+ if (refusal.name === 'HouseCeremonyRefused') report(refusal.path);
83
39
  }
84
40
  }
85
41
  ```
86
42
 
87
- `bridge.runtime` resolves with a structural `HouseMessagePort`. A consumer whose
88
- Runtime client entry asks for the DOM `MessagePort` type passes it through
89
- directly at run time and casts at the type level.
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>`.
90
47
 
91
48
  ## Test without a House
92
49
 
93
50
  ```js
94
- import { connectHouseBridge } from '@agentshouse/app-bridge';
51
+ import { houseBridge } from '@agentshouse/app-bridge';
95
52
  import { createHouseBridgeTestHost } from '@agentshouse/app-bridge/test-host';
96
53
 
97
54
  const host = createHouseBridgeTestHost({ address: '/rooms/atlas' });
98
- const bridge = connectHouseBridge(host.port);
55
+ const bridge = houseBridge();
99
56
 
100
57
  bridge.push('/rooms/atlas/members');
101
58
  host.open('/rooms/atlas');
102
59
  ```
103
-
104
- The host plays the shell and the worker: it delivers the address the App starts
105
- at and each address `open` plays as Back or Forward through the shell's own
106
- slice below the App's path, admitting nothing, so it delivers `//notes` exactly
107
- as a browser at `/apps/<app>//notes` does. It records every push and replace
108
- and answers each with the address the shell would then show, records an
109
- admitted ceremony, refuses a push, replace or ceremony that is not a
110
- same-origin absolute path, publishes a status, its `service_mode` included,
111
- records in `consents` each
112
- `gaConsent` it takes while that status measures and publishes the status the
113
- choice leaves, records in `tabs` each `setTab` the shell would take and ignores
114
- any other, answers a release code read from the `sources` it was given, or
115
- `null`, answers `readScreenshot` from the `screenshots` it was given by App
116
- reference, answers every `install()` `'manual'`, as a browser with no install
117
- prompt does, and attaches a Runtime port.