@agentshouse/app-bridge 0.1.0-c8d8dc6285bbd → 0.1.0-c8dc2a697434d

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 (120) hide show
  1. package/README.md +7 -7
  2. package/dist/index.d.ts +595 -24
  3. package/dist/mdmodel/body.d.ts +84 -0
  4. package/dist/mdmodel/built-in.d.ts +3 -0
  5. package/dist/mdmodel/definition.d.ts +20 -11
  6. package/dist/mdmodel/document.d.ts +14 -8
  7. package/dist/mdmodel/event.d.ts +76 -0
  8. package/dist/mdmodel/facts.d.ts +14 -0
  9. package/dist/mdmodel/fields.d.ts +1 -1
  10. package/dist/mdmodel/house-model.d.ts +869 -0
  11. package/dist/mdmodel/house-references/crockford.d.ts +3 -0
  12. package/dist/mdmodel/house-references/patterns.d.ts +8 -0
  13. package/dist/mdmodel/index.d.ts +40 -15
  14. package/dist/mdmodel/kinds.d.ts +17 -0
  15. package/dist/mdmodel/markdown.d.ts +74 -0
  16. package/dist/mdmodel/media-type.d.ts +71 -0
  17. package/dist/mdmodel/moment.d.ts +6 -0
  18. package/dist/mdmodel/not-ready.d.ts +1 -0
  19. package/dist/mdmodel/paths.d.ts +15 -1
  20. package/dist/mdmodel/pattern.d.ts +9 -0
  21. package/dist/mdmodel/query/language.d.ts +253 -0
  22. package/dist/mdmodel/query/match.d.ts +13 -0
  23. package/dist/mdmodel/query/rows.d.ts +31 -0
  24. package/dist/mdmodel/query/sql.d.ts +38 -0
  25. package/dist/mdmodel/references.d.ts +2 -2
  26. package/dist/mdmodel/reserved.d.ts +5 -0
  27. package/dist/mdmodel/room-types.d.ts +6 -0
  28. package/dist/mdmodel/types.d.ts +22 -17
  29. package/dist/mdmodel/validate.d.ts +12 -6
  30. package/dist/mdmodel/yaml.d.ts +4 -4
  31. package/dist/mdruntime/actions.d.ts +25 -0
  32. package/dist/mdruntime/adapter.d.ts +181 -113
  33. package/dist/mdruntime/attached-model.d.ts +6 -0
  34. package/dist/mdruntime/authored.d.ts +87 -0
  35. package/dist/mdruntime/bootstrap.d.ts +43 -0
  36. package/dist/mdruntime/cell.d.ts +5 -0
  37. package/dist/mdruntime/chain.d.ts +2 -1
  38. package/dist/mdruntime/change-set.d.ts +4 -0
  39. package/dist/mdruntime/change.d.ts +5 -0
  40. package/dist/mdruntime/client.d.ts +33 -25
  41. package/dist/mdruntime/collection.d.ts +31 -7
  42. package/dist/mdruntime/compile.d.ts +8 -6
  43. package/dist/mdruntime/conversation-live.d.ts +149 -0
  44. package/dist/mdruntime/conversation-row.d.ts +39 -0
  45. package/dist/mdruntime/conversation.d.ts +72 -51
  46. package/dist/mdruntime/declaration.d.ts +9 -0
  47. package/dist/mdruntime/durability.d.ts +19 -1
  48. package/dist/mdruntime/failure.d.ts +3 -0
  49. package/dist/mdruntime/figures.d.ts +48 -0
  50. package/dist/mdruntime/holdings.d.ts +28 -0
  51. package/dist/mdruntime/identity.d.ts +0 -1
  52. package/dist/mdruntime/install.d.ts +59 -0
  53. package/dist/mdruntime/listing.d.ts +51 -0
  54. package/dist/mdruntime/live.d.ts +24 -0
  55. package/dist/mdruntime/media.d.ts +24 -0
  56. package/dist/mdruntime/messages.d.ts +35 -5
  57. package/dist/mdruntime/model.d.ts +8 -11
  58. package/dist/mdruntime/observation.d.ts +29 -13
  59. package/dist/mdruntime/opened.d.ts +1 -1
  60. package/dist/mdruntime/outcome.d.ts +30 -7
  61. package/dist/mdruntime/overlay.d.ts +7 -2
  62. package/dist/mdruntime/preparation.d.ts +40 -0
  63. package/dist/mdruntime/presence.d.ts +57 -0
  64. package/dist/mdruntime/query.d.ts +18 -208
  65. package/dist/mdruntime/reach.d.ts +21 -13
  66. package/dist/mdruntime/readiness.d.ts +12 -21
  67. package/dist/mdruntime/reads.d.ts +38 -0
  68. package/dist/mdruntime/recovery.d.ts +3 -0
  69. package/dist/mdruntime/refresh.d.ts +26 -0
  70. package/dist/mdruntime/replica.d.ts +13 -20
  71. package/dist/mdruntime/retried.d.ts +29 -0
  72. package/dist/mdruntime/room-draft.d.ts +51 -12
  73. package/dist/mdruntime/room-drafts.d.ts +23 -0
  74. package/dist/mdruntime/runtime.d.ts +33 -0
  75. package/dist/mdruntime/save.d.ts +42 -84
  76. package/dist/mdruntime/saves.d.ts +33 -0
  77. package/dist/mdruntime/search.d.ts +12 -63
  78. package/dist/mdruntime/seed.d.ts +11 -2
  79. package/dist/mdruntime/socket/admission.d.ts +6 -0
  80. package/dist/mdruntime/socket/answers.d.ts +5 -0
  81. package/dist/mdruntime/socket/lanes.d.ts +27 -0
  82. package/dist/mdruntime/socket/session.d.ts +37 -0
  83. package/dist/mdruntime/socket.d.ts +66 -0
  84. package/dist/mdruntime/source.d.ts +58 -0
  85. package/dist/mdruntime/status.d.ts +4 -5
  86. package/dist/mdruntime/store/installs.d.ts +29 -0
  87. package/dist/mdruntime/store/readiness.d.ts +10 -0
  88. package/dist/mdruntime/store/records.d.ts +222 -0
  89. package/dist/mdruntime/store/room-held.d.ts +7 -0
  90. package/dist/mdruntime/store/rooms-shown.d.ts +7 -0
  91. package/dist/mdruntime/store/space.d.ts +10 -0
  92. package/dist/mdruntime/store/watchers.d.ts +16 -0
  93. package/dist/mdruntime/store/writes.d.ts +23 -0
  94. package/dist/mdruntime/store.d.ts +113 -157
  95. package/dist/mdruntime/stored.d.ts +79 -57
  96. package/dist/mdruntime/surface.d.ts +89 -0
  97. package/dist/mdruntime/tables.d.ts +129 -107
  98. package/dist/mdruntime/tallies.d.ts +17 -0
  99. package/dist/mdruntime/transfer.d.ts +0 -5
  100. package/dist/mdruntime/wire.d.ts +75 -13
  101. package/dist/session-content/bounds.d.ts +7 -0
  102. package/dist/session-content/check.d.ts +18 -0
  103. package/dist/session-content/index.d.ts +7 -0
  104. package/dist/session-content/parts.d.ts +103 -0
  105. package/dist/session-content/state.d.ts +61 -0
  106. package/dist/session-content/turn.d.ts +328 -0
  107. package/dist/test-host.d.ts +8 -4
  108. package/dist/test-host.js +28 -28
  109. package/docs/families.md +79 -67
  110. package/package.json +2 -2
  111. package/dist/calls.d.ts +0 -1007
  112. package/dist/calls.js +0 -1
  113. package/dist/mdmodel/blocks.d.ts +0 -10
  114. package/dist/mdmodel/condition.d.ts +0 -160
  115. package/dist/mdmodel/links.d.ts +0 -28
  116. package/dist/mdmodel/profile.d.ts +0 -5
  117. package/dist/mdruntime/connection.d.ts +0 -151
  118. package/dist/mdruntime/file.d.ts +0 -11
  119. package/dist/mdruntime/fulltext.d.ts +0 -26
  120. package/dist/mdruntime/shared.d.ts +0 -15
package/docs/families.md CHANGED
@@ -13,8 +13,14 @@
13
13
  absolute path, carries its current address as the return target, and the page
14
14
  returns there when it completes. An App names an address House gave it in a
15
15
  reading and composes one only for `/bind/<app_ref>`, where the User binds
16
- its Rooms and connects its account slots, with `?slot=<name>` to open at one
17
- slot.
16
+ its Rooms, with `?slot=<name>` to open at one slot, and `/sign-out`, which
17
+ signs the User out and opens sign-in. A decision House asks over the App, a
18
+ prepared act's approval at `/approve/<ref>` and a secret or a CLI's sign-in
19
+ at `/secret-input/<id>`, stays in the App: the shell draws House's page as
20
+ its own dialog over the App, which the App cannot reach, and `ceremony()`
21
+ resolves once it closes, with `said`, what the page said it ended with, or
22
+ `null` when it closed with nothing said, and `done`, whether the decision was
23
+ carried out.
18
24
  - **Installation** - `install()` offers the page as a Home-screen app. Where the
19
25
  browser has an install prompt ready the shell shows it and the call resolves
20
26
  `'accepted'` or `'dismissed'` with the User's choice, spending that prompt;
@@ -29,11 +35,22 @@
29
35
  notifications, or `'unavailable'` where it has no push, as on an iPhone or
30
36
  iPad outside a Home-screen app. `notifications(true)` asks the browser's
31
37
  permission and subscribes, `notifications(false)` unsubscribes, and each
32
- answers the state it leaves; a failure of the browser's push service, and
33
- of `setBadge`, rejects the same way. Call `notifications(true)` from a
34
- click. `setBadge(unread)` takes the identifiers of the Human Notifications
35
- unread in this storage and sets the icon's badge to their number, or clears
36
- it at none, where the browser shows one.
38
+ answers the state it leaves; a failure of the browser's push service
39
+ rejects the same way. Call `notifications(true)` from a click. House's
40
+ service worker counts the icon's badge itself, as pushes arrive and as
41
+ read marks reach this storage.
42
+ - **Telegram** - House's own panel alone, refused to an App or a Site the same
43
+ way. `telegram()` answers `{ state, name, username }`: `state` is
44
+ `'available'` where the page runs inside a House bot's Mini App that gave it
45
+ Telegram's launch data naming an account, with that account's `name` and its
46
+ `username` or `null`, and `'unavailable'` with both `null` elsewhere.
47
+ `telegram(true)` links the signed-in User to that account and answers
48
+ `'linked'` with it; where the User's sign-in is
49
+ not recent, the page goes to sign in again, and nothing links until a later
50
+ `telegram(true)`.
51
+ Telegram's refusal rejects with an error coded `linked_elsewhere`,
52
+ `rate_limited` or `refused`, and a failed request with the browser's own
53
+ error name.
37
54
  - **Status** - the App reference the runtime client is attached under,
38
55
  `preferences`: the `roomRef` and Path of the App's own preferences document,
39
56
  or `null` until the runtime holds that Room, sync
@@ -45,20 +62,21 @@
45
62
  `onAddress(listener)` hand a listener the status and the address the bridge
46
63
  already holds, then each change.
47
64
  The App reports the visitor's choice with `analyticsConsent('accept')` or
48
- `analyticsConsent('decline')`; the shell hands it to House's analytics loader, and
49
- the choice never reaches House.
50
- - **Handoff** - when House hands its runtime over to a newer build, the App keeps
51
- running, its `runtime` client and observations included: a call it makes
52
- meanwhile waits for the newer runtime, however long that takes, and is
53
- answered once, by it; each observation goes on with the newer runtime's
54
- values; and the status and the address arrive again. A runtime that ended
55
- before answering has its reads answered by the next one; since it may have
56
- applied any other call, an act on House is answered the outcome
57
- `transport-uncertainty`, and every other call, a Save or a draft write among
58
- them, fails with the retryable code `transport-uncertainty`.
59
- - **Site image read** - given a Published Room and the Path of one of its
60
- binary entries, it answers the web copy's path and metadata, or `null` when no
61
- copy exists. The original bytes never cross this bridge at a Site.
65
+ `analyticsConsent('decline')`; a Site's shell that measures hands it to House's
66
+ analytics loader, every other shell drops it, and the choice never reaches House.
67
+ - **Releases and builds** - an open App keeps the release it loaded: a newer
68
+ release, or a newer House build, takes effect at the App's next load, offline
69
+ too once the browser stored it. When one tab loads a newer House build, the
70
+ other House tabs reload into it; Room Drafts, chat drafts and unsent changes
71
+ survive the reload.
72
+ - **A runtime that ends** - when the browser ends House's runtime under an open
73
+ App, the App keeps running, its `runtime` client and observations included:
74
+ each observation goes on with the next runtime's values, and the status and
75
+ the address arrive again. A runtime that ended before answering has its reads
76
+ answered by the next one; since it may have applied any other call, an act on
77
+ House is answered the outcome `transport-uncertainty`, and every other call,
78
+ a Save or a draft write among them, fails with the retryable code
79
+ `transport-uncertainty`.
62
80
  - **App release code** - `sourceTop(app, release)` answers the top level of
63
81
  the latest successful release of an App the User may use: its folders, its
64
82
  files with their sizes and its root README's text, or `null` for none;
@@ -66,24 +84,23 @@
66
84
  path, its size and its `text`, or its bytes as `base64`. The browser keeps
67
85
  each answer per App and release: a read naming a release it holds answers
68
86
  without asking House, and keeping a newer release drops the earlier one. A
69
- refusal is House's `{ error: { code, retryable } }`, `app_release_not_found` for an
87
+ refusal is House's `{ error: { code, retryable } }`, `not_found` for an
70
88
  App with no release; a read House does not answer, or one that outlived
71
89
  the browser's signed-in User, is `null`.
72
- - **External calls** - `callExternal({ url, method, headers, body, slot, room_ref })`
90
+ - **External calls** - `callExternal({ url, method, headers, body, room_ref })`
73
91
  has House's server send an HTTPS request to one of the release's declared
74
92
  external origins and resolves with the service's `status`, `headers` and its
75
93
  body as `body` text or `body_base64`, or a refusal as House's
76
94
  `{ error: { code, retryable } }`, or `null` when House does not answer. House fills in the
77
- App and its running release; naming an account slot and one of the App's
78
- bound Rooms places the key of the account that Room connects to the slot,
79
- when the User holds one of the account's roles there, which the App never
80
- sees, and naming neither sends no key. A Site's call names no slot, and the House panel names an
81
- `account` instead. `body_base64` replaces `body` for bytes.
95
+ App and its running release. A `room_ref` names a Room the signed-in User binds to the App
96
+ in a `write` slot, and House adds that Room's Service key for the URL's origin, which App
97
+ code never sees; a call naming no Room carries no key, and a Site's call names no Room.
98
+ `body_base64` replaces `body` for bytes.
82
99
  - **App messages** - `messages(listener)` hands the listener each message
83
100
  another holder of this App sends to this User's running copies, as `from`,
84
101
  the sender's User id, and `body`, the JSON value they sent, until the
85
102
  function it returns is called. App code sends one through the Runtime's
86
- `call('message.send', { to, body })` with the recipient's User id and
103
+ `call('apps/messages/send', { to, body })` with the recipient's User id and
87
104
  a body of at most 32 kB of JSON; House fills in the App and relays it only
88
105
  to copies running now, storing nothing. The panel sends none.
89
106
  - **App screenshot read** - given an App reference, `readScreenshot(app)`
@@ -101,40 +118,34 @@
101
118
  `runtime` client, and resolves to a handle: `update(options)` replaces its
102
119
  options and `unmount()` removes it. House serves the Chat with the page and
103
120
  keeps it current, so the App installs and bundles nothing for it. The
104
- options: `conversation` opens one, `null` for a new chat, `agent` is the
105
- Agent a new chat goes to, `showChats` adds its conversation list, `width` is
106
- `full`, the element, or `3/4`, `1/2` or `1/3` of the window docked at its
107
- right edge, `onOpen` hears each conversation it opens as
108
- `{ conversation, agent }`, and `onLink` takes a link without a scheme in
109
- place of the browser. CSS custom properties named `--chat-*` on the element
110
- or an ancestor set its look. It shows conversations only to a release that
111
- declares them. A Site and the House panel have none: their call rejects with
121
+ options: the Chat fills the element and lays itself out by its width, the
122
+ list of the User's chats or one chat, the list beside the chat, or the list,
123
+ the chat and its details, `conversation` opens one, `null` for a new chat with
124
+ `agent`, the Agent it goes to, or the list with neither, `onOpen` hears
125
+ each conversation it opens as `{ conversation, agent }` and both `null` on
126
+ the way back to the list, and `onLink` takes
127
+ a link without a scheme in place of the browser. CSS custom properties named `--chat-*` on the element
128
+ or an ancestor set its look, and no other rule of the page's stylesheets reaches it. It shows conversations only to a release that
129
+ declares them. `chat.mountButton(options)` places the Chat as the Chat button
130
+ instead, with no element: House's dot at the window's bottom-right corner, which
131
+ counts what asks the User or, while nothing does, the chats that replied since the User
132
+ opened them, breathes while a turn runs and opens and hides the Chat in a sheet the User
133
+ moves, resizes and fills the window with, over a page that never changes under it. It
134
+ resolves to a handle: `open(target)` shows the sheet, on `target.conversation` or a new
135
+ chat with `target.agent` when it names one, docked at full height when `target.docked` is
136
+ `true`, `hide()` hides it, keeping its chat, scroll and typed text, and `update(options)` and
137
+ `unmount()` work as above, with `onOpen` and `onLink`. The page's Presentation State
138
+ keeps the sheet's size, place, list and open chat. A Site and the House panel have none: both calls reject with
112
139
  an error named and coded `NotSupportedError`, with `retryable` false.
113
140
 
114
- - **Cooperation** - `cooperate({ checkpoint, persist, capture, restore,
115
- ready, settle })` lets House activate a newer release of the App while it
116
- runs, keeping the User's task; the function it returns withdraws it.
117
- Register it in the entry script, before the first draw, or House treats the
118
- page as not cooperating and the newer release waits for the App's next
119
- open. When a newer release is stored, House calls `checkpoint()`, which
120
- resolves at the App's next safe checkpoint and may never resolve, then
121
- `persist()`, which makes authored work durable, then `capture()`, which
122
- answers the meaningful task the App owns, such as the selected record,
123
- filters, cursor, selection and scroll position, as JSON of at most 65,536
124
- characters; House keeps the address itself. In the newer release House
125
- calls `restore(task)` once its document has drawn, so the scroll position
126
- and focus it sets hold, or `restore(null)` when it opens the release without
127
- a task, then `ready()`, the App's own check that its local data and
128
- capabilities work, and finally `settle('committed')` once the release is
129
- active or `settle('abandoned')` when House returns to the release before
130
- it, restoring the same task there. A release House opens already active is
131
- settled `'committed'` at once, after `restore(task)` when House hands it a
132
- task, and a cooperation registered after House settled is settled at its
133
- registration. Until `settle('committed')` House fails the release's outside
134
- calls at once, as offline, those of the workers it starts included, and
135
- refuses its Saves, write acts and external calls with the retryable code
136
- `house_trial_withheld`, so a start-up effect is not repeated; run start-up
137
- effects after `settle('committed')`.
141
+ - **First place** - `cooperate({ placed })` tells House when the page has
142
+ drawn the place it opened on; the function it returns withdraws it. Register
143
+ it in the entry script, before the first draw. `placed()` resolves once the
144
+ page has drawn that place with what it shows: House keeps its
145
+ first-preparation surface over a page registered by its first draw until
146
+ then, and lifts it at the first draw of a page that registered none, so the
147
+ User goes from the surface to a drawn place in one change. House asks the
148
+ page for nothing else.
138
149
 
139
150
  ## The test host
140
151
 
@@ -156,11 +167,12 @@ records in `tabs` each `setTab`, answers a release code read from the
156
167
  by App reference and `readSiteScreenshot` from the `siteScreenshots` it was
157
168
  given by Site identifier, answers every `install()` `'manual'`, as a browser
158
169
  with no install prompt does, answers every `notifications()` `'unavailable'`,
159
- as a browser without push does, settles every `setBadge`, records in `chats`
170
+ as a browser without push does, records in `chats`
160
171
  each Chat `chat.mount` places, with its `element`, the `options` it was last
161
- given and whether it is still `mounted`, drawing nothing, delivers each App
172
+ given and whether it is still `mounted`, and in `chatButtons` each Chat button
173
+ `chat.mountButton` places, with the `options` it was last given, whether its
174
+ sheet is `shown`, the `target` its last `open` named or `null`, and whether it is
175
+ still `mounted`, drawing nothing, delivers each App
162
176
  message `message({ from, body })` plays, and hands `bridge.runtime` the MD
163
- Runtime client `attachRuntime(client)` gives it. `checkpoint()` runs the
164
- registered cooperation's checkpoint, persist and capture and answers the task,
165
- `restore(task)` runs its restore and answers its readiness check, and
166
- `settle(activation)` hands it the outcome.
177
+ Runtime client `attachRuntime(client)` gives it. It takes a `cooperate` and
178
+ never calls `placed()`.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agentshouse/app-bridge",
3
- "version": "0.1.0-c8d8dc6285bbd",
4
- "description": "Types of the agents.house App bridge House hands every App: navigation, the tab title and icon, ceremonies, installation, notifications and the icon badge, status, Site image reads, App release code, App and Site screenshot reads, App messages and the Chat, with an accessor and an in-page test host.",
3
+ "version": "0.1.0-c8dc2a697434d",
4
+ "description": "Types of the agents.house App bridge House hands every App: navigation, the tab title and icon, ceremonies, installation, notifications, status, App release code, App and Site screenshot reads, App messages and the Chat, with an accessor and an in-page test host.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "sideEffects": false,