@notis_ai/cli 0.2.31 → 0.2.33
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 +88 -9
- package/config/notis_app_design_rules.json +22 -0
- package/dist/agent-hooks/notis-agent-hook.mjs +4677 -913
- package/dist/base-skills/notis-cli/.notis-base-skill.json +1 -1
- package/dist/base-skills/notis-cli/SKILL.md +7 -3
- package/dist/base-skills/notis-spaces/.notis-base-skill.json +1 -1
- package/dist/base-skills/notis-spaces/SKILL.md +9 -4
- package/dist/base-skills/notis-spaces/references/comments.md +94 -0
- package/dist/base-skills/notis-spaces/references/context.md +20 -19
- package/dist/base-skills/notis-spaces/references/design.md +3 -2
- package/dist/base-skills/notis-spaces/references/fixtures.md +4 -2
- package/dist/base-skills/notis-spaces/references/reading.md +3 -1
- package/dist/base-skills/notis-spaces/references/release.md +3 -1
- package/dist/base-skills/notis-spaces/references/sdk.md +160 -88
- package/dist/base-skills/notis-spaces/references/store.md +24 -1
- package/dist/sdk/src/components/SelectionActionBar.tsx +42 -7
- package/dist/sdk/src/components/SpaceTextComments.tsx +284 -0
- package/dist/sdk/src/config.ts +3 -1
- package/dist/sdk/src/functions.ts +203 -0
- package/dist/sdk/src/hooks/useAgentQueue.ts +17 -28
- package/dist/sdk/src/hooks/useCollectionInteractions.ts +7 -2
- package/dist/sdk/src/hooks/useConnection.ts +102 -0
- package/dist/sdk/src/hooks/useFunction.ts +42 -0
- package/dist/sdk/src/hooks/useNotisSettings.ts +101 -0
- package/dist/sdk/src/index.ts +15 -4
- package/dist/sdk/src/runtime.ts +16 -1
- package/dist/sdk/src/space.ts +333 -33
- package/dist/sdk/src/ui/comments/passageModel.ts +99 -0
- package/dist/sdk/src/ui/comments/textHighlights.ts +33 -0
- package/dist/sdk/src/ui/icons.tsx +17 -1
- package/dist/skill-sync/index.js +239 -30
- package/dist/skill-sync-worker.mjs +453 -124
- package/dist/space-harness/host.js +218 -93
- package/dist/space-sdk/dist/chunk-4GWS2IFO.js +3 -0
- package/dist/space-sdk/dist/index.js +3 -3
- package/dist/space-sdk/dist/ui.js +9 -8
- package/dist/space-sdk/src/config.ts +3 -1
- package/dist/space-sdk/src/functions.ts +203 -0
- package/dist/space-sdk/src/hooks/useAgentQueue.d.ts +2 -13
- package/dist/space-sdk/src/hooks/useCollectionInteractions.d.ts +2 -0
- package/dist/space-sdk/src/hooks/useConnection.d.ts +42 -0
- package/dist/space-sdk/src/hooks/useFunction.d.ts +20 -0
- package/dist/space-sdk/src/hooks/useNotisSettings.d.ts +48 -0
- package/dist/space-sdk/src/index.d.ts +10 -4
- package/dist/space-sdk/src/runtime.d.ts +14 -1
- package/dist/space-sdk/src/space.ts +333 -33
- package/dist/space-sdk/src/tailwind-candidates.d.ts +227 -152
- package/dist/space-sdk/src/ui/blocks/blocks.d.ts +18 -0
- package/dist/space-sdk/src/ui/blocks/index.d.ts +2 -2
- package/dist/space-sdk/src/ui/comments/CommentPane.d.ts +7 -4
- package/dist/space-sdk/src/ui/comments/agentRuntime.d.ts +10 -2
- package/dist/space-sdk/src/ui/comments/commentModel.d.ts +55 -88
- package/dist/space-sdk/src/ui/comments/commentWords.d.ts +9 -0
- package/dist/space-sdk/src/ui/comments/hostComments.d.ts +13 -9
- package/dist/space-sdk/src/ui/comments/index.d.ts +1 -1
- package/dist/space-sdk/src/ui/comments/paneParts.d.ts +27 -5
- package/dist/space-sdk/src/ui/comments/passageModel.d.ts +12 -36
- package/dist/space-sdk/src/ui/comments/useCommentRouting.d.ts +26 -4
- package/dist/space-sdk/src/ui/comments/useComments.d.ts +64 -74
- package/dist/space-sdk/src/ui/comments/usePassageComments.d.ts +8 -4
- package/dist/space-sdk/src/ui/icons.d.ts +6 -0
- package/dist/space-sdk/src/ui/index.d.ts +2 -2
- package/dist/space-sdk/src/ui/layout/SidePane.d.ts +3 -4
- package/dist/space-sdk/src/ui/list/ListReader.d.ts +8 -0
- package/dist/space-sdk/src/ui/period/dateFormat.d.ts +27 -8
- package/dist/view-renderer/dist/host.js +285 -160
- package/package.json +3 -3
- package/skills/notis-cli/AGENT_INSTRUCTIONS.md +2 -2
- package/skills/notis-spaces/cli.md +17 -3
- package/src/cli.js +2 -1
- package/src/command-specs/index.js +3 -0
- package/src/command-specs/repository-secrets.js +171 -0
- package/src/command-specs/spaces.js +70 -3
- package/src/runtime/agent-credential.js +175 -0
- package/src/runtime/agent-identity.js +92 -15
- package/src/runtime/app-boundary-validator.js +248 -3
- package/src/runtime/app-data-literals.js +32 -23
- package/src/runtime/app-platform.js +8 -0
- package/src/runtime/auth-recovery.js +14 -0
- package/src/runtime/profiles.js +15 -0
- package/src/runtime/skill-sync/index.ts +3 -2
- package/src/runtime/skill-sync/symlink-manager.ts +354 -35
- package/src/runtime/skill-sync/types.ts +10 -1
- package/src/runtime/space-functions.js +211 -0
- package/src/runtime/space-platform.js +12 -3
- package/src/runtime/space-source.js +116 -13
- package/src/runtime/space-test-server.js +44 -7
- package/src/runtime/space-verification.js +3 -1
- package/src/runtime/transport.js +15 -0
- package/dist/sdk/src/components/NotisCommentBoundary.tsx +0 -132
- package/dist/space-sdk/dist/chunk-3DFOGU26.js +0 -3
- package/dist/space-sdk/src/components/NotisCommentBoundary.d.ts +0 -26
|
@@ -29,16 +29,17 @@ Text a person writes and reviews:
|
|
|
29
29
|
cannot show as blocks are kept as written). In a form with its own Save, pass
|
|
30
30
|
`onChange` and change `resourceKey` after Cancel or a save so the editor
|
|
31
31
|
reopens on the value.
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
- Selected words on any Space page already offer Cite and Comment: you add
|
|
33
|
+
nothing. To tie passage comments to a text property (a Markdown body, a
|
|
34
|
+
subject) so they are highlighted where the view draws it, use
|
|
35
|
+
`usePassageComments` from `@notis/sdk/ui` with `CommentableText` around an
|
|
36
|
+
input or textarea, `CommentableRichText` around the `MarkdownEditor` or
|
|
35
37
|
rendered Markdown, and `<PassageCommentPane comments={comments} />` mounted
|
|
36
|
-
once anywhere in the view (it draws in the host Comments panel
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
`useComments` with `CommentPane` (see [Comments](#comments)).
|
|
38
|
+
once anywhere in the view (it draws in the host Comments panel). A thread
|
|
39
|
+
whose words are gone reads Passage changed and stays open. Pass
|
|
40
|
+
`order="reading"` to list the text's threads in reading order. Do not build
|
|
41
|
+
your own highlights. Pins on a page use `useComments` with `CommentPane`
|
|
42
|
+
(see [Comments](#comments)).
|
|
42
43
|
|
|
43
44
|
## Toolkit pieces
|
|
44
45
|
|
|
@@ -49,7 +50,8 @@ rather than from a copy.
|
|
|
49
50
|
`OpenAsMenu`, `Keycap`. `ListReader` draws the whole list chrome from props:
|
|
50
51
|
`search` (the host top bar field), `tabs` (pills in one 44px row), `title`
|
|
51
52
|
(a short status with its count at the start of that row, such as "23 to
|
|
52
|
-
triage"), `create` (the "+" at its end), `viewMenu`, `infoLine`,
|
|
53
|
+
triage"), `create` (the "+" at its end), `viewMenu`, `infoLine`, `filters` (removable
|
|
54
|
+
`FilterChip`s, each `{ id, label, onClear }`, at the start of the info line),
|
|
53
55
|
`readerLabel` and `readerActions` (the reader bar), `crumbLabel` (the open
|
|
54
56
|
item in the top bar crumb), `crumbRecordKey` (its record key when the items
|
|
55
57
|
are records of the Space's `collection`), `readerLayout` (`'fill'` lays a
|
|
@@ -108,8 +110,9 @@ rather than from a copy.
|
|
|
108
110
|
button, `viewerActions` adds viewer buttons (class `nui-viewer-btn`) and
|
|
109
111
|
`onNotice` hears copy and download results. Use `ImageViewer` alone for a
|
|
110
112
|
picture that opens full screen. Do not build your own lightbox.
|
|
111
|
-
- **Comments**: `useComments` with `CommentPane` and `CommentPins`
|
|
112
|
-
|
|
113
|
+
- **Comments**: `useComments` with `CommentPane` and `CommentPins` add pins,
|
|
114
|
+
zones, items and moments to the comments every Space page has; see
|
|
115
|
+
[Comments](#comments).
|
|
113
116
|
- **Presenting on a second screen**: `useAudienceScreen({ onAction, onClose,
|
|
114
117
|
title })` works like PowerPoint. `secondScreen` says whether another screen
|
|
115
118
|
is connected; call `open(anchor)` from the Present press itself. It answers
|
|
@@ -125,7 +128,7 @@ rather than from a copy.
|
|
|
125
128
|
previews, a timer). The browser asks once to place windows on screens; the
|
|
126
129
|
desktop app never asks. Leaving the view closes the audience window.
|
|
127
130
|
- **Blocks**: `Section`, `Badge`, `Button`, `ToggleGroup`, `SegmentedControl`,
|
|
128
|
-
`NativeSelect`, `EmptyState`, `Notice`, `Metric`. A `Section`'s `kind`
|
|
131
|
+
`NativeSelect`, `EmptyState`, `Notice`, `Metric`, `FilterChip`. A `Section`'s `kind`
|
|
129
132
|
is `bar` (period and filters), `stats`, `chart`, `data` (a table) or `form`,
|
|
130
133
|
and its head takes `title`, `count`, `meta`, `tabs` and `actions`. There is no
|
|
131
134
|
page heading: the host top bar shows the title. One toggle is a `Button` with
|
|
@@ -134,9 +137,28 @@ rather than from a copy.
|
|
|
134
137
|
(`TabRow`, which folds the pills that do not fit into More); a
|
|
135
138
|
`SegmentedControl` is only a mode switch inside a section. `Tabs` scroll
|
|
136
139
|
sideways on a phone; `wrap` puts the tabs that do not fit on a next line.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
+
A removable filter that is not a tab (a contact, a tag) is a `FilterChip`
|
|
141
|
+
(`label`, `onClear`); over a list, pass them as `ListReader`'s `filters`.
|
|
142
|
+
`Icon` draws a toolkit icon by name, and every `icon` prop or field (a
|
|
143
|
+
`Button`, a reader action, a menu item) takes the same names.
|
|
144
|
+
`notis spaces build` refuses any other name written there as a string
|
|
145
|
+
and suggests the closest ones. The names: `archive`, `arrow-bend-up-right`,
|
|
146
|
+
`arrow-clockwise`, `arrow-counter-clockwise`, `arrow-left`,
|
|
147
|
+
`arrow-square-out`, `arrows-clockwise`, `arrows-left-right`, `arrows-out`,
|
|
148
|
+
`caret-down`, `caret-left`, `caret-right`, `caret-up`, `chart-line-up`,
|
|
149
|
+
`chat-circle-text`, `chats`, `check`, `check-circle`, `check-circle-fill`,
|
|
150
|
+
`circle`, `circle-dashed`, `circle-half`, `circle-three-quarter`,
|
|
151
|
+
`clipboard-text`, `clock`, `clock-countdown`, `copy`, `corners-out`,
|
|
152
|
+
`dots-three`, `download-simple`, `envelope-open`, `envelope-simple`, `file`,
|
|
153
|
+
`file-audio`, `file-image`, `file-text`, `file-video`, `flask`,
|
|
154
|
+
`fork-knife`, `funnel-simple`, `hourglass`, `info`, `kanban`, `link`,
|
|
155
|
+
`magnifying-glass-minus`, `magnifying-glass-plus`, `minus-circle`,
|
|
156
|
+
`paper-plane-right`, `paper-plane-tilt`, `paperclip`, `pause`,
|
|
157
|
+
`pencil-simple`, `play`, `plus`, `rocket-launch`, `sidebar-simple`,
|
|
158
|
+
`sparkle`, `square-center`, `star`, `star-fill`, `toggle-left`,
|
|
159
|
+
`toggle-right`, `trash`, `tray-arrow-up`, `user-plus`, `x`,
|
|
160
|
+
`x-circle-fill`. For any other icon, pass a `@phosphor-icons/react` element as the `icon` (the template depends on it),
|
|
161
|
+
never a second icon set.
|
|
140
162
|
A `Notice` is read politely, danger too; pass `urgent` only for a problem the
|
|
141
163
|
person must act on now (it becomes an alert that interrupts the screen reader).
|
|
142
164
|
- **Fields**: `EditableFields` (a form; Save and Cancel show once something
|
|
@@ -211,9 +233,6 @@ question, a note) wraps and its rows grow, and `wrapHeaders` puts long headers
|
|
|
211
233
|
The primary column never gets under its `minWidth` (120 px by default): the last
|
|
212
234
|
columns that do not fit hide on their own.
|
|
213
235
|
|
|
214
|
-
`formatDuration(ms, locale, { units, smallest })` writes "1 h 31 min" (FR "4 j 6
|
|
215
|
-
h").
|
|
216
|
-
|
|
217
236
|
`CalendarHeatmap` is a GitHub-style grid of days coloured by value (a habit,
|
|
218
237
|
journal entries, a mood): `data` rows with `dateKey` and `valueKey` (default
|
|
219
238
|
`date` and `value`; `valueKey={null}` counts rows), `from` and `to` (default
|
|
@@ -223,74 +242,31 @@ for good to bad data (`higherIsBetter={false}` swaps the colours), `levels`,
|
|
|
223
242
|
with `key` the ISO day, plus `value` and the day's `rows`), `title`, `legend`,
|
|
224
243
|
`weekStartsOn`. It brings its tooltips, keys and data table.
|
|
225
244
|
|
|
245
|
+
### Dates in words
|
|
246
|
+
|
|
247
|
+
Write dates and durations with the `@notis/sdk/ui` helpers and the runtime
|
|
248
|
+
locale: `formatLongDay(date, locale)` ("Monday, January 5, 2026" / "Lundi 5
|
|
249
|
+
janvier 2026"), `formatDayHeading(date, locale)` ("Lundi 19 octobre", the year
|
|
250
|
+
only when it is not this year), `formatShortDay`, `formatMonthYear`,
|
|
251
|
+
`formatDateRange` ("17 mai au 15 juin 2026", never a dash), `weekdayNames(locale,
|
|
252
|
+
width)` and `formatDuration(ms, locale, { units, smallest })` ("1 h 31 min", FR
|
|
253
|
+
"4 j 6 h").
|
|
254
|
+
|
|
255
|
+
By default `formatLongDay`, `formatDayHeading`, `formatMonthYear` and
|
|
256
|
+
`weekdayNames` start with a capital: they head a title, a group, a column or a
|
|
257
|
+
label. French writes weekdays and months in lower case everywhere else, so a
|
|
258
|
+
date inside a sentence passes `{ inSentence: true }`: `formatLongDay(date,
|
|
259
|
+
locale, { inSentence: true })`, `formatMonthYear(date, locale, { inSentence:
|
|
260
|
+
true })`, `formatDayHeading(date, locale, { thisYear, inSentence: true })` and
|
|
261
|
+
`weekdayNames(locale, 'long', { inSentence: true })` (the width always comes
|
|
262
|
+
first). With it French
|
|
263
|
+
reads "Publiée le lundi 9 novembre 2026" and English keeps its capitals
|
|
264
|
+
("Published on Monday, November 9, 2026"). Never capitalise a French date in the
|
|
265
|
+
middle of a sentence ("depuis le Jeudi 19 novembre").
|
|
266
|
+
|
|
226
267
|
## Comments
|
|
227
268
|
|
|
228
|
-
`useComments`
|
|
229
|
-
threads on a Comments database (pins, zones, replies, asks, Archive, Delete,
|
|
230
|
-
Edit, Copy changes). The pane draws in the host Comments panel beside the
|
|
231
|
-
chat, not where it is mounted: mount `<CommentPane controller={comments} />`
|
|
232
|
-
once anywhere in the view and never wrap it in `SidePane` (a `SidePane` given
|
|
233
|
-
a comment pane shows its page alone). While comments are off for the viewer,
|
|
234
|
-
or on a Site, a link or a preview, the pane, pins and tool bar render nothing:
|
|
235
|
-
never build a fallback comment list. The host owns archive (Status
|
|
236
|
-
`Resolved`, shown Done), delete with Undo, editing your own comment, the
|
|
237
|
-
Open/Done/All filter, the Goes to line and To chip that name the thread a
|
|
238
|
-
comment goes to, `comment=` links and push; the server checks who may change
|
|
239
|
-
a comment and writes `Author` itself (the person's name, or the agent's on
|
|
240
|
-
an agent's comment, adding the select choice when it is missing), so never
|
|
241
|
-
set `Author` from the view or let people pick it. On someone else's comment
|
|
242
|
-
people only archive, reopen, delete (with edit rights) or answer it: every
|
|
243
|
-
other column is its author's, and agents change only what they wrote. Every
|
|
244
|
-
Comments table is followed for waiting comments and push, with or without
|
|
245
|
-
`agents`, and a person's comments, replies and answers go to the thread they
|
|
246
|
-
name even in a Space that declares no `agents`: an answer, or a reply in a
|
|
247
|
-
thread an agent started, goes back to that agent's own thread and subagent,
|
|
248
|
-
and editing a comment wakes an agent only when it replied after the comment.
|
|
249
|
-
A reply under a deleted comment is refused (`comment_not_found`). Every
|
|
250
|
-
comment written through the Notis CLI needs the writing agent's band name
|
|
251
|
-
(`NOTIS_AGENT_NAME` or `--agent-name`, such as `fred-and-the-machine`; the
|
|
252
|
-
rule and the id the CLI keeps per name are in the notis-cli skill): the
|
|
253
|
-
comment is then that agent's, signed "Fred And The Machine", and never wakes
|
|
254
|
-
it. Without a name it is refused (`agent_name_required`), even for a person
|
|
255
|
-
typing the CLI, and a view never writes comments with a Cloud Computer
|
|
256
|
-
credential. The Notis assistant never writes comments itself
|
|
257
|
-
(`orchestrator_comments_refused`): it starts a sub-agent for comment work,
|
|
258
|
-
which signs with its own band name. On a host without the Comments panel a
|
|
259
|
-
comment is signed with the viewer's first name; when the Comments
|
|
260
|
-
database's Author is a choice list, give it a `Person` option, which signs
|
|
261
|
-
anyone it does not name (without it the comment saves with no author). Pass
|
|
262
|
-
`me` only to sign with a fixed name. For comments on a whole record with
|
|
263
|
-
nothing to pin on, pass no `anchors` and `columns.anchor: null`: the pane
|
|
264
|
-
offers New comment itself.
|
|
265
|
-
|
|
266
|
-
Options:
|
|
267
|
-
- `order` on the pane: `'newest'` (default), `'oldest'`, `'anchor'` or a
|
|
268
|
-
comparator. `groupBy`: a function returning `{ key, label }` per thread,
|
|
269
|
-
or false. A controller with no `scope` (the Space home) groups by page,
|
|
270
|
-
named by `scopeNames` on `useComments`; a scoped one is flat.
|
|
271
|
-
- `modes` on `useComments`: any of `text`, `point`, `box`, `items`, `time`,
|
|
272
|
-
`page` (listed in that order). Default: `point` (plus `box` with zone
|
|
273
|
-
columns) when there are anchors, `items` when you pass `onStartItems`,
|
|
274
|
-
`time` when you pass `currentTime`, and `page`. The pane's New comment
|
|
275
|
-
button lists them; `<CommentToolBar controller={comments} />` puts one
|
|
276
|
-
button per mode on the page, toggled with C (`toggleKey`, or `pinned` to
|
|
277
|
-
keep it shown), and Escape cancels a mode.
|
|
278
|
-
- `onStartItems()`: show your own picker (checkboxes, a selection), then call
|
|
279
|
-
`comments.startItems(anchors)`. `currentTime()`: the recording's moment in
|
|
280
|
-
seconds; name a Time column with `columns: { time: 'Time' }` to store it.
|
|
281
|
-
- `focusKey` defaults to the `comment` view param, so a link with
|
|
282
|
-
`comment=<root key>` opens that thread; null turns it off. Give the table
|
|
283
|
-
an `Edited at` date column so edited comments say edited, and an
|
|
284
|
-
`Answer to` text column so an answer to an agent's question reaches only
|
|
285
|
-
the agent that asked (the server adds it to an existing table on the first
|
|
286
|
-
answer, so there is nothing to do by hand).
|
|
287
|
-
|
|
288
|
-
To let people attach pictures and files to a comment or a reply
|
|
289
|
-
(paste, drop or the paperclip), give the Comments database a files column
|
|
290
|
-
named `Attachments` (or pass `columns.attachments`); there is nothing to add
|
|
291
|
-
in the view. Without the column the pane takes text only. Files open from
|
|
292
|
-
the rows for an hour, for whoever may read the row; an agent downloads one
|
|
293
|
-
from the `url` its query returns, or queries again for a fresh one.
|
|
269
|
+
Every Space page has comments, stored by Notis and listed in the host Comments panel; never create a Comments database. The comment pieces (`useComments`, `CommentPane`, `CommentPins`, `CommentToolBar`) and the agents that answer comments (`on: 'comments'`, `LOCAL_NOTIS_SPACE_COMMENT_THREADS`) are in [Comments](comments.md).
|
|
294
270
|
|
|
295
271
|
## Records and declared reads
|
|
296
272
|
|
|
@@ -385,6 +361,16 @@ there is no alias to declare and no destination request, and each call adds a
|
|
|
385
361
|
history entry unless you pass `{replace: true}`. `ListReader` with `openParam` and
|
|
386
362
|
`usePeriod` already write this way.
|
|
387
363
|
|
|
364
|
+
To send the viewer to their repository secrets (a Space cannot write secrets
|
|
365
|
+
itself), call `useNotisSettings().openSettings({ page: 'cloud-computer',
|
|
366
|
+
section: 'repository-secrets', repository: 'my-repo', add: 'env_file' })` from a
|
|
367
|
+
click (`add` is `env_file` or `variable`, both optional). Settings opens over the
|
|
368
|
+
Space with that repository's Add form open; the person types or chooses the name
|
|
369
|
+
and the value. Check `available` first: it is false on a Site, a link, a release
|
|
370
|
+
preview and in verify, so show a plain link to
|
|
371
|
+
`/manage?settings=cloud&settings_section=repository-secrets&settings_repository=my-repo&settings_add=env_file`
|
|
372
|
+
or nothing there.
|
|
373
|
+
|
|
388
374
|
## Viewer-only exploration
|
|
389
375
|
|
|
390
376
|
`viewerReads: ['databases', 'skills']` permits read-only inspection of what the
|
|
@@ -419,6 +405,25 @@ view a Space as the public (`<ViewAsPublic />`, the Share menu); agents check th
|
|
|
419
405
|
same with `LOCAL_NOTIS_RENDER_VIEW` and `view_as: "public"` (CLI
|
|
420
406
|
`notis views render <link> --view-as public`). Actions still run as the Editor.
|
|
421
407
|
|
|
408
|
+
## What ships to the Store
|
|
409
|
+
|
|
410
|
+
Only the root Space's own `defineSpace` declares `store`: its own source key and
|
|
411
|
+
each sub-Space that goes to the Store, each with the aliases of the linked items
|
|
412
|
+
that go with it. Everything unlisted stays private, and the Store refuses to
|
|
413
|
+
publish until the list exists ([Store publishing](store.md#list-what-ships-first)).
|
|
414
|
+
|
|
415
|
+
```ts
|
|
416
|
+
export default defineSpace({
|
|
417
|
+
name: 'Coding',
|
|
418
|
+
store: { ships: { coding: ['repositories'], workspaces: ['workspaces', 'new-workspace'] } },
|
|
419
|
+
// ...
|
|
420
|
+
});
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
A listed sub-Space needs its parent listed, and a listed view lists every
|
|
424
|
+
database it reads or writes: `notis spaces build` refuses otherwise, naming the
|
|
425
|
+
view and the database.
|
|
426
|
+
|
|
422
427
|
## The viewer's cloud computer
|
|
423
428
|
|
|
424
429
|
`cloudComputer: 'shell'` (or `'read'` for facts only) lets a page run one command
|
|
@@ -442,6 +447,73 @@ again. Keep a fallback (a Manager draft) for Sites, previews offline and viewers
|
|
|
442
447
|
who do not allow it. Declare it only when the page's core controls run on the
|
|
443
448
|
cloud computer.
|
|
444
449
|
|
|
450
|
+
## Connected apps
|
|
451
|
+
|
|
452
|
+
`useConnection('github')` answers the signed-in viewer's own account in a connected
|
|
453
|
+
app (`connected`, `account`, `status`) with no declaration, and `connect()` opens
|
|
454
|
+
the Portal's connect flow: call it straight from the button's click (the host
|
|
455
|
+
refuses otherwise); it resolves true once the account works. It answers
|
|
456
|
+
`available: false` on Sites, links and in verification; keep a link to
|
|
457
|
+
Integrations there. The connected app never signs `gh` in on the Cloud Computer:
|
|
458
|
+
to connect GitHub in one visible step, show one card that calls `connect()`, then
|
|
459
|
+
runs GitHub CLI's device code on the Cloud Computer and shows the code and link
|
|
460
|
+
inline. Never ask for a GitHub token in a page.
|
|
461
|
+
|
|
462
|
+
## Functions
|
|
463
|
+
|
|
464
|
+
`functions` in `defineSpace` gives the Space its own server-side code, for logic one
|
|
465
|
+
declared action cannot express: several actions in a row, a decision between them, a
|
|
466
|
+
command on the caller's cloud computer, or a built-in thread action. Each function
|
|
467
|
+
declares `description`, `kind` (`read` changes nothing, `write` changes the Space's
|
|
468
|
+
data, `action` reaches outside), a closed `input` schema, an optional `output`,
|
|
469
|
+
`expose` (`page`, `api`, `agents`; leave it out for a function only an item action,
|
|
470
|
+
a thread hook or a comment option runs), `access` (`public`, `viewer`, `editor`,
|
|
471
|
+
`key`; `editor` when left out), `uses` and `handler`, the path of a file whose
|
|
472
|
+
default export is `async (input, ctx) => result`.
|
|
473
|
+
|
|
474
|
+
The handler has no network and no secrets. It reaches only `ctx`:
|
|
475
|
+
`ctx.actions.<id>(inputs)` for the actions named in `uses.actions`,
|
|
476
|
+
`ctx.cloudComputer.facts()` and `.run({ command, cwd, timeoutMs })` with
|
|
477
|
+
`uses.cloudComputer`, and `ctx.threads.archive(threadId)` (also `unarchive`, `read`,
|
|
478
|
+
`unread`, `star`, `unstar`, `later(threadId, until)`, `back`) for the operations
|
|
479
|
+
named in `uses.threads`, only on a thread one of the Space's items is attached to.
|
|
480
|
+
`ctx.caller.role` tells who calls. Throw an `Error` to refuse: its message is shown
|
|
481
|
+
to the reader as written, so write it for them. A run lasts at most 60 seconds.
|
|
482
|
+
|
|
483
|
+
Call one from a view with `const { call, loading, error, available } =
|
|
484
|
+
useFunction('name')`, then `await call(input)`; `useFunctionQuery('name', input)`
|
|
485
|
+
for a `read`. Keep a fallback when `available` is false (verify, an older host).
|
|
486
|
+
Agents list and call the functions exposed to `agents` with
|
|
487
|
+
`LOCAL_NOTIS_SPACE_FUNCTIONS`.
|
|
488
|
+
|
|
489
|
+
Three more places run a function:
|
|
490
|
+
|
|
491
|
+
- A thread item action: `actions: { settle: { label, function: 'settle_workspace',
|
|
492
|
+
arguments: { thread: '{item.thread}' } } }` instead of `tool`. The handler also
|
|
493
|
+
gets `ctx.item` (the item and its thread).
|
|
494
|
+
- `threadHooks: { archive: 'on_archive' }`: after the person, an agent or Notis
|
|
495
|
+
archives (or `unarchive`, `read`, `unread`, `star`, `unstar`, `later`, `back`,
|
|
496
|
+
`delete`) a thread that holds one of the Space's items. The function's `input` is
|
|
497
|
+
`threadHookInput` from `@notis/sdk`: `{ event, actor, thread, items }`. A hook runs
|
|
498
|
+
after the action and cannot stop it; make it safe to run twice.
|
|
499
|
+
- `settle: { function: 'settle_workspace' }` on a thread item kind: when a read of
|
|
500
|
+
an item first lands in a `final` state (merged, closed), Notis runs the function
|
|
501
|
+
once per item and Space revision, as the thread's owner, in the background. Its
|
|
502
|
+
`input` is `threadSettleInput` from `@notis/sdk`: `{ item, thread }`; `ctx.item` is
|
|
503
|
+
set too and `ctx.via` is `thread_settle`. The kind needs a `final` state. To settle
|
|
504
|
+
the thread, declare `uses: { threads: ['archive'] }` and call
|
|
505
|
+
`ctx.threads.archive(input.thread.id)`. That archive does not run this Space's own
|
|
506
|
+
`archive` hook, so do the hook's cleanup in the settle too. Keep it under 60 s: start
|
|
507
|
+
long work detached on the cloud computer. A failure is only logged.
|
|
508
|
+
- A hook or a settle that uses the cloud computer runs only when the thread's owner
|
|
509
|
+
allowed the Space's current revision. Without that, nothing fails: the item needs
|
|
510
|
+
the person, with **Allow** in the thread's panel, and the run happens once they
|
|
511
|
+
allow (from the panel or the Space's page). A waiting settle brings the thread back
|
|
512
|
+
to the inbox. Every Store update needs a new approval, so expect this after an update.
|
|
513
|
+
- `commentOptions: { approve: { label: 'Approve', function: 'approve_change' } }`:
|
|
514
|
+
when a person picks that label among a choice comment's options (an agent's own
|
|
515
|
+
answer never runs it). The function's `input` is `commentOptionInput`.
|
|
516
|
+
|
|
445
517
|
## Visual data and Markdown
|
|
446
518
|
|
|
447
519
|
Give a chart its numbers through `RenderChartData` (the toolkit's `Chart`,
|
|
@@ -471,9 +543,9 @@ extracts tables, lists, controls and visible document/HTML content automatically
|
|
|
471
543
|
`DocumentPage` breadcrumb moves into the top bar on wide
|
|
472
544
|
screens and stays in the page only on narrow ones, so never draw your own
|
|
473
545
|
title or breadcrumb row. Do not duplicate host chrome.
|
|
474
|
-
- `useActiveResource` publishes the current resource; `useAgentContext
|
|
475
|
-
`NotisSelectionBoundary
|
|
476
|
-
|
|
546
|
+
- `useActiveResource` publishes the current resource; `useAgentContext` and
|
|
547
|
+
`NotisSelectionBoundary` support explicit reference context.
|
|
548
|
+
[Context sharing](context.md) owns the contract.
|
|
477
549
|
- `Dialog` supplies a themed modal with focus handling; while it is open, only
|
|
478
550
|
its own keys and Escape work. For a confirmation (delete, discard), pass
|
|
479
551
|
`nativeOnTouch` and mark the buttons `data-dialog-confirm` and
|
|
@@ -16,11 +16,34 @@ link. A link or team listing goes live as soon as the user presses Share; a
|
|
|
16
16
|
public listing goes to the sandbox reviewer, and Notis messages the user with
|
|
17
17
|
its result.
|
|
18
18
|
|
|
19
|
+
## List what ships first
|
|
20
|
+
|
|
21
|
+
Only what the root's source lists goes to the Store; everything else stays in
|
|
22
|
+
the user's account, including anything they link later. Before preparing, the
|
|
23
|
+
root's own `defineSpace` declares `store: { ships: { <source key>: [<alias>, ...] } }`
|
|
24
|
+
with its own source key and each sub-Space that ships, each with the aliases
|
|
25
|
+
of the linked items (databases, Skills, automations, pages) that go with it.
|
|
26
|
+
Ask the user which sub-Spaces and items to share when it is not obvious, and
|
|
27
|
+
keep personal ones out. Deploy the root, then prepare. Without the list
|
|
28
|
+
`store_prepare` is refused with `store_ships_undeclared` (an update of a
|
|
29
|
+
listing already in the Store too); `store_ships_unknown` names a key or alias
|
|
30
|
+
the Space does not have, `store_ships_ambiguous` a key two sub-Spaces share
|
|
31
|
+
(a copy built from the same source: give each its own key), and
|
|
32
|
+
`store_ships_parent_private` a listed sub-Space whose parent is not listed,
|
|
33
|
+
and `store_ships_main_view_private` a listed database whose record view sits in
|
|
34
|
+
a Space or link that stays private (list that view and its link too).
|
|
35
|
+
Every Space between the root and a shipped one needs published source: a
|
|
36
|
+
folder made in the Portal has no key to list, so deploy it from source first. A listed view must list every database it reads or
|
|
37
|
+
writes, or the scan raises a red `view_database_private` finding. Spaces inside
|
|
38
|
+
records travel with their record and are never listed.
|
|
39
|
+
|
|
19
40
|
## The flow
|
|
20
41
|
|
|
21
42
|
All steps use `LOCAL_NOTIS_MANAGE_SPACE`. Each answer is the submission view:
|
|
22
43
|
status, listing text, locales, sample rows and counts, screenshots, findings,
|
|
23
|
-
`
|
|
44
|
+
`ships` (`shipped` and `private`: the Spaces and linked items that go to the
|
|
45
|
+
Store and the ones that stay private), `can_publish`, `blocked_reason` and `link`.
|
|
46
|
+
Tell the user both lists before sending the link.
|
|
24
47
|
|
|
25
48
|
1. **Prepare.** Call `store_prepare {space_id, request_id}` with the root of the
|
|
26
49
|
tree to publish and a stable request ID. Notis copies the tree into the
|
|
@@ -293,6 +293,15 @@ export interface CiteSelectionBarProps {
|
|
|
293
293
|
root: RefObject<HTMLElement | null>;
|
|
294
294
|
/** Receives the cited text once the bar has cleared the selection. */
|
|
295
295
|
onCite(range: Range, text: string): void;
|
|
296
|
+
/** False hides Cite (a surface with nowhere to send a quote). Default true. */
|
|
297
|
+
cite?: boolean;
|
|
298
|
+
/**
|
|
299
|
+
* Adds Comment after Cite (a Space page while the host takes comments): receives the selected range and text once
|
|
300
|
+
* the bar has cleared the selection.
|
|
301
|
+
*/
|
|
302
|
+
onComment?(range: Range, text: string): void;
|
|
303
|
+
/** Whether this selection may be commented on with the bar's Comment (default: any it shows for). */
|
|
304
|
+
canComment?(range: Range): boolean;
|
|
296
305
|
enabled?: boolean;
|
|
297
306
|
accept?: UseSelectionAnchorOptions['accept'];
|
|
298
307
|
/**
|
|
@@ -304,15 +313,39 @@ export interface CiteSelectionBarProps {
|
|
|
304
313
|
}
|
|
305
314
|
|
|
306
315
|
/**
|
|
307
|
-
* The
|
|
308
|
-
*
|
|
316
|
+
* The Comment action of a selection bar: the same words and glyph everywhere; it clears the selection and hides the
|
|
317
|
+
* bar before handing over the selected range and text.
|
|
318
|
+
*/
|
|
319
|
+
export function commentSelectionAction(locale: keyof typeof SELECTION_BAR_WORDS.comment, anchor: SelectionAnchor,
|
|
320
|
+
root: RefObject<HTMLElement | null>, dismiss: () => void, onComment: (range: Range, text: string) => void): SelectionBarAction {
|
|
321
|
+
return {
|
|
322
|
+
key: 'comment', label: SELECTION_BAR_WORDS.comment[locale], icon: COMMENT_GLYPH,
|
|
323
|
+
onSelect: () => {
|
|
324
|
+
const { range, text } = anchor;
|
|
325
|
+
clearSelectionIn(root.current);
|
|
326
|
+
dismiss();
|
|
327
|
+
onComment(range, text);
|
|
328
|
+
},
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* The bar every quoting surface shows (chat, Space views, Skills and automations; truth PRT-087): it follows the
|
|
334
|
+
* selection in `root`, measures itself, and hands the cited text to `onCite`. With `onComment` (a Space page while the
|
|
335
|
+
* host takes comments) it also offers Comment.
|
|
309
336
|
*/
|
|
310
|
-
export function CiteSelectionBar({ root, onCite, enabled = true, accept, portal }: CiteSelectionBarProps) {
|
|
337
|
+
export function CiteSelectionBar({ root, onCite, cite = true, onComment, canComment, enabled = true, accept, portal }: CiteSelectionBarProps) {
|
|
311
338
|
const locale = useToolkitLocale();
|
|
312
339
|
const [barSize, setBarSize] = useState({ width: 72, height: 32 });
|
|
313
|
-
const { anchor, dismiss } = useSelectionAnchor(root, { enabled, accept, barSize });
|
|
340
|
+
const { anchor, dismiss } = useSelectionAnchor(root, { enabled: enabled && (cite || Boolean(onComment)), accept, barSize });
|
|
314
341
|
if (!anchor) return null;
|
|
315
|
-
const
|
|
342
|
+
const actions: SelectionBarAction[] = [];
|
|
343
|
+
if (cite) actions.push(citeSelectionAction(locale, anchor, root, dismiss, onCite));
|
|
344
|
+
if (onComment && (!canComment || canComment(anchor.range))) {
|
|
345
|
+
actions.push(commentSelectionAction(locale, anchor, root, dismiss, onComment));
|
|
346
|
+
}
|
|
347
|
+
if (!actions.length) return null;
|
|
348
|
+
const bar = <SelectionActionBar anchor={anchor} onSize={setBarSize} actions={actions} />;
|
|
316
349
|
return portal ? portal(bar) : bar;
|
|
317
350
|
}
|
|
318
351
|
|
|
@@ -336,8 +369,10 @@ export function SelectionActionBar({ anchor, actions, onSize }: {
|
|
|
336
369
|
onSize?(size: { width: number; height: number }): void;
|
|
337
370
|
}) {
|
|
338
371
|
const bar = useRef<HTMLDivElement>(null);
|
|
339
|
-
|
|
340
|
-
|
|
372
|
+
// The Cite key cites: never another action (a bar without Cite ignores it).
|
|
373
|
+
const citeAction = actions.find(action => action.key === 'cite') ?? (actions[0]?.key === 'comment' ? undefined : actions[0]);
|
|
374
|
+
const first = useRef(citeAction);
|
|
375
|
+
first.current = citeAction;
|
|
341
376
|
const [left, setLeft] = useState(anchor.left);
|
|
342
377
|
// A finger needs a bigger target than the 26 px a pointer gets.
|
|
343
378
|
const coarse = typeof window !== 'undefined' && isCoarsePointer(window);
|