@agentshouse/skills 0.1.0-ccb87a93006a1 → 0.1.0-cce3e02ef389b
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 +4 -4
- package/agent-instructions.json +4 -5
- package/dist/index.d.ts +1 -2
- package/dist/index.js +2 -11
- package/guide/{routines → agent-functions}/work-on-ticket.md +2 -2
- package/guide/apps/build.md +2 -1
- package/guide/apps/content-safety.md +4 -4
- package/guide/apps/data.md +8 -5
- package/guide/apps/example-function.md +66 -0
- package/guide/apps/example-tasks-2.md +0 -2
- package/guide/apps/example-tasks.md +2 -34
- package/guide/apps/functions.md +13 -0
- package/guide/apps/local-first.md +9 -8
- package/guide/apps/local-query-results.md +13 -4
- package/guide/apps/local-query.md +16 -8
- package/guide/apps/page.md +3 -2
- package/guide/apps/room-drafts.md +1 -1
- package/guide/apps/runtime-api.md +8 -5
- package/guide/apps/runtime-files.md +3 -3
- package/guide/apps/runtime-refusals.md +10 -5
- package/guide/apps/runtime.md +1 -1
- package/guide/apps/search.md +21 -0
- package/guide/apps/start.md +5 -3
- package/guide/apps/verify.md +4 -5
- package/guide/index.md +5 -5
- package/guide/owner-rules.md +6 -5
- package/guide/reference/access-level.md +1 -1
- package/guide/reference/agent-function.md +17 -0
- package/guide/reference/app-manifest.md +1 -1
- package/guide/reference/schema.md +4 -2
- package/guide/reference/triggers.md +10 -4
- package/guide/sites/build.md +7 -6
- package/guide/sites/entry-data-contract.md +1 -1
- package/guide/sites/runtime.md +1 -1
- package/guide/skills/build-app.md +1 -1
- package/guide/skills/house-onboarding.md +8 -12
- package/guide/skills/prototype-app.md +6 -6
- package/guide/skills/wizard.md +7 -1
- package/owner-rules-earlier.json +4 -1
- package/package.json +1 -1
- package/set/code-review/SKILL.md +1 -1
- package/set/codebase-design/DESIGN-IT-TWICE.md +1 -1
- package/set/grilling/SKILL.md +1 -1
- package/set/implement-spec/SKILL.md +4 -2
- package/set/improve-codebase-architecture/SKILL.md +1 -1
- package/set/research/SKILL.md +1 -1
- package/set/wayfinder/SKILL.md +1 -1
- package/upstream.json +2 -2
- package/guide/apps/local-search.md +0 -35
- package/guide/reference/routine.md +0 -14
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ The Skills agents.house serves its agents, and the texts its agents read.
|
|
|
11
11
|
an App, `sites/` what a Site adds, and `skills/` agents.house's own Skills, `house-onboarding`,
|
|
12
12
|
`prototype-app`, `build-app` and `wizard`, each page carrying the `name` and `description` a
|
|
13
13
|
`SKILL.md` carries.
|
|
14
|
-
`
|
|
14
|
+
`agent-functions/` holds the Agent functions agents.house writes into every Private Room, frontmatter and
|
|
15
15
|
all. `owner-rules` is the Owner rules' text, and `owner-rules-earlier.json` the SHA-256 of every
|
|
16
16
|
earlier text.
|
|
17
17
|
- `agent-instructions.json` is the lines that open an agent's first prompt.
|
|
@@ -23,9 +23,9 @@ for (const { name } of listSkills()) console.log(name, readSkill(name).length);
|
|
|
23
23
|
console.log(OWNER_RULES);
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
`agentInstructions(houseRef, copies)` returns the first prompt's lines,
|
|
27
|
-
with its path, title, first line and text
|
|
28
|
-
|
|
26
|
+
`agentInstructions(houseRef, copies)` returns the first prompt's lines, which name no Local copy,
|
|
27
|
+
`GUIDE` every Guide page with its path, title, first line and text and
|
|
28
|
+
`EARLIER_OWNER_RULES_SHA256` the earlier texts' digests.
|
|
29
29
|
|
|
30
30
|
The skills come from [mattpocock/skills](https://github.com/mattpocock/skills); thank you, Matt
|
|
31
31
|
Pocock.
|
package/agent-instructions.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"lines": [
|
|
3
3
|
"From House:",
|
|
4
|
-
"Work with House through the `house` CLI: run `house --help`, and `house
|
|
5
|
-
"
|
|
4
|
+
"Work with House through the `house` CLI: run `house --help`, and `house run_command '{\"command\":\"guide/open\"}'` opens `index`, the root page of House's guides and formats.",
|
|
5
|
+
"A file reaches the User as a Room Path written with `house upload` and linked in the answer. House serves an App, a Site or a website built by the Guide from `index` (`guide/open`), with no server of your own.",
|
|
6
6
|
"Optional per-Room instructions: `/rooms/private/rooms/<handle>/AGENTS.md`.",
|
|
7
|
-
"For another Agent's help, `
|
|
8
|
-
]
|
|
9
|
-
"copies": "House Local copies; before work run `house fetch` and rebase onto `<house-ref>`; after it commit, then `house push`:"
|
|
7
|
+
"For another Agent's help, `agent-functions/send` naming one of the Room's Agent function cards under `house/agent-functions/`, or the Agent and what you ask, as its Trust level there allows; its mail comes back into this conversation."
|
|
8
|
+
]
|
|
10
9
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,8 +15,7 @@ export interface GuidePage {
|
|
|
15
15
|
export declare const GUIDE_ROOT = "index";
|
|
16
16
|
export declare const GUIDE: readonly GuidePage[];
|
|
17
17
|
export declare const OWNER_RULES: string;
|
|
18
|
-
export declare const WORK_ON_TICKET: string;
|
|
19
18
|
export declare const EARLIER_OWNER_RULES_SHA256: readonly string[];
|
|
20
|
-
export declare function agentInstructions(
|
|
19
|
+
export declare function agentInstructions(_houseRef: string, _copies: readonly string[]): string[];
|
|
21
20
|
export declare function listSkills(): readonly Skill[];
|
|
22
21
|
export declare function readSkill(name: string): readonly SkillFile[];
|
package/dist/index.js
CHANGED
|
@@ -4,14 +4,12 @@ import { fileURLToPath } from 'node:url';
|
|
|
4
4
|
const PACKAGE = fileURLToPath(new URL('..', import.meta.url));
|
|
5
5
|
const SET = join(PACKAGE, 'set');
|
|
6
6
|
const ENTRY = 'SKILL.md';
|
|
7
|
-
const REF_PLACEHOLDER = '<house-ref>';
|
|
8
7
|
const TREE = join(PACKAGE, 'guide');
|
|
9
8
|
const PAGE = '.md';
|
|
10
9
|
const FRONTMATTER = /^---\n[\s\S]*?\n---\n\n?/u;
|
|
11
10
|
const HEADING = /^# /u;
|
|
12
11
|
export const GUIDE_ROOT = 'index';
|
|
13
12
|
const OWNER_RULES_PAGE = 'owner-rules';
|
|
14
|
-
const WORK_ON_TICKET_PAGE = 'routines/work-on-ticket';
|
|
15
13
|
function packaged(name) {
|
|
16
14
|
return readFileSync(join(PACKAGE, name), 'utf8');
|
|
17
15
|
}
|
|
@@ -33,17 +31,10 @@ export const GUIDE = readdirSync(TREE, {
|
|
|
33
31
|
.map((entry) => guidePage(relative(TREE, join(entry.parentPath, entry.name))))
|
|
34
32
|
.sort((left, right) => (left.path < right.path ? -1 : 1));
|
|
35
33
|
export const OWNER_RULES = GUIDE.find((page) => page.path === OWNER_RULES_PAGE).text;
|
|
36
|
-
export const WORK_ON_TICKET = GUIDE.find((page) => page.path === WORK_ON_TICKET_PAGE).text;
|
|
37
34
|
export const EARLIER_OWNER_RULES_SHA256 = JSON.parse(packaged('owner-rules-earlier.json'));
|
|
38
35
|
const INSTRUCTIONS = JSON.parse(packaged('agent-instructions.json'));
|
|
39
|
-
export function agentInstructions(
|
|
40
|
-
|
|
41
|
-
return [...INSTRUCTIONS.lines];
|
|
42
|
-
return [
|
|
43
|
-
...INSTRUCTIONS.lines,
|
|
44
|
-
INSTRUCTIONS.copies.replaceAll(REF_PLACEHOLDER, houseRef),
|
|
45
|
-
...copies,
|
|
46
|
-
];
|
|
36
|
+
export function agentInstructions(_houseRef, _copies) {
|
|
37
|
+
return [...INSTRUCTIONS.lines];
|
|
47
38
|
}
|
|
48
39
|
export function listSkills() {
|
|
49
40
|
return readdirSync(SET, { withFileTypes: true })
|
|
@@ -5,11 +5,11 @@ input: The ticket to work on.
|
|
|
5
5
|
|
|
6
6
|
# Work on ticket
|
|
7
7
|
|
|
8
|
-
The
|
|
8
|
+
The Agent function an Agent runs when a person sets a Wayfinding ticket in progress with that Agent as its assignee.
|
|
9
9
|
|
|
10
10
|
Work the one ticket this request names, then stop:
|
|
11
11
|
|
|
12
|
-
1. Open the `wayfinding-ticket` the request names and set its `conversation` to this conversation.
|
|
12
|
+
1. Open the `wayfinding-ticket` the request names and set its `conversation` to the id of this conversation, which House's first message names.
|
|
13
13
|
2. Work it by its `kind`: for `research`, find out and say where you found it; for `prototype`, build the smallest thing that answers its Question; for `grilling`, ask your User until its Question is settled; for `task`, do what it asks.
|
|
14
14
|
3. Write what you found or made in its Answer section and set its `status` to `done`.
|
|
15
15
|
4. Start no other ticket, not even one this ticket unblocks.
|
package/guide/apps/build.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
How to build an App over your User's Rooms and publish it, one page per step.
|
|
4
4
|
|
|
5
|
-
An App is a web page over your User's Rooms, for your User and whom they share it with (`
|
|
5
|
+
An App is a web page over your User's Rooms, for your User and whom they share it with (`shares/create`). House serves the built files and gives the page the App runtime, which holds every bound Room in the browser and syncs it with House. There is no server, backend or House API of yours to call.
|
|
6
6
|
|
|
7
7
|
- [Start an App](apps/start)
|
|
8
8
|
- [An App's data](apps/data)
|
|
@@ -11,3 +11,4 @@ An App is a web page over your User's Rooms, for your User and whom they share i
|
|
|
11
11
|
- [An App's page](apps/page)
|
|
12
12
|
- [Verify an App](apps/verify)
|
|
13
13
|
- [The App runtime](apps/runtime)
|
|
14
|
+
- [App functions](apps/functions)
|
|
@@ -10,9 +10,9 @@ images and other resources only from origins the Provider's policy allows. An ag
|
|
|
10
10
|
never read the authorization, load code from a Room, call the Provider directly, or rebase
|
|
11
11
|
a refused Change Batch.
|
|
12
12
|
|
|
13
|
-
MD UI uses semantic HTML, is fully operable from a keyboard with
|
|
14
|
-
|
|
15
|
-
are English only, dates and numbers follow the browser locale, and content is
|
|
16
|
-
translated. Light and dark themes come from CSS custom properties, defaulting to the
|
|
13
|
+
MD UI uses semantic HTML, is fully operable from a keyboard with labelled controls and
|
|
14
|
+
the browser's own focus mark, and lays out from a 360 pixel wide viewport to a desktop.
|
|
15
|
+
Its strings are English only, dates and numbers follow the browser locale, and content is
|
|
16
|
+
never translated. Light and dark themes come from CSS custom properties, defaulting to the
|
|
17
17
|
browser's preference and respecting an App's override. What an agent adds carries none of
|
|
18
18
|
these promises by itself. Data lives only in the App Creator's browser and the Provider.
|
package/guide/apps/data.md
CHANGED
|
@@ -5,8 +5,11 @@ How an App keeps what it shows as typed documents in the Rooms bound to it.
|
|
|
5
5
|
- Design the Room schema first. Each thing the App shows is one Markdown document in a Room: its frontmatter `type` names its MD type, the rest of its frontmatter holds the fields, and long text goes in `##` sections. `schema.yaml` declares the types ([Schema](reference/schema)).
|
|
6
6
|
- Keep each type in its own folder, such as `tasks/`, and read it by `pathPrefix`: a query naming `types` fails with `unknown-type` while no bound Room declares them.
|
|
7
7
|
- Link types with `reference` fields instead of copying values; a query follows them with `hop` and `backlinks`.
|
|
8
|
-
- `app.json` `room_slots` names the Rooms the App needs, each with `access` `read` or `write` and the `types` it uses ([App manifest](reference/app-manifest)). Bind Rooms with `
|
|
9
|
-
- A bound Room must hold each slot type identically in its own `settings/schema.yaml`, beside any other types, or
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
8
|
+
- `app.json` `room_slots` names the Rooms the App needs, each with `access` `read` or `write` and the `types` it uses ([App manifest](reference/app-manifest)). Bind Rooms with `apps/bindings/set`; App code cannot bind and reaches only bound Rooms, so it opens `bridge.ceremony('/bind/<app_ref>?slot=<name>')`, the House page where your User binds Rooms, which returns to the App.
|
|
9
|
+
- A bound Room must hold each slot type identically in its own `settings/schema.yaml`, beside any other types, or its binding warns the User who bound it, and `apps/bindings/list` names that release and slot in its `mismatch` line, to the App's owner too. Write it with `files_batch` before binding; `rooms/create` makes a new Room.
|
|
10
|
+
- A slot may hold a Space instead (`apps/bindings/set` with `space_ref`): every Room of it your User holds, now and later. An App its owner puts into a Space (`apps/space/set`) uses that Space's schema instead of its own `schema.yaml`, and every member of the Space uses it, each slot holding the Space's Rooms.
|
|
11
|
+
- Read an existing Room's `settings/schema.yaml` before inventing types. Two Apps over one schema are two interfaces over the same data, and your User's agents read and write those documents too.
|
|
12
|
+
- House's own facts, such as your User's Rooms and the Space each is in, come from House acts: name each in `app.json` `house_acts` and call it with `runtime.call('<act>', input)`, such as `runtime.call('rooms/list', {})`. A call needs a connection, so offline show what the bound Rooms hold. A slot holding the Private Room brings its Triggers and none of the other documents House writes under its `house/`.
|
|
13
|
+
- `shares/create` lets a person into Rooms and Apps: its answer's `added` is `true` when their _Who can add me_ setting admits your User, so they are in at once, and `false` when the Share waits for their Accept.
|
|
14
|
+
- What no browser can do, such as acting when documents change or at a set time, is a Trigger (`triggers/create`) that notifies or runs one of the App's [functions](apps/functions) on House's servers; what it writes reaches the App at once.
|
|
15
|
+
- A Trigger may also start an [Agent function](reference/agent-function) on an Agent of your User.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Example: assign a lead
|
|
2
|
+
|
|
3
|
+
How a function hands each new lead to the manager on shift with the fewest leads since their shift began, records its decision and calls the CRM.
|
|
4
|
+
|
|
5
|
+
A CRM posts each new lead to the Room's push address (`capture/push-addresses/create`) as `{"event": "lead.created", "card": {"id": 101}}`. The Room holds three types: `staff/<key>.md` with `manager_id`, the manager's id at the CRM; `shifts/<key>.md` with `staff`, the key, and `starts` and `ends` as ISO instants; and `decisions/<card>.md` with `card`, `staff` and `decided_at`. The App's `external_origins` lists the CRM's origin, the Room holds a Service key for it, and a Trigger runs the function for each lead:
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"on": "items",
|
|
10
|
+
"query": { "where": { "/address": "<push address>", "/json/event": "lead.created" } }
|
|
11
|
+
}
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
export default async (event, house) => {
|
|
16
|
+
const lead = JSON.parse(event.item.body);
|
|
17
|
+
const now = event.moment;
|
|
18
|
+
const card = lead.card.id;
|
|
19
|
+
const read = async (query) => house.query({ select: { fields: 'all' }, ...query });
|
|
20
|
+
const [held] = (await read({ types: ['decision'], paths: [`decisions/${card}.md`] })).documents;
|
|
21
|
+
if (held !== undefined) return;
|
|
22
|
+
const { documents: shifts } = await read({
|
|
23
|
+
types: ['shift'],
|
|
24
|
+
where: { '/starts': { $lte: now }, '/ends': { $gt: now } },
|
|
25
|
+
});
|
|
26
|
+
if (shifts.length === 0) throw new Error('no manager is on shift');
|
|
27
|
+
const leads = async (shift) =>
|
|
28
|
+
(
|
|
29
|
+
await read({
|
|
30
|
+
types: ['decision'],
|
|
31
|
+
where: { '/staff': shift.fields.staff, '/decided_at': { $gte: shift.fields.starts } },
|
|
32
|
+
limit: 1,
|
|
33
|
+
total: true,
|
|
34
|
+
})
|
|
35
|
+
).total;
|
|
36
|
+
const counted = await Promise.all(
|
|
37
|
+
shifts.map(async (shift) => ({ shift, leads: await leads(shift) })),
|
|
38
|
+
);
|
|
39
|
+
const [{ shift: chosen }] = counted.sort((left, right) => left.leads - right.leads);
|
|
40
|
+
const [manager] = (await read({ types: ['staff'], paths: [`staff/${chosen.fields.staff}.md`] }))
|
|
41
|
+
.documents;
|
|
42
|
+
const answer = await house.callExternal({
|
|
43
|
+
url: `https://crm.example/cards/${card}`,
|
|
44
|
+
method: 'PUT',
|
|
45
|
+
headers: { 'content-type': 'application/json', 'idempotency-key': event.id },
|
|
46
|
+
body: JSON.stringify({ status: 'assigned', manager: manager.fields.manager_id }),
|
|
47
|
+
room_ref: event.room,
|
|
48
|
+
});
|
|
49
|
+
if (answer.status !== 200) throw new Error(`the CRM answered ${answer.status}: ${answer.body}`);
|
|
50
|
+
const saved = await house.saveParts(event.room, [
|
|
51
|
+
{
|
|
52
|
+
path: `decisions/${card}.md`,
|
|
53
|
+
parts: {
|
|
54
|
+
creation: {
|
|
55
|
+
type: 'decision',
|
|
56
|
+
fields: { card, staff: chosen.fields.staff, decided_at: now },
|
|
57
|
+
sections: {},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
]);
|
|
62
|
+
if (saved.outcome !== 'saved') throw new Error(JSON.stringify(saved));
|
|
63
|
+
};
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
A lead the CRM delivers again finds its decision and calls nothing. Two leads that arrive together run one after another, so the second counts the first's decision and goes to another manager when two are tied. Each count is a query's `total`, so a long shift is never cut at a page. A failed call fails the run with the CRM's answer; the next lead still runs.
|
|
@@ -42,9 +42,7 @@ function titleForm(
|
|
|
42
42
|
});
|
|
43
43
|
const keep = () =>
|
|
44
44
|
queued(async () => {
|
|
45
|
-
unsaved.add(title);
|
|
46
45
|
const written = await write(room, path(), held, parts(title.value, held));
|
|
47
|
-
unsaved.delete(title);
|
|
48
46
|
held = written.draft;
|
|
49
47
|
if (written.stale) title.value = String(titleOf(held) ?? shown);
|
|
50
48
|
return written.stale;
|
|
@@ -12,7 +12,7 @@ task:
|
|
|
12
12
|
required: [title, done]
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
`app.json`, then `
|
|
15
|
+
`app.json`, then `apps/bindings/set` with slot `tasks`:
|
|
16
16
|
|
|
17
17
|
```json
|
|
18
18
|
{ "entry": "index.html", "room_slots": [{ "name": "tasks", "access": "write", "types": ["task"] }] }
|
|
@@ -23,43 +23,11 @@ task:
|
|
|
23
23
|
```ts
|
|
24
24
|
import { houseBridge } from '@agentshouse/app-bridge';
|
|
25
25
|
|
|
26
|
-
type Task = { top: number; field: string | null; start: number | null; end: number | null };
|
|
27
|
-
|
|
28
26
|
const bridge = houseBridge();
|
|
29
27
|
let shown!: () => void;
|
|
30
28
|
const showing = new Promise<void>((resolve) => (shown = resolve));
|
|
31
29
|
let writing: Promise<unknown> = Promise.resolve();
|
|
32
|
-
|
|
33
|
-
bridge.cooperate({
|
|
34
|
-
checkpoint: () => showing,
|
|
35
|
-
async persist() {
|
|
36
|
-
await writing;
|
|
37
|
-
if ([...unsaved].some((title) => title.isConnected)) throw new Error('unsaved');
|
|
38
|
-
},
|
|
39
|
-
capture(): Task {
|
|
40
|
-
const at = document.activeElement;
|
|
41
|
-
const field = at instanceof HTMLInputElement && at.selectionStart !== null ? at : null;
|
|
42
|
-
return {
|
|
43
|
-
top: scrollY,
|
|
44
|
-
field: field?.ariaLabel ?? null,
|
|
45
|
-
start: field?.selectionStart ?? null,
|
|
46
|
-
end: field?.selectionEnd ?? null,
|
|
47
|
-
};
|
|
48
|
-
},
|
|
49
|
-
async restore(task) {
|
|
50
|
-
await showing;
|
|
51
|
-
const held = task as Task | null;
|
|
52
|
-
if (held === null) return;
|
|
53
|
-
const field = Array.from(document.querySelectorAll('input')).find(
|
|
54
|
-
(input) => held.field !== null && input.ariaLabel === held.field,
|
|
55
|
-
);
|
|
56
|
-
field?.focus({ preventScroll: true });
|
|
57
|
-
field?.setSelectionRange(held.start, held.end);
|
|
58
|
-
scrollTo(0, held.top);
|
|
59
|
-
},
|
|
60
|
-
ready: () => true,
|
|
61
|
-
settle() {},
|
|
62
|
-
});
|
|
30
|
+
bridge.cooperate({ placed: () => showing });
|
|
63
31
|
const runtime = await bridge.runtime;
|
|
64
32
|
const rooms = await runtime.observe('rooms');
|
|
65
33
|
const sync = await runtime.observe('sync-status');
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# App functions
|
|
2
|
+
|
|
3
|
+
How an App declares a function that House runs on its servers when a Trigger fires, with no page open and no model.
|
|
4
|
+
|
|
5
|
+
- **Declare.** `app.json` lists `functions`, each `{"name": "assign lead", "entry": "functions/assign.js"}` ([App manifest](reference/app-manifest)). The entry is one ES module whose default export is the function and which imports nothing, so your build bundles each function, with all it imports, into `dist/`, such as `esbuild src/assign.ts --bundle --format=esm --outfile=dist/functions/assign.js`. A publish is refused whole for an entry that is missing, imports, has no default export or is over <function-size>, for a name used twice, and for more than <release-functions> functions.
|
|
6
|
+
- **Run.** A Trigger's `function` action names the App and one of its functions ([Triggers](reference/triggers)). House runs the App's latest release when the Event's turn comes, one Event of a Trigger after another, so a run reads what the run before it wrote. Runs share a fixed number of slots on House's servers, and a run waits, its action `waiting`, until one is free.
|
|
7
|
+
- **The event.** `export default async (event, house) => {}` receives `kind`, the condition's `on`, with `room`, `trigger`, `id`, `moment` and what matched: `path` and `reference`, a document change's `transition`, an arriving item's `item` with its `headers` and raw `body` text, a dated document's `document`, a delivered notification's `notification`, the facts of its web document, or a message's `message`, its `sender` and its request's `agent_function`, never its words, with the document that request was started for as `path` and `reference`. `Date` reads `moment`. The return value is ignored, so write what you keep into the Room.
|
|
8
|
+
- **The App API.** `house` is the page's App API over the Trigger's Room alone: `query(q)` ([Local Query](apps/local-query)), which reads only the documents of the `types`, folders (`folder`, `pathPrefix`) and `paths` it names and answers over them alone, so the rest of a large Room is never read: name the `types` or `pathPrefix` of its `hop` and `backlinks` too, and select its parts, since a query or `hop` or `backlinks` naming none, or selecting `backlinks` or `'all'`, is refused `invalid-query`, `saveParts(room, parts)`, `call(name, input)` for the Room acts, each by its House act name, such as `records/list` and `rooms/members/list`, and `callExternal(request)`. `query` and `callExternal` reject a refusal with its `code` for the function to catch, while `call` answers it as a result whose `kind` is `rejected` and `saveParts` as `outcome: 'refused'`, as on the page, so check what they answer. Its writes are the App's, by `App <App> (function <function>)`, fire Triggers, its own included, and count against the Room owner's Write limit.
|
|
9
|
+
- **Reach.** A run holds no `fetch`, timer, file, `console` or `Intl`: keep times as ISO instants, or convert a local time by its UTC offset yourself. `callExternal` takes the request `bridge.callExternal` takes and is the one way out, to an origin the release's `external_origins` lists; naming its Room, `room_ref: event.room`, carries that Room's Service key, which the function never sees, or is refused `not_found` naming the `origin`. Its calls count against the Room owner's `external_calls` limit.
|
|
10
|
+
- **Never repeated.** A run that started is never run again, even when it failed after a call reached the service. Send `event.id` as the service's idempotency key where it takes one, and name what you write by what the event carries, so a second delivery of the same thing finds it.
|
|
11
|
+
- **Failure and limits.** A throw settles the run `failed` with `function_failed` and its text, which `triggers/fired/list` shows and the panel shows the Room's owner, with no notification; the next Event still runs. A run ends `failed` at <function-time>, at <function-memory> or past <function-calls> external calls: `time_cap_reached`, `memory_cap_reached` or `external_call_cap_reached`.
|
|
12
|
+
|
|
13
|
+
Next: [Example: assign a lead](apps/example-function)
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
# Local first
|
|
2
2
|
|
|
3
|
-
How an App reads and writes its Rooms on the device, offline
|
|
3
|
+
How an App reads and writes its Rooms on the device, offline too.
|
|
4
4
|
|
|
5
|
-
- The runtime holds every bound Room on the device and streams in every change
|
|
6
|
-
- Draw from `observe` at once, with no
|
|
5
|
+
- The runtime holds every bound Room on the device and streams in every change from any device, App or agent. `query` and `observe` answer from the device and never wait on the network; `search` asks House ([Search rules](apps/search)).
|
|
6
|
+
- Draw from `observe` at once, with no request of your own; an observation hears each later change by itself, so never poll, refetch or subscribe. An answer is `{ pending }` while a Room it reads has not reached this device or been prepared on it: draw the page without those documents; keep the empty state for a complete answer. `rooms` answers once the runtime knows the Rooms the page reaches. Offer binding a Room when it is empty while the sync status's `providerUnreachable` is false and `observe('connection-refusal')` answers `null`; any other empty list says only that nothing can be listed yet.
|
|
7
|
+
- Show no loading state: draw the last state the device holds. A wait shows only after an act the User pressed whose answer comes from outside the stream, such as `bridge.callExternal`, until it arrives.
|
|
7
8
|
- Write optimistically: write a Room Draft, then `save`. The change shows in every query at once as a Pending Change and reaches House when it can. `save` refuses at once, with its `code`, a change that is `stale`, `changed-underneath` or against the schema: say so and keep the form.
|
|
8
9
|
- Show what the runtime reports: `observe('queue', room)` lists changes House has not confirmed yet, and `observe('sync-status')`'s `attentionRequired` lists each change House refused, returned as a Room Draft with why, to save again or discard.
|
|
9
10
|
- Keep what the User types in the Room Draft (`roomDraft.write`) as they type; it survives a new release replacing the page, a reload and another tab. Draw a form again only when its page changes, never on a streamed change.
|
|
10
11
|
- A document has one Room Draft, shared by every tab and App, and `save` takes all of it. A write replaces every part and names the revision it read, so write onto the parts it holds; one from an older revision answers `stale` with the current Room Draft: show that one. A field part names as its `base` the value the page showed, `{ value }`, or `null` when the document has no such field.
|
|
11
12
|
- Save a change the User does not type, such as a checkbox, with `saveParts(room, [{ path, parts }])`: it writes no Room Draft, so the one another tab holds stays.
|
|
12
|
-
- Offline, all of this works and saves wait
|
|
13
|
-
- A Room your User holds at the Open level locks once the browser has been offline 2 minutes, and from the moment it opens until House confirms the access. While it is locked, `rooms` lists it `locked: true`, a query
|
|
14
|
-
- An outside service is reached only at the origins `app.json` lists in `external_origins`, directly or through `bridge.callExternal`,
|
|
15
|
-
- The page's own storage is a disposable cache, the Room the only durable home of the App's data; handle any code or value you do not know
|
|
16
|
-
- React: `useObserve` and `useSave` from `@agentshouse/mdruntime/react`. react-admin and Refine: the data providers of `@agentshouse/mdruntime-families`. The whole client
|
|
13
|
+
- Offline, all of this works and saves wait; `bridge.onStatus` reports `offline`: say so quietly.
|
|
14
|
+
- A Room your User holds at the Open level locks once the browser has been offline 2 minutes, and from the moment it opens until House confirms the access. While it is locked, `rooms` lists it `locked: true`, a query that does not name it leaves it out, one naming it answers `{ pending }` with `awaits: 'unlock'`, and every other read and write naming it, `save` included, answers the code `room-locked` and keeps nothing. Draw it locked until it unlocks and keep what the User types in the page; what was saved before stays and is sent then.
|
|
15
|
+
- An outside service is reached only at the origins `app.json` lists in `external_origins`, directly or through `bridge.callExternal`, sent by House's server. A call that names a Room bound to the App in a `write` slot with `room_ref` carries that Room's Service key for the origin, which the page never sees; any other call carries no key. A call through a Room that holds no key for the origin is refused `not_found` naming the `origin`: tell the person that the Room's owner or a manager enters the key under Connected on the Room's Settings page, since no App opens that page.
|
|
16
|
+
- The page's own storage is a disposable cache, the Room the only durable home of the App's data; handle any code or value you do not know by its `code` ([Refusals](apps/runtime-refusals)).
|
|
17
|
+
- React: `useObserve` and `useSave` from `@agentshouse/mdruntime/react`. react-admin and Refine: the data providers of `@agentshouse/mdruntime-families`. The whole client: [The App runtime](apps/runtime).
|
|
@@ -11,11 +11,20 @@ How a Local Query answers each change, orders, groups and pages its result, and
|
|
|
11
11
|
one Path for another is the same file moved, and an unsent creation has neither until it
|
|
12
12
|
is Accepted. `revision` is the Provider's head revision, `null` for an unsent creation or edit,
|
|
13
13
|
and moves with an unsent move. A Room's last change is its Document with the latest `time`.
|
|
14
|
-
- **
|
|
15
|
-
and
|
|
14
|
+
- **Size and Created.** `size` is the bytes a row holds, a text's UTF-8 length or a file's
|
|
15
|
+
`byteLength`, and `created` the ISO 8601 time its file was created, or `null` where the
|
|
16
|
+
Provider names none; an unsent creation takes the time it was saved.
|
|
17
|
+
- **Order and groups.** `orderBy` sorts by `room`, `path`, `type`, `folder`, `size`, `created`,
|
|
18
|
+
`updated`, which is its change's `time`, or `{ field }`: missing
|
|
19
|
+
and null first, last with `nulls: 'last'`, then numbers and booleans, then date-times as instants, then text by `locale` or
|
|
16
20
|
code point with `stringSort: 'lexical'`, then lists item by item; ties end with Room, then Path.
|
|
17
|
-
`groupBy` by `room`, `type`, `folder` or `{ field }` answers `{ groups: [{ key, count }] }`,
|
|
18
|
-
counted over every match
|
|
21
|
+
`groupBy` by `room`, `type`, `folder`, `subfolder` or `{ field }` answers `{ groups: [{ key, count }] }`,
|
|
22
|
+
counted over every match. `subfolder` is the child folder of `pathPrefix`, or of the Room's root,
|
|
23
|
+
that holds a row, `null` for a row directly in it, so one query totals every child folder. A
|
|
24
|
+
group's `select: { size: true }` adds `documents` and `files`, each `{ count, size }`,
|
|
25
|
+
`updated: true` its latest `updated`, and `greatest: { field }` that field's greatest value. A
|
|
26
|
+
group orders by `count`, `size`, `updated`, `greatest` or a key, each with `nulls`. Grouped by
|
|
27
|
+
`folder` or `subfolder` alone, a folder holding no match answers a count of 0. A sort or group takes only a
|
|
19
28
|
single-value pointer. `limit`, at most 1,000 whatever a query names, bounds the Documents or the
|
|
20
29
|
groups, and a result it cuts short names `next`: the same query with it as `after` reads the next
|
|
21
30
|
window, in the same order, ties included. `total: true` adds `total`, every match's count. An
|
|
@@ -11,19 +11,27 @@ draw it as loading and observe the query to hear the complete answer. A query is
|
|
|
11
11
|
|
|
12
12
|
- **Filter.** `rooms` names Room locators and defaults to every Room. `types` names MD
|
|
13
13
|
Types, and `any` names untyped Markdown Documents. `pathPrefix` is a directory: `notes`
|
|
14
|
-
keeps `notes/a.md` and not `notes2/a.md`; `
|
|
14
|
+
keeps `notes/a.md` and not `notes2/a.md`; `outside` names directories whose contents stay
|
|
15
|
+
out, `['house']` leaving `house/` out; `folder` keeps only what lies directly in it.
|
|
15
16
|
`paths` keeps only the Paths it names: read named Documents so, never from a list.
|
|
17
|
+
`fileIds` keeps only the Documents of the `fileId`s it names, wherever they moved, on
|
|
18
|
+
the device alone: an App function refuses it.
|
|
19
|
+
`text` keeps the Documents whose text contains that phrase, ignoring case, ranking
|
|
20
|
+
nothing.
|
|
16
21
|
- **Fields.** Every frontmatter value is named by JSON Pointer: `/status`,
|
|
17
22
|
`/shipping/city`, `~1` for a `/` and `~0` for a `~` in a key. A segment that meets a
|
|
18
23
|
list applies to every item and a number names one item. `where` names pointers, ANDs
|
|
19
24
|
them, and nests `$and` and `$or`; a pointer through a list holds if any item satisfies
|
|
20
25
|
it. A bare value is equality; the operators are `$eq`, `$ne`, `$in`, `$nin`, `$gt`,
|
|
21
|
-
`$gte`, `$lt`, `$lte`, `$all`, `$size` and `$
|
|
26
|
+
`$gte`, `$lt`, `$lte`, `$all`, `$size`, `$exists` and `$prefix`, which keeps text starting
|
|
27
|
+
with it, case kept. Equality on a list asks if it
|
|
22
28
|
contains the value. Missing, null and empty differ: `$exists: false` keeps a missing
|
|
23
|
-
field, `null` an explicit null, `''` empty text and `$size: 0` an empty list. A
|
|
24
|
-
|
|
29
|
+
field, `null` an explicit null, `''` empty text and `$size: 0` an empty list. A test on a
|
|
30
|
+
missing value is false and `$ne`, `$nin` and `$exists: false` true. A date
|
|
31
|
+
compares in calendar order and never with a date-time. A date-time compares as an instant,
|
|
32
|
+
whatever offset it is written in. A reference compares by the
|
|
25
33
|
Room Path it resolves to. Untyped frontmatter, and a value under `oneOf` or a
|
|
26
|
-
conditional, is plain values. There is no
|
|
34
|
+
conditional, is plain values. There is no regular expression.
|
|
27
35
|
- **Relations.** Within one Room, `hop: { field, types, where, pathPrefix }` keeps Documents
|
|
28
36
|
whose reference at pointer `field`, at any depth, points to a matching Document, and
|
|
29
37
|
`backlinks` with the same keys those a matching Document references, each once. A body
|
|
@@ -31,14 +39,14 @@ draw it as loading and observe the query to hear the complete answer. A query is
|
|
|
31
39
|
`resolve(room, path, destination)` answers its `document`, the `deleted` one's last
|
|
32
40
|
`revision`, or `unreadable` where the App does not bind it or it is locked.
|
|
33
41
|
- **Parts.** A Document query must `select`: `'all'`, or `fields`, `sections`,
|
|
34
|
-
`preamble`, `markdown`, `backlinks`, `change`, `fileId` and `
|
|
42
|
+
`preamble`, `markdown`, `backlinks`, `change`, `fileId`, `revision`, `size` and `created`, where `fields` is `'all'`
|
|
35
43
|
or a list of pointers and `sections` `'all'` or a list of names. Selected pointers
|
|
36
44
|
return the frontmatter holding only them, nested as written. A backlink names the
|
|
37
45
|
referring Path, MD Type and the pointer it came from as `field`. Room and Path always
|
|
38
46
|
return; a Markdown Document also returns its MD Type, and at most its first 1,000
|
|
39
47
|
backlinks: a query on the referring field reads the rest. A non-Markdown Document
|
|
40
|
-
returns only Room, Path and a selected `fileId` and `
|
|
41
|
-
record too, and a text file its text as a selected `markdown
|
|
48
|
+
returns only Room, Path and a selected `change`, `fileId`, `revision`, `size` and `created`, a binary Path entry its `binaryFile`
|
|
49
|
+
record too, and a text file its text as a selected `markdown`. An unselected part is absent. Select only what a screen shows: a list
|
|
42
50
|
that selects the Markdown hears every edit of it.
|
|
43
51
|
|
|
44
52
|
Next: [Local Query changes, order and results](apps/local-query-results)
|
package/guide/apps/page.md
CHANGED
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
What an App's page draws and how it behaves in the browser.
|
|
4
4
|
|
|
5
5
|
- The App draws everything; House draws nothing around it. Set the tab's title with `bridge.setTab({ title })`.
|
|
6
|
-
- The address bar is the shell's, not your page's: read your place from `bridge.address()` and `bridge.onAddress`, and move with `bridge.push` or `bridge.replace`, so Back, Forward, reload and a shared link keep it; a push to the address already shown replaces it, so a double click adds no history entry. After an act that ends what the page shows, and when a dialog closes, `bridge.replace` the next address; a replace with the address this page was opened from goes back to it, so Back returns to where the person came from. Keep the open item, tab, filter and search in the address. Addresses under `/render
|
|
6
|
+
- The address bar is the shell's, not your page's: read your place from `bridge.address()` and `bridge.onAddress`, and move with `bridge.push` or `bridge.replace`, so Back, Forward, reload and a shared link keep it; a push to the address already shown replaces it, so a double click adds no history entry. After an act that ends what the page shows, and when a dialog closes, `bridge.replace` the next address; a replace with the address this page was opened from goes back to it, so Back returns to where the person came from. Keep the open item, tab, filter and search in the address. Addresses under `/render` and `/info` are House's.
|
|
7
7
|
- Files: take one in with `binaryFile.attach` the moment it is chosen and keep the Path it answers, hand one out with `binaryFile.download`, and show an image or video in `<room-media>` naming its width and height, so nothing waits for media and nothing moves when it arrives; never read a file whole to show or download it ([files](apps/runtime-files)).
|
|
8
8
|
- Mobile first: lay out from 360 pixels wide up, with no action behind hover alone.
|
|
9
|
-
- Every control works from the keyboard
|
|
9
|
+
- Every control works from the keyboard and has a label; give it no focus style of your own and never remove the browser's focus mark.
|
|
10
10
|
- An empty list says what it will hold and invites the first document.
|
|
11
11
|
- Long names truncate with an ellipsis and show in full on hover.
|
|
12
12
|
- The element is the link: a row, card or name opens its item; no "Open" buttons.
|
|
13
13
|
- Offer installation yourself: `bridge.install()` from a click shows the browser's prompt, or answers `manual` where you show how.
|
|
14
|
+
- Offer a way out where your User expects one: `bridge.ceremony('/sign-out')` signs them out of House and opens sign-in.
|
|
@@ -25,7 +25,7 @@ writing back a Room Draft read before.
|
|
|
25
25
|
|
|
26
26
|
Outcomes follow the Provider's answer. An Accepted Change Batch stays in the queue, drawn
|
|
27
27
|
over the confirmed layer, until that layer reaches the Room Version it was accepted at.
|
|
28
|
-
Conflicted and Rejected,
|
|
28
|
+
Conflicted and Rejected, and a change that no longer applies, each
|
|
29
29
|
leave the queue and return as Room Drafts on their Documents, marked with why: the
|
|
30
30
|
Provider's structured refusal code and fields as returned, not known to have applied, or
|
|
31
31
|
withdrawn locally. The rest of the queue keeps synchronizing, and Sync Status requires
|
|
@@ -6,7 +6,8 @@ App code reaches the MD Runtime through the remote client. The surfaces are Room
|
|
|
6
6
|
Search, Observe, Types, Room Draft, Save, History, Resolve, binary files, Call,
|
|
7
7
|
Reached, Log, the reported persistence answer, reauthorization, conversation, the chat
|
|
8
8
|
draft, and Presentation State. Sync Status, readiness, the Service Mode, the storage-loss
|
|
9
|
-
statement, the deployment facts
|
|
9
|
+
statement, the deployment facts, the signed-in member and the count of authority changes
|
|
10
|
+
are observations only.
|
|
10
11
|
|
|
11
12
|
The host attaches each port with its reach, and every member and observation answers
|
|
12
13
|
within it: a Room outside it answers as one the replica does not hold, Rooms lists only
|
|
@@ -20,7 +21,8 @@ unsubscribe, and `close()` ends it. Closing the port ends every handle and rejec
|
|
|
20
21
|
pending call and observation; a reconnected client observes again.
|
|
21
22
|
|
|
22
23
|
`observe('agents')` answers every Agent a new conversation can go to, each `{ identity,
|
|
23
|
-
name }`,
|
|
24
|
+
name }`, a retired one left out: online every Agent of the User, with a conversation yet or
|
|
25
|
+
not, offline every Agent a conversation names. Each conversation the Provider lists is held
|
|
24
26
|
complete in the browser. `conversation.list()` and `observe('conversations')` answer each
|
|
25
27
|
with its Agent's identity and name, its name, created and finished times, last outcome,
|
|
26
28
|
live `state` (`asking` while a question waits, `working` while a turn runs, else `idle`)
|
|
@@ -29,9 +31,10 @@ limit, total: true })` holds its latest `limit` messages, at most 1,000, oldest
|
|
|
29
31
|
`total` their count, and `next` while older ones exist, which `after` takes, there or in
|
|
30
32
|
`conversation.read(id, { limit, after })`, for the window before; its chat draft; and,
|
|
31
33
|
only in memory, what the Provider streams whether or not anything views it: the running
|
|
32
|
-
`turn` with its
|
|
33
|
-
the
|
|
34
|
-
|
|
34
|
+
`turn` with its Session content parts, which the message accepted under the turn's id
|
|
35
|
+
replaces, the session's `state` with its context, limits, cost and what still runs, the open
|
|
36
|
+
questions, the process state, and the CLI's commands and options, none stored or
|
|
37
|
+
searchable. A saved message's `content` holds its turn's parts, tokens and state. `chatDraft.write` and `chatDraft.discard` keep what
|
|
35
38
|
the App Creator composes, and `chatDraft.prepend(conversation, draft)` puts a returned
|
|
36
39
|
message ahead of it as it stands. Sending it is a Provider Action that needs the Provider
|
|
37
40
|
reachable and is never queued. A new conversation's chat draft is keyed `new:<Agent
|
|
@@ -38,13 +38,13 @@ or remove one as a Document, its bytes following.
|
|
|
38
38
|
mediaType }`, the bytes a `ReadableStream` of parts of at most a mebibyte, which the
|
|
39
39
|
browser keeps for later reads, offline too.
|
|
40
40
|
|
|
41
|
-
Rooms, Query,
|
|
42
|
-
|
|
41
|
+
Rooms, Query, Observe, Types, Room Draft, Save, and Reached never touch the network;
|
|
42
|
+
Search, History, a binary file's attach and download, a file shown or read that the
|
|
43
43
|
browser does not keep, and Call go to the Provider through the Adapter.
|
|
44
44
|
Call takes the Action names the Adapter declares, any other answering `undeclared`. A Call
|
|
45
45
|
result whose effect the Provider places in a Room carries `at`, that Room and Room
|
|
46
46
|
Version: `reached(room, roomVersion)` answers whether the Room's confirmed state has
|
|
47
|
-
reached it,
|
|
47
|
+
reached it, which the Room's next changes bring, and `reached(room, roomVersion, path)`
|
|
48
48
|
whether the held copy of that document was written later. A History revision names its
|
|
49
49
|
author, `{ kind: 'user', id }` or `{ kind: 'inbox', id, name }`; History of a Path no
|
|
50
50
|
document holds answers the removed document's revisions, newest first, with `deleted:
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
How the MD Runtime API refuses and fails, and how App code reads the deployment facts and who uses it.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
a
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
A refusal or failure carries `code` and `retryable`: each Call and History answer other
|
|
6
|
+
than its result, a refused Save, a returned Room Draft's reason, a Room's refusal and every
|
|
7
|
+
error a member rejects with, beside its message, a Provider refusal with the Provider's own
|
|
8
|
+
`retryable`. The Connection Refusal carries a `code` and no `retryable`, and a Room Draft
|
|
9
|
+
write from an older revision answers `{ outcome: 'stale', current }`. Every code and value
|
|
10
|
+
is open: handle one you do not know by its `code`. Only a tag telling which
|
|
10
11
|
fields a value carries, such as `kind`, is closed: keep a branch for one you do not know.
|
|
11
12
|
A model with no usable types answers `types: null`.
|
|
12
13
|
|
|
@@ -17,3 +18,7 @@ learns it: the User the Provider signed in, `{ kind: 'user', id, name }` like a
|
|
|
17
18
|
until the Provider first names one, and where it names none. It is kept
|
|
18
19
|
with the Local Replicas, answers offline once known, and every port hears the next member
|
|
19
20
|
named; signing out answers `null`, then ends the observation with the authorization.
|
|
21
|
+
`observe('authority-changes')` answers how many times House told the runtime that what its
|
|
22
|
+
User may see changed, a Room's members, a Share or an offer among them, and hears each next
|
|
23
|
+
one, never a reconnection, so a view that read such a fact through Call reads it again when
|
|
24
|
+
the count moves.
|
package/guide/apps/runtime.md
CHANGED
|
@@ -7,7 +7,7 @@ change it, build, and push. They are documentation, not enforcement.
|
|
|
7
7
|
|
|
8
8
|
- [The MD Runtime API](apps/runtime-api)
|
|
9
9
|
- [Local Query rules](apps/local-query)
|
|
10
|
-
- [
|
|
10
|
+
- [Search rules](apps/search)
|
|
11
11
|
- [Room Draft, Save, and outcome rules](apps/room-drafts)
|
|
12
12
|
- [Content safety and launch promises](apps/content-safety)
|
|
13
13
|
- [App code takes the client its host hands it and never constructs a Runtime](apps/client)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Search rules
|
|
2
|
+
|
|
3
|
+
How `search` finds Documents by words through House, and how a page finds them offline.
|
|
4
|
+
|
|
5
|
+
`search({ text, rooms })` asks House's search, the one Agents use, once and online: there
|
|
6
|
+
is no observed search and the device keeps no full-text index. `rooms` names Room locators
|
|
7
|
+
and defaults to every Room the page binds; the search never leaves those Rooms, and finds
|
|
8
|
+
words in every Document there.
|
|
9
|
+
|
|
10
|
+
- **Results.** `{ kind: 'found', documents }`, ranked by House, at most 20 hits. A hit names
|
|
11
|
+
its `room` and `path`, and a text hit its first `line` and a short `snippet` of it. Read a
|
|
12
|
+
hit's Document with `query` naming its `paths`.
|
|
13
|
+
- **Offline.** Without a connection `search` answers `{ kind: 'offline' }`, and where no
|
|
14
|
+
House search is reached, `{ kind: 'undeclared' }`. Find Documents then with a
|
|
15
|
+
[Local Query](apps/local-query): by Path, name, field values and `text`, a phrase its text
|
|
16
|
+
contains. That filter ranks nothing.
|
|
17
|
+
- **Refusals.** House's refusal answers as `kind: 'rejected'` with its `code`, and a lost
|
|
18
|
+
answer as `transport-uncertainty`: say the search failed and keep what the page shows.
|
|
19
|
+
- **Conversations.** `search` finds no message. Inside one conversation
|
|
20
|
+
`conversation.read(conversation, { text })` answers its messages that contain a phrase,
|
|
21
|
+
in windows as any read of it.
|
package/guide/apps/start.md
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
How to get an App's repository, build it and publish every change.
|
|
4
4
|
|
|
5
|
-
- An App with an `a_` reference already exists, even with no release yet, as every App your User makes in the panel does. Clone its `.git` address, `<origin>/app/<app_ref>.git` or its `source_url` in `
|
|
5
|
+
- An App with an `a_` reference already exists, even with no release yet, as every App your User makes in the panel does. Clone its `.git` address, `<origin>/app/<app_ref>.git` or its `source_url` in `apps/list`, with `git clone -c user.name=<agent-git-name> -c user.email=<agent-git-email> <address>`, so Git commits as you in every later step too. Run `npm ci --ignore-scripts`, then publish with `npm run publish`, never with `--name`.
|
|
6
|
+
- Git signs in as you with a credential your User makes for you on `<origin>/connections`, given as its password.
|
|
7
|
+
- When the Kit runs you, add `-c 'credential.helper=!kit git-credential'` to the clone instead, so the Kit signs Git in.
|
|
6
8
|
- Only when no App exists yet, clone `<origin>/app/new.git` the same way: it gives mdui, a minimal App in plain TypeScript with its test and `npm run publish`. Run `npm ci --ignore-scripts`, then `npm run publish -- --name "<display name>"`, which creates the App and prints its address and its `.git` address. Then `git remote set-url origin <that .git address>`; every later `npm run publish` goes there, without `--name`.
|
|
7
9
|
- Use any framework and build tool. `npm run build` leaves the whole release in `dist/`: the entry HTML, every file it loads, `app.json` and `schema.yaml`. The entry names files by relative paths (Vite: `base: './'`), carries no inline script and loads nothing from outside the release, so bundle fonts and libraries. A release holds at most <release-files> files and <release-size>.
|
|
8
10
|
- Your User sees a change only once it is published, so an ask to change an App is an ask to publish it: end every change with a commit and `npm run publish`, which builds, pushes `main` and the build, and prints `published` or the reason House refused. A `git push` of `main` alone publishes nothing and says so. A refused push changes nothing and the previous release keeps running.
|
|
9
|
-
- Without Git, zip the project folder after the build, without `node_modules` and `.env`, `upload` the ZIP to a Room and publish it with `
|
|
10
|
-
-
|
|
11
|
+
- Without Git, zip the project folder after the build, without `node_modules` and `.env`, `upload` the ZIP to a Room and publish it with `apps/publish-zip`.
|
|
12
|
+
- A page whose first draw is not yet the place it opened on, as one that draws its Room's documents once `observe` answers, registers `bridge.cooperate({ placed })` in its entry script before its first draw, where `placed` resolves once that place shows what it holds, as [the example](apps/example-tasks) does: House keeps its preparation surface over the page until then, and shows a page that registers none at its first draw. An open page keeps the release it loaded and runs the next one at its next load, so it needs no update code; `node_modules/@agentshouse/app-bridge/docs/families.md` describes each bridge member.
|