@notis_ai/cli 0.2.29 → 0.2.30
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 +25 -8
- package/dist/agent-hooks/notis-agent-hook.mjs +1030 -610
- package/dist/base-skills/notis-cli/.notis-base-skill.json +1 -1
- package/dist/base-skills/notis-cli/SKILL.md +11 -0
- package/dist/base-skills/notis-spaces/.notis-base-skill.json +1 -1
- package/dist/base-skills/notis-spaces/references/release.md +6 -5
- package/dist/base-skills/notis-spaces/references/sdk.md +82 -17
- package/dist/sdk/src/hooks/useThreadItem.ts +56 -0
- package/dist/sdk/src/index.ts +6 -1
- package/dist/sdk/src/runtime.ts +8 -1
- package/dist/sdk/src/space.ts +230 -0
- package/dist/skill-sync-worker.mjs +185 -30
- package/dist/space-harness/host.js +237 -93
- package/dist/space-sdk/dist/{chunk-BFGB6XXC.js → chunk-6GJ2BS7B.js} +1 -3
- package/dist/space-sdk/dist/index.js +4 -2
- package/dist/space-sdk/dist/ui.js +18 -13
- package/dist/space-sdk/src/hooks/useThreadItem.d.ts +28 -0
- package/dist/space-sdk/src/index.d.ts +3 -1
- package/dist/space-sdk/src/runtime.d.ts +8 -1
- package/dist/space-sdk/src/space.ts +230 -0
- package/dist/space-sdk/src/tailwind-candidates.d.ts +492 -14
- package/dist/space-sdk/src/ui/actions/useToast.d.ts +2 -0
- package/dist/space-sdk/src/ui/comments/CommentPane.d.ts +56 -10
- package/dist/space-sdk/src/ui/comments/PassageComments.d.ts +16 -7
- package/dist/space-sdk/src/ui/comments/agentRuntime.d.ts +59 -0
- package/dist/space-sdk/src/ui/comments/commentFiles.d.ts +5 -2
- package/dist/space-sdk/src/ui/comments/commentModel.d.ts +103 -8
- package/dist/space-sdk/src/ui/comments/commentWords.d.ts +82 -0
- package/dist/space-sdk/src/ui/comments/hostComments.d.ts +37 -0
- package/dist/space-sdk/src/ui/comments/index.d.ts +4 -0
- package/dist/space-sdk/src/ui/comments/paneParts.d.ts +119 -0
- package/dist/space-sdk/src/ui/comments/useCommentRouting.d.ts +75 -0
- package/dist/space-sdk/src/ui/comments/useComments.d.ts +147 -15
- package/dist/space-sdk/src/ui/comments/usePassageComments.d.ts +24 -8
- package/dist/space-sdk/src/ui/index.d.ts +2 -1
- package/dist/space-sdk/src/ui/layout/SidePane.d.ts +6 -1
- package/dist/space-sdk/src/ui/overlay/Tooltip.d.ts +8 -2
- package/dist/space-sdk/src/ui/styles.d.ts +27 -5
- package/dist/view-renderer/dist/host.js +307 -163
- package/dist/view-renderer/src/host.tsx +6 -3
- package/dist/view-renderer/src/renderer.js +25 -2
- package/package.json +3 -3
- package/skills/notis-cli/AGENT_INSTRUCTIONS.md +2 -1
- package/skills/notis-spaces/cli.md +8 -8
- package/src/cli.js +10 -2
- package/src/command-specs/computer.js +21 -1
- package/src/command-specs/profile.js +12 -5
- package/src/command-specs/spaces.js +30 -16
- package/src/runtime/agent-identity.js +187 -0
- package/src/runtime/api-hosts.js +92 -0
- package/src/runtime/channel.js +3 -7
- package/src/runtime/oauth.js +95 -4
- package/src/runtime/profiles.js +200 -41
- package/src/runtime/skill-sync-service.js +4 -5
- package/src/runtime/space-platform.js +2 -0
- package/src/runtime/space-source.js +66 -1
- package/src/runtime/space-test-server.js +20 -4
- package/src/runtime/space-verification.js +5 -1
- package/src/runtime/telemetry.js +14 -1
- package/src/runtime/transport.js +12 -0
- package/src/runtime/upsell.js +3 -6
- package/src/runtime/view-render.js +3 -1
- package/src/skill-sync-worker.js +13 -2
- package/src/space-harness-host.ts +6 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"schema":1,"stamp":
|
|
1
|
+
{"schema":1,"stamp":1794658649,"commit":"c85c7d62766a6561de18ec338247843d089cadae"}
|
|
@@ -57,6 +57,17 @@ Two rules follow from the dev credential being scoped to that local backend:
|
|
|
57
57
|
- A `dev-*` profile only exists while its `./dev.sh` lease is running. If it is stopped, the CLI fails with `dev_runtime_unavailable` instead of sending the test user's token to the live API.
|
|
58
58
|
- To reach a real account from inside a worktree — including when the local backend is wedged — name a real profile explicitly: `notis --profile <name> ...`. That is the supported escape hatch.
|
|
59
59
|
|
|
60
|
+
## Declare who you are before writing
|
|
61
|
+
|
|
62
|
+
When you are an agent (Claude Code, Codex, a script) and not the person typing, name yourself so what you write is yours, not the person's: a comment then shows your name as its author, never counts as the person's comment and never wakes you up. Pick a fresh lowercase imaginary rock-band name (lowercase letters and digits in at least two words joined by hyphens, 3 to 60 characters, such as `fred-and-the-machine`, shown as "Fred And The Machine") and set it once per session:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
export NOTIS_AGENT_NAME="fred-and-the-machine" # your band name
|
|
66
|
+
export NOTIS_AGENT_THREAD="<Notis thread id>" # optional
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
or pass `--agent-name` and `--agent-thread` on a single command (a flag wins over its variable). The CLI generates one id for each name the first time it is used on the computer and keeps sending it, so you edit or delete only your own comments; set `NOTIS_AGENT_ID` (or `--agent-id`) only to override it. Name a Notis thread only when you work for one of the person's Notis threads: replies to your comments then wake that thread; anything else is kept as a label. Declarations take effect where the person has unified comments on (being rolled out); elsewhere Notis ignores them and writes count as the person's, as before. With unified comments on, every comment written through the CLI needs the name, even one the person types: without it the write is refused (`agent_name_required`), and a name sent without an id is refused too (`agent_id_required`). Other writes with the person's own sign-in and no name are the person's. A name that breaks the rule is sent as written and the server refuses the call (`invalid_agent_identity`) where unified comments are on, reads included; elsewhere it is ignored. A declaration names you; it never gives access to anything more. The Notis assistant itself never writes comments (`orchestrator_comments_refused`): it starts a sub-agent for comment work, signed with that sub-agent's band name.
|
|
70
|
+
|
|
60
71
|
## Critical rule for missing tools
|
|
61
72
|
|
|
62
73
|
If the tool you need is not already available in your current tool surface, do not stop and do not assume the task is blocked.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"schema":1,"stamp":
|
|
1
|
+
{"schema":1,"stamp":1794658649,"commit":"c85c7d62766a6561de18ec338247843d089cadae"}
|
|
@@ -18,9 +18,11 @@ Ordinary data and resource edits apply immediately; only source needs a release.
|
|
|
18
18
|
`.notis/space-lock.json`, resources, source key and current revisions. Never
|
|
19
19
|
silently advance a stale checkout or create a duplicate to avoid a conflict.
|
|
20
20
|
2. **Build.** Edit the selected definition, its view and linked Skill files.
|
|
21
|
-
Run `spaces build <dir
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
Run `spaces build <dir>`; it freezes source and artifact bytes and validates
|
|
22
|
+
the view contract and design. A pulled folder holds one Space; a workspace
|
|
23
|
+
with several needs `--space <key>` on build, verify and deploy.
|
|
24
|
+
3. **Verify.** Run `spaces verify <dir>`. A pulled folder targets the Space it
|
|
25
|
+
was pulled from; anything else needs `--space-id <space-id>`.
|
|
24
26
|
This checks current action authorizations and renders explicit fictional
|
|
25
27
|
fixtures at 390px and 1440px with the shared read-only renderer. Provide exact
|
|
26
28
|
action/list/body/record fixtures. A denied read, write-on-load or failed width
|
|
@@ -28,8 +30,7 @@ Ordinary data and resource edits apply immediately; only source needs a release.
|
|
|
28
30
|
Missing browser tooling blocks release: install `agent-browser` and make it
|
|
29
31
|
available on PATH.
|
|
30
32
|
4. **Publish source.** Deploy the frozen, verified snapshot, not edits made after
|
|
31
|
-
verification: `spaces deploy <dir> --
|
|
32
|
-
--request-id <stable-id>`. Or `spaces preview` seals a candidate, and
|
|
33
|
+
verification: `spaces deploy <dir> --request-id <stable-id>`. Or `spaces preview` seals a candidate, and
|
|
33
34
|
`spaces promote <release-id> <dir>` publishes that exact candidate. Preview
|
|
34
35
|
authoring never silently gains live record-edit authority. Deployment updates
|
|
35
36
|
the selected Space, not siblings or the Store.
|
|
@@ -32,10 +32,13 @@ Text a person writes and reviews:
|
|
|
32
32
|
- Comments on selected words of a text property (a Markdown body, a subject)
|
|
33
33
|
come from `@notis/sdk/ui`: `usePassageComments` with `CommentableText` around
|
|
34
34
|
an input or textarea, `CommentableRichText` around the `MarkdownEditor` or
|
|
35
|
-
rendered Markdown, and
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
rendered Markdown, and `<PassageCommentPane comments={comments} />` mounted
|
|
36
|
+
once anywhere in the view (it draws in the host Comments panel, never in a
|
|
37
|
+
`SidePane`). The Comments database needs Field, Quote, Prefix and Suffix
|
|
38
|
+
columns; a thread whose words are gone reads Passage changed and stays open.
|
|
39
|
+
It lists newest first; pass `order="reading"` to list the text's threads in
|
|
40
|
+
reading order. Do not build your own highlights. Pins on a page use
|
|
41
|
+
`useComments` with `CommentPane` (see [Comments](#comments)).
|
|
39
42
|
|
|
40
43
|
## Toolkit pieces
|
|
41
44
|
|
|
@@ -122,19 +125,8 @@ rather than from a copy.
|
|
|
122
125
|
button, `viewerActions` adds viewer buttons (class `nui-viewer-btn`) and
|
|
123
126
|
`onNotice` hears copy and download results. Use `ImageViewer` alone for a
|
|
124
127
|
picture that opens full screen. Do not build your own lightbox.
|
|
125
|
-
- **Comments**: `useComments` with `CommentPane` and `CommentPins` give
|
|
126
|
-
threads on a Comments database (
|
|
127
|
-
changes). A comment is signed with the viewer's first name; when the
|
|
128
|
-
Comments database's Author is a choice list, give it a `Person` option, which
|
|
129
|
-
signs anyone it does not name (without it the comment saves with no author).
|
|
130
|
-
Pass `me` only to sign with a fixed name. For comments on a whole record with nothing to pin on, pass no
|
|
131
|
-
`anchors` and `columns.anchor: null`: the pane offers New comment itself.
|
|
132
|
-
To let people attach pictures and files to a comment or a reply
|
|
133
|
-
(paste, drop or the paperclip), give the Comments database a files column
|
|
134
|
-
named `Attachments` (or pass `columns.attachments`); there is nothing to add
|
|
135
|
-
in the view. Without the column the pane takes text only. Files open from
|
|
136
|
-
the rows for an hour, for whoever may read the row; an agent downloads one
|
|
137
|
-
from the `url` its query returns, or queries again for a fresh one.
|
|
128
|
+
- **Comments**: `useComments` with `CommentPane` and `CommentPins` give comment
|
|
129
|
+
threads on a Comments database; see [Comments](#comments).
|
|
138
130
|
- **Presenting on a second screen**: `useAudienceScreen({ onAction, onClose,
|
|
139
131
|
title })` works like PowerPoint. `secondScreen` says whether another screen
|
|
140
132
|
is connected; call `open(anchor)` from the Present press itself. It answers
|
|
@@ -186,6 +178,75 @@ A status maps to one of ten groups (`backlog`, `todo`, `active`, `review`,
|
|
|
186
178
|
with its icon, words and the one status palette: pass the Space's own status to
|
|
187
179
|
`Row` or `StatusIcon` (with `label` for its own name).
|
|
188
180
|
|
|
181
|
+
## Comments
|
|
182
|
+
|
|
183
|
+
`useComments` with `CommentPane` and `CommentPins` give comment
|
|
184
|
+
threads on a Comments database (pins, zones, replies, asks, Archive, Delete,
|
|
185
|
+
Edit, Copy changes). The pane draws in the host Comments panel beside the
|
|
186
|
+
chat, not where it is mounted: mount `<CommentPane controller={comments} />`
|
|
187
|
+
once anywhere in the view and never wrap it in `SidePane` (a `SidePane` given
|
|
188
|
+
a comment pane shows its page alone). While comments are off for the viewer,
|
|
189
|
+
or on a Site, a link or a preview, the pane, pins and tool bar render nothing:
|
|
190
|
+
never build a fallback comment list. The host owns archive (Status
|
|
191
|
+
`Resolved`, shown Done), delete with Undo, editing your own comment, the
|
|
192
|
+
Open/Done/All filter, the Goes to line and To chip that name the thread a
|
|
193
|
+
comment goes to, `comment=` links and push; the server checks who may change
|
|
194
|
+
a comment and writes `Author` itself (the person's name, or the agent's on
|
|
195
|
+
an agent's comment, adding the select choice when it is missing), so never
|
|
196
|
+
set `Author` from the view or let people pick it. On someone else's comment
|
|
197
|
+
people only archive, reopen, delete (with edit rights) or answer it: every
|
|
198
|
+
other column is its author's, and agents change only what they wrote. Every
|
|
199
|
+
Comments table is followed for waiting comments and push, with or without
|
|
200
|
+
`agents`, and a person's comments, replies and answers go to the thread they
|
|
201
|
+
name even in a Space that declares no `agents`: an answer, or a reply in a
|
|
202
|
+
thread an agent started, goes back to that agent's own thread and subagent,
|
|
203
|
+
and editing a comment wakes an agent only when it replied after the comment.
|
|
204
|
+
A reply under a deleted comment is refused (`comment_not_found`). Every
|
|
205
|
+
comment written through the Notis CLI needs the writing agent's band name
|
|
206
|
+
(`NOTIS_AGENT_NAME` or `--agent-name`, such as `fred-and-the-machine`; the
|
|
207
|
+
rule and the id the CLI keeps per name are in the notis-cli skill): the
|
|
208
|
+
comment is then that agent's, signed "Fred And The Machine", and never wakes
|
|
209
|
+
it. Without a name it is refused (`agent_name_required`), even for a person
|
|
210
|
+
typing the CLI, and a view never writes comments with a Cloud Computer
|
|
211
|
+
credential. The Notis assistant never writes comments itself
|
|
212
|
+
(`orchestrator_comments_refused`): it starts a sub-agent for comment work,
|
|
213
|
+
which signs with its own band name. On a host without the Comments panel a
|
|
214
|
+
comment is signed with the viewer's first name; when the Comments
|
|
215
|
+
database's Author is a choice list, give it a `Person` option, which signs
|
|
216
|
+
anyone it does not name (without it the comment saves with no author). Pass
|
|
217
|
+
`me` only to sign with a fixed name. For comments on a whole record with
|
|
218
|
+
nothing to pin on, pass no `anchors` and `columns.anchor: null`: the pane
|
|
219
|
+
offers New comment itself.
|
|
220
|
+
|
|
221
|
+
Options:
|
|
222
|
+
- `order` on the pane: `'newest'` (default), `'oldest'`, `'anchor'` or a
|
|
223
|
+
comparator. `groupBy`: a function returning `{ key, label }` per thread,
|
|
224
|
+
or false. A controller with no `scope` (the Space home) groups by page,
|
|
225
|
+
named by `scopeNames` on `useComments`; a scoped one is flat.
|
|
226
|
+
- `modes` on `useComments`: any of `text`, `point`, `box`, `items`, `time`,
|
|
227
|
+
`page` (listed in that order). Default: `point` (plus `box` with zone
|
|
228
|
+
columns) when there are anchors, `items` when you pass `onStartItems`,
|
|
229
|
+
`time` when you pass `currentTime`, and `page`. The pane's New comment
|
|
230
|
+
button lists them; `<CommentToolBar controller={comments} />` puts one
|
|
231
|
+
button per mode on the page, toggled with C (`toggleKey`, or `pinned` to
|
|
232
|
+
keep it shown), and Escape cancels a mode.
|
|
233
|
+
- `onStartItems()`: show your own picker (checkboxes, a selection), then call
|
|
234
|
+
`comments.startItems(anchors)`. `currentTime()`: the recording's moment in
|
|
235
|
+
seconds; name a Time column with `columns: { time: 'Time' }` to store it.
|
|
236
|
+
- `focusKey` defaults to the `comment` view param, so a link with
|
|
237
|
+
`comment=<root key>` opens that thread; null turns it off. Give the table
|
|
238
|
+
an `Edited at` date column so edited comments say edited, and an
|
|
239
|
+
`Answer to` text column so an answer to an agent's question reaches only
|
|
240
|
+
the agent that asked (the server adds it to an existing table on the first
|
|
241
|
+
answer, so there is nothing to do by hand).
|
|
242
|
+
|
|
243
|
+
To let people attach pictures and files to a comment or a reply
|
|
244
|
+
(paste, drop or the paperclip), give the Comments database a files column
|
|
245
|
+
named `Attachments` (or pass `columns.attachments`); there is nothing to add
|
|
246
|
+
in the view. Without the column the pane takes text only. Files open from
|
|
247
|
+
the rows for an hour, for whoever may read the row; an agent downloads one
|
|
248
|
+
from the `url` its query returns, or queries again for a fresh one.
|
|
249
|
+
|
|
189
250
|
## Records and declared reads
|
|
190
251
|
|
|
191
252
|
| API | Use |
|
|
@@ -251,6 +312,10 @@ in component props.
|
|
|
251
312
|
once the host has taken the navigation and rejects when the host refuses it:
|
|
252
313
|
`await` it (or `void` it in a click handler). Prefer declared portable navigation
|
|
253
314
|
aliases for sibling destinations; the host resolves them under current access.
|
|
315
|
+
Declare each alias in `navigation`, then bind it once per Space with
|
|
316
|
+
`notis spaces navigation bind <space-id> --alias <name> --target '{"space_id":"<id>"}' --revision <n>`
|
|
317
|
+
before you deploy: a binding takes effect at the next deploy, and an unbound name
|
|
318
|
+
fails verify with `navigation_unavailable`.
|
|
254
319
|
Use declared params for view state, for example `{params: {project: key, period: 'week'}}`.
|
|
255
320
|
The destination drops unknown params and authorizes referenced records. Changing
|
|
256
321
|
a slug cannot change identity. Agents cite current server-returned links.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useCallback, useEffect } from 'react';
|
|
4
|
+
import { useQuery } from './useQuery';
|
|
5
|
+
import { useNotisRuntime } from '../provider';
|
|
6
|
+
import type { SpaceThreadItem, SpaceThreadItemRun } from '../space';
|
|
7
|
+
|
|
8
|
+
export interface UseThreadItemResult {
|
|
9
|
+
/** The attached item this page draws, or null while reading or when the page is not opened for one. */
|
|
10
|
+
item: SpaceThreadItem | null;
|
|
11
|
+
loading: boolean;
|
|
12
|
+
error: Error | null;
|
|
13
|
+
/**
|
|
14
|
+
* Run one of the item's actions (its `actions[].id`). Notis asks the person first when the action
|
|
15
|
+
* confirms, then reads the item again; `ran` is false when they cancelled. Resolves `{ ran: false }`
|
|
16
|
+
* on hosts that cannot run actions.
|
|
17
|
+
*/
|
|
18
|
+
run: (actionId: string) => Promise<SpaceThreadItemRun>;
|
|
19
|
+
/** False outside a thread's panel and on hosts without thread items (Sites, links, the dev harness). */
|
|
20
|
+
available: boolean;
|
|
21
|
+
refresh: () => Promise<Error | null>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The live item (a pull request, an order) a thread's panel shows on this page, from the view's
|
|
26
|
+
* `threadItems` declaration. Notis keeps it fresh; the page reads it again about every minute.
|
|
27
|
+
*
|
|
28
|
+
* ```tsx
|
|
29
|
+
* const { item, run } = useThreadItem();
|
|
30
|
+
* if (!item) return null;
|
|
31
|
+
* return <>{item.title} {item.actions.map(action =>
|
|
32
|
+
* <Button key={action.id} onClick={() => void run(action.id)}>{text(action.label)}</Button>)}</>;
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export function useThreadItem(): UseThreadItemResult {
|
|
36
|
+
const runtime = useNotisRuntime();
|
|
37
|
+
const transport = runtime?.resource?.kind === 'space' ? runtime.spaceThreadItem : undefined;
|
|
38
|
+
const query = useQuery<SpaceThreadItem | null>(['thread-item'], async () => (transport ? transport.current() : null),
|
|
39
|
+
{ readOnly: true, enabled: Boolean(transport), staleTimeMs: 30_000 });
|
|
40
|
+
const { refetch } = query;
|
|
41
|
+
// The panel's host reads the item again about every minute while the thread is open (SPC-098).
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!transport) return undefined;
|
|
44
|
+
const timer = setInterval(() => { void refetch(); }, 60_000);
|
|
45
|
+
return () => clearInterval(timer);
|
|
46
|
+
}, [refetch, transport]);
|
|
47
|
+
const run = useCallback(async (actionId: string): Promise<SpaceThreadItemRun> => {
|
|
48
|
+
const item = query.data;
|
|
49
|
+
if (!transport || !item) return { ran: false };
|
|
50
|
+
const result = await transport.run(item.id, actionId);
|
|
51
|
+
if (result.ran) await refetch();
|
|
52
|
+
return result;
|
|
53
|
+
}, [query.data, refetch, transport]);
|
|
54
|
+
return { item: query.data ?? null, loading: query.loading, error: query.error, run,
|
|
55
|
+
available: Boolean(transport), refresh: query.refetch };
|
|
56
|
+
}
|
package/dist/sdk/src/index.ts
CHANGED
|
@@ -38,7 +38,10 @@ export type { SpaceCloudComputerLevel, SpaceCloudComputerOperation, SpaceCloudCo
|
|
|
38
38
|
SpaceCloudComputerImportResult } from './space';
|
|
39
39
|
export type { SpaceViewerReadFamily, SpaceViewerReadOperation, SpaceViewerReadInput, SpaceViewerReadResult, SpaceViewerLink,
|
|
40
40
|
SpaceViewerDatabase, SpaceViewerDatabaseSchema, SpaceViewerSkill, SpaceViewerSkillPage } from './space';
|
|
41
|
-
export type { SpaceAgentDeclaration, SpaceItemThread, SpaceAgentQueue, SpaceAgentsStatus, SpaceThreadsTransport
|
|
41
|
+
export type { SpaceAgentDeclaration, SpaceItemThread, SpaceAgentQueue, SpaceAgentsStatus, SpaceThreadsTransport,
|
|
42
|
+
SpaceThreadItemText, SpaceThreadItemCondition, SpaceThreadItemState, SpaceThreadItemConfirm, SpaceThreadItemAction,
|
|
43
|
+
SpaceThreadItemKind, SpaceThreadItem, SpaceThreadItemRun, SpaceThreadItemTransport,
|
|
44
|
+
SpaceCommentSource, SpaceCommentsTransport, SpaceCommentViewer, SpaceCommentThreadRef, SpaceCommentThreadPick } from './space';
|
|
42
45
|
export { SpaceActionError, SpaceNavigationCancelled, isSpaceNavigationCancelled } from './space';
|
|
43
46
|
export { spaceAudience, spaceMarksEditorsOnly, publicSpaceDescriptor, withoutEditorColumns } from './space';
|
|
44
47
|
export type { SpaceAudience, SpaceEditorsOnly, SpaceResourceColumns, EditorOnlyColumns, AudienceRow } from './space';
|
|
@@ -75,6 +78,8 @@ export { useCloudComputer } from './hooks/useCloudComputer';
|
|
|
75
78
|
export type { UseCloudComputerResult } from './hooks/useCloudComputer';
|
|
76
79
|
export { useItemThread } from './hooks/useItemThread';
|
|
77
80
|
export type { UseItemThreadResult } from './hooks/useItemThread';
|
|
81
|
+
export { useThreadItem } from './hooks/useThreadItem';
|
|
82
|
+
export type { UseThreadItemResult } from './hooks/useThreadItem';
|
|
78
83
|
export { useAgentQueue, AGENT_QUEUE_WORDS } from './hooks/useAgentQueue';
|
|
79
84
|
export type { UseAgentQueueResult, AgentQueueStatus } from './hooks/useAgentQueue';
|
|
80
85
|
export { useCloudComputerShell } from './hooks/useCloudComputerShell';
|
package/dist/sdk/src/runtime.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type { AgentContextContent, AgentContextItem, AgentContextSource } from '
|
|
|
11
11
|
import type { ComponentType, ReactNode } from 'react';
|
|
12
12
|
import type { NotisQueryClient } from './queryCache';
|
|
13
13
|
import type { NotisSpaceSkeleton } from './skeleton';
|
|
14
|
-
import type { SpaceRuntimeDescriptor, SpaceActionOptions, SpaceDocumentBodyRequest, SpaceDocumentBodyResult, SpaceViewerReadOperation, SpaceShownOptions, SpaceCloudComputerTransport, SpaceFilesTransport, SpaceThreadsTransport } from './space';
|
|
14
|
+
import type { SpaceRuntimeDescriptor, SpaceActionOptions, SpaceDocumentBodyRequest, SpaceDocumentBodyResult, SpaceViewerReadOperation, SpaceShownOptions, SpaceCloudComputerTransport, SpaceFilesTransport, SpaceThreadsTransport, SpaceThreadItemTransport, SpaceCommentsTransport } from './space';
|
|
15
15
|
|
|
16
16
|
// ---------------------------------------------------------------------------
|
|
17
17
|
// Database types
|
|
@@ -630,6 +630,13 @@ export interface NotisRuntime {
|
|
|
630
630
|
* older hosts.
|
|
631
631
|
*/
|
|
632
632
|
spaceThreads?: SpaceThreadsTransport;
|
|
633
|
+
/** The thread item a page draws in a thread's panel, and its actions. Signed-in Portal viewers only. */
|
|
634
|
+
spaceThreadItem?: SpaceThreadItemTransport;
|
|
635
|
+
/**
|
|
636
|
+
* Space-only host Comments panel: comment controllers attach here and the host lists and answers their threads beside
|
|
637
|
+
* the chat. Absent while comments are off for the viewer, on Sites, links, previews and older hosts.
|
|
638
|
+
*/
|
|
639
|
+
spaceComments?: SpaceCommentsTransport;
|
|
633
640
|
/** Authenticated runtime identity; app below is presentation metadata only. */
|
|
634
641
|
resource?: RuntimeResource;
|
|
635
642
|
/** Optional host-scoped in-memory read cache. Older hosts remain supported. */
|
package/dist/sdk/src/space.ts
CHANGED
|
@@ -80,6 +80,222 @@ export interface SpaceThreadsTransport {
|
|
|
80
80
|
agentStatus(agentId: string, scope?: string): Promise<SpaceAgentsStatus>;
|
|
81
81
|
approveAgents(): Promise<{ approved: boolean; released: number }>;
|
|
82
82
|
}
|
|
83
|
+
|
|
84
|
+
/** Words shown to people: one string, or one per language (`en` required). */
|
|
85
|
+
export type SpaceThreadItemText = string | { en: string; fr?: string };
|
|
86
|
+
/**
|
|
87
|
+
* A condition on the item's last read. `path` starts with `data.` (the read action's answer) or `item.`
|
|
88
|
+
* (the attached inputs); `*` in a path flattens a list, and a condition on a list matches when any value does.
|
|
89
|
+
*/
|
|
90
|
+
export type SpaceThreadItemCondition =
|
|
91
|
+
| { path: string; equals: string | number | boolean | null }
|
|
92
|
+
| { path: string; in: Array<string | number | boolean | null> }
|
|
93
|
+
| { path: string; exists: boolean }
|
|
94
|
+
| { all: SpaceThreadItemCondition[] }
|
|
95
|
+
| { any: SpaceThreadItemCondition[] }
|
|
96
|
+
| { not: SpaceThreadItemCondition };
|
|
97
|
+
/** One state of a kind. States are tried in order; the first whose `when` matches wins, and the last has no `when`. */
|
|
98
|
+
export interface SpaceThreadItemState {
|
|
99
|
+
id: string;
|
|
100
|
+
label: SpaceThreadItemText;
|
|
101
|
+
/** `phosphor:<kebab-name>`, shown on the panel and on the thread's row. */
|
|
102
|
+
icon: string;
|
|
103
|
+
when?: SpaceThreadItemCondition;
|
|
104
|
+
/** Reaching this state opens the panel and brings the thread back to the inbox, unread. */
|
|
105
|
+
needsYou?: boolean;
|
|
106
|
+
/** Notis stops reading an item in a final state (merged, closed). Never also `needsYou`. */
|
|
107
|
+
final?: boolean;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* A confirmation asked once, in a Notis dialog, before the action runs. Templates like `{item.number}` apply.
|
|
111
|
+
* A plain string is the title. In two languages, give each part as `{ en, fr }` (SPC-289):
|
|
112
|
+
* `{ title: { en, fr } }`, never the whole confirmation as `{ en, fr }`.
|
|
113
|
+
*/
|
|
114
|
+
export type SpaceThreadItemConfirm = string
|
|
115
|
+
| { title: SpaceThreadItemText; body?: SpaceThreadItemText; button?: SpaceThreadItemText };
|
|
116
|
+
/** A button on the item, run with the person's own connection to the tool's app. */
|
|
117
|
+
export interface SpaceThreadItemAction {
|
|
118
|
+
label: SpaceThreadItemText;
|
|
119
|
+
/** A connected app tool, such as `GITHUB_MERGE_A_PULL_REQUEST`. */
|
|
120
|
+
tool: string;
|
|
121
|
+
/** Templated arguments: a whole-string placeholder such as `'{item.number}'` keeps its type. */
|
|
122
|
+
arguments?: Record<string, unknown>;
|
|
123
|
+
confirm?: SpaceThreadItemConfirm;
|
|
124
|
+
/** The states it is offered in; every state that is not final when omitted. */
|
|
125
|
+
states?: string[];
|
|
126
|
+
primary?: boolean;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* A kind of live item agents attach to a thread (`LOCAL_NOTIS_THREAD_ITEMS`), such as a pull request.
|
|
130
|
+
* Notis reads it through `read.action`, about every minute while the thread is open and every 15 minutes
|
|
131
|
+
* otherwise, until a final state. Declare it on the Space's root view:
|
|
132
|
+
*
|
|
133
|
+
* ```ts
|
|
134
|
+
* threadItems: { pull_request: {
|
|
135
|
+
* label: 'Pull request',
|
|
136
|
+
* inputs: { type: 'object', additionalProperties: false, required: ['owner', 'repo', 'number'],
|
|
137
|
+
* properties: { owner: { type: 'string' }, repo: { type: 'string' }, number: { type: 'integer' } } },
|
|
138
|
+
* read: { action: 'read_pull_request' },
|
|
139
|
+
* title: '#{item.number} {data.title}',
|
|
140
|
+
* states: [
|
|
141
|
+
* { id: 'merged', when: { path: 'data.merged', equals: true }, icon: 'phosphor:git-merge', label: 'Merged', final: true },
|
|
142
|
+
* { id: 'ready', icon: 'phosphor:git-pull-request', label: 'Ready to merge', needsYou: true },
|
|
143
|
+
* ],
|
|
144
|
+
* actions: { merge: { label: 'Merge', tool: 'GITHUB_MERGE_A_PULL_REQUEST', primary: true,
|
|
145
|
+
* arguments: { owner: '{item.owner}', repo: '{item.repo}', pull_number: '{item.number}' },
|
|
146
|
+
* confirm: { title: 'Merge #{item.number}?', button: 'Merge' } } },
|
|
147
|
+
* page: { params: { pr: '{item.number}' } },
|
|
148
|
+
* } }
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
export interface SpaceThreadItemKind {
|
|
152
|
+
label: SpaceThreadItemText;
|
|
153
|
+
description?: string;
|
|
154
|
+
/** A closed object schema of scalar fields: what an agent gives to attach one item. */
|
|
155
|
+
inputs: { type: 'object'; properties: Record<string, Record<string, unknown>>; required?: string[]; additionalProperties: false };
|
|
156
|
+
/** A read action of this view; its inputs default to the item's inputs by name. */
|
|
157
|
+
read: { action: string; inputs?: Record<string, unknown> };
|
|
158
|
+
title: string;
|
|
159
|
+
/** An https link to the item where it lives ("Open on GitHub"). */
|
|
160
|
+
url?: string;
|
|
161
|
+
states: SpaceThreadItemState[];
|
|
162
|
+
/** Summarises a list of checks into "2 of 9 failing": the latest run per `name` counts. */
|
|
163
|
+
checks?: { list: string; name: string; state: string; passed: string[]; failed: string[] };
|
|
164
|
+
actions?: Record<string, SpaceThreadItemAction>;
|
|
165
|
+
/** This view draws the item in the thread's panel; it receives these params plus the item through `useThreadItem`. */
|
|
166
|
+
page?: { params?: Record<string, string> };
|
|
167
|
+
}
|
|
168
|
+
/** An attached item as Notis last read it. */
|
|
169
|
+
export interface SpaceThreadItem {
|
|
170
|
+
id: string;
|
|
171
|
+
kind: string;
|
|
172
|
+
kind_label?: SpaceThreadItemText | null;
|
|
173
|
+
thread_id: string;
|
|
174
|
+
space_id: string;
|
|
175
|
+
space?: { id: string; name: string | null; icon: string | null; has_page: boolean };
|
|
176
|
+
inputs: Record<string, unknown>;
|
|
177
|
+
state: string | null;
|
|
178
|
+
state_label: SpaceThreadItemText | null;
|
|
179
|
+
icon: string | null;
|
|
180
|
+
needs_you: boolean;
|
|
181
|
+
final: boolean;
|
|
182
|
+
title: string;
|
|
183
|
+
url: string | null;
|
|
184
|
+
checks: { total: number; passed: number; failed: number; running: number } | null;
|
|
185
|
+
/** The actions offered in the current state. */
|
|
186
|
+
/** `fingerprint` names the exact declaration shown; a confirmed run sends it back so a changed one is refused. */
|
|
187
|
+
actions: Array<{ id: string; label: SpaceThreadItemText; primary: boolean;
|
|
188
|
+
confirm?: { title: SpaceThreadItemText; body?: SpaceThreadItemText; button?: SpaceThreadItemText };
|
|
189
|
+
fingerprint?: string }>;
|
|
190
|
+
/** The kind's `page.params`, filled in for this item. */
|
|
191
|
+
page_params?: Record<string, unknown> | null;
|
|
192
|
+
/** The read action's last answer (only on the item a page draws). */
|
|
193
|
+
data?: unknown;
|
|
194
|
+
attached_at?: string | null;
|
|
195
|
+
refreshed_at: string | null;
|
|
196
|
+
/** The code of the last failed read, kept until a read succeeds. */
|
|
197
|
+
error: string | null;
|
|
198
|
+
}
|
|
199
|
+
export interface SpaceThreadItemRun {
|
|
200
|
+
/** False when the person cancelled the confirmation or the host cannot run actions. */
|
|
201
|
+
ran: boolean;
|
|
202
|
+
successful?: boolean;
|
|
203
|
+
error?: string | null;
|
|
204
|
+
item?: SpaceThreadItem;
|
|
205
|
+
}
|
|
206
|
+
/** Space-only transport of the item a thread's panel shows (`useThreadItem`). */
|
|
207
|
+
export interface SpaceThreadItemTransport {
|
|
208
|
+
/** The item this page draws, or null when the page is not opened for one. */
|
|
209
|
+
current(): Promise<SpaceThreadItem | null>;
|
|
210
|
+
/** Run one of the item's actions; the host asks the person first when the action confirms. */
|
|
211
|
+
run(itemId: string, actionId: string): Promise<SpaceThreadItemRun>;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* A Space's comments as the host Comments panel reads them: one comment controller of the view (a `CommentController`
|
|
215
|
+
* from `useComments`, or a `PassageCommentController` from `usePassageComments` for kind 'passage'), with the options its
|
|
216
|
+
* pane was given. The host reads `current()` again after each `subscribe` call-back.
|
|
217
|
+
*
|
|
218
|
+
* `revealRequest` (the controller's, 0 at first) goes up by one each time the person picks a comment on the page (a pin,
|
|
219
|
+
* a highlight, a key on the page): the host opens its Comments panel, on Comments, at each increase. Picking a comment
|
|
220
|
+
* inside the panel leaves it as it is. The source object stays the same for the life of the pane, whatever transport
|
|
221
|
+
* object the host hands later.
|
|
222
|
+
*/
|
|
223
|
+
export interface SpaceCommentSource {
|
|
224
|
+
readonly kind: 'pins' | 'passage';
|
|
225
|
+
current(): { controller: unknown; options: Readonly<Record<string, unknown>>; revealRequest?: number };
|
|
226
|
+
subscribe(listener: () => void): () => void;
|
|
227
|
+
/**
|
|
228
|
+
* The host hands the element of its Comments panel the source draws its threads in (inside a shadow root carrying
|
|
229
|
+
* the toolkit styles), or null when the panel is closed, shows Chat or shows another source.
|
|
230
|
+
*/
|
|
231
|
+
show(target: HTMLElement | null): void;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Space-only host Comments panel: the comment threads of the page sit in the host's right panel, beside the chat,
|
|
235
|
+
* instead of a pane inside the Space. Absent while comments are off for the viewer, on Sites, links, previews and
|
|
236
|
+
* older hosts: a Space then shows no comments at all (no pane, no pins, no highlights).
|
|
237
|
+
*/
|
|
238
|
+
export interface SpaceCommentsTransport {
|
|
239
|
+
/** Lists a source in the Comments panel until the returned call-back runs. */
|
|
240
|
+
attach(source: SpaceCommentSource): () => void;
|
|
241
|
+
/**
|
|
242
|
+
* The signed-in viewer: their name (the Author they write as; the server stamps it too) and whether they may edit
|
|
243
|
+
* the Space. Undefined while it is not known yet: comments cannot be sent until it is.
|
|
244
|
+
*/
|
|
245
|
+
viewer?: SpaceCommentViewer;
|
|
246
|
+
/**
|
|
247
|
+
* The manager threads each comment thread is linked to (1..n, SPC-113), by root record key, for the comment database
|
|
248
|
+
* alias. The first one is where a reply goes ("Goes to"). A root missing from the answer has no link yet.
|
|
249
|
+
*/
|
|
250
|
+
links?(input: { database: string; rootKeys: readonly string[] }): Promise<Record<string, SpaceCommentThreadRef[]>>;
|
|
251
|
+
/** The best-match thread for a new comment on this page (THR-024), the one the chat suggests; null starts a new one. */
|
|
252
|
+
bestMatch?(input: { recordKey?: string | null }): Promise<SpaceCommentThreadRef | null>;
|
|
253
|
+
/**
|
|
254
|
+
* Opens the host @ thread picker (chips All, Threads, Harness, People, Spaces; SPC-119) under `anchor`. Resolves with
|
|
255
|
+
* the pick, `{ newThread: harness }` for a "New Claude thread" style row, or null when dismissed.
|
|
256
|
+
*/
|
|
257
|
+
pickThread?(input: { anchor: HTMLElement; current?: string | null; query?: string }): Promise<SpaceCommentThreadPick | null>;
|
|
258
|
+
/**
|
|
259
|
+
* Links a comment thread to a manager thread: after its first comment is saved (the To chip's thread), on Change, or
|
|
260
|
+
* when a reply @-mentions another thread (`primary: false` adds it). Resolves with the thread replies now go to.
|
|
261
|
+
*/
|
|
262
|
+
link?(input: { database: string; rootKey: string; pick: SpaceCommentThreadPick; primary?: boolean }): Promise<SpaceCommentThreadRef | null>;
|
|
263
|
+
/** Opens a manager thread in the chat (the panel switches to Chat). */
|
|
264
|
+
openThread?(threadId: string): void;
|
|
265
|
+
/**
|
|
266
|
+
* The link that opens this Space page with one comment thread revealed (`comment=<root key>`, the link a push or a
|
|
267
|
+
* chat pill opens), as a full address another person can open: Copy link on a thread card copies it. Null when the
|
|
268
|
+
* page has no shareable address. Without it the pane copies the page's own address with that param. `database` is
|
|
269
|
+
* the comments database (its alias): the host may answer later (a promise) with the thread's own page in the link,
|
|
270
|
+
* wherever the pane is (the Space home, another page).
|
|
271
|
+
*/
|
|
272
|
+
commentLink?(input: { rootKey: string; database?: string }): string | null | Promise<string | null>;
|
|
273
|
+
/**
|
|
274
|
+
* Shows the page under the Comments panel (SPC-132): called when a point, box, items or time mode starts on a narrow
|
|
275
|
+
* screen (under 768px wide), where the full-screen panel covers the page. The host closes its full-screen panel; the
|
|
276
|
+
* page tool bar shows the mode's hint, and the panel opens again when the new comment starts. A host whose panel
|
|
277
|
+
* does not cover the page ignores it.
|
|
278
|
+
*/
|
|
279
|
+
showPage?(): void;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* The viewer as comments see them. `id` (their user id), when the host gives it, tells their comments by the row's
|
|
283
|
+
* creator (`created_by`) instead of the Author name, so a renamed person keeps Edit and Delete on their comments.
|
|
284
|
+
*/
|
|
285
|
+
export interface SpaceCommentViewer { name: string; canEditSpace: boolean; id?: string | null }
|
|
286
|
+
/**
|
|
287
|
+
* A manager thread a comment thread is linked to. `subagent` names the subagent a reply goes back to, when one wrote it.
|
|
288
|
+
* `threadId: null` with `status: 'pending'` is a "New <harness> thread" pick not started yet: the first wake
|
|
289
|
+
* starts it.
|
|
290
|
+
*/
|
|
291
|
+
export interface SpaceCommentThreadRef {
|
|
292
|
+
threadId: string | null;
|
|
293
|
+
title: string;
|
|
294
|
+
harness?: string | null;
|
|
295
|
+
status?: string | null;
|
|
296
|
+
subagent?: string | null;
|
|
297
|
+
}
|
|
298
|
+
export type SpaceCommentThreadPick = SpaceCommentThreadRef | { newThread: string };
|
|
83
299
|
/**
|
|
84
300
|
* A long-running program the Space keeps up on the viewer's cloud computer while the page is on screen (a dev
|
|
85
301
|
* server, a media server). It runs with `bash -lc`, listens on `127.0.0.1:$PORT`, and gets `HOST`,
|
|
@@ -537,6 +753,11 @@ export interface SpaceDefinition {
|
|
|
537
753
|
* moment, once that person allowed this Space's agents. Agents' own writes never wake anything.
|
|
538
754
|
*/
|
|
539
755
|
agents?: SpaceAgentDeclaration[];
|
|
756
|
+
/**
|
|
757
|
+
* Kinds of live items agents attach to a thread (truth SPC-093), shown docked on the thread's composer
|
|
758
|
+
* with their state and actions. Declared on the view whose `actions` hold each kind's read action.
|
|
759
|
+
*/
|
|
760
|
+
threadItems?: Record<string, SpaceThreadItemKind>;
|
|
540
761
|
/**
|
|
541
762
|
* Lists the database's records as sidebar rows under this Space. Only for a short list people navigate
|
|
542
763
|
* like pages (folders, chapters); a database that keeps growing belongs in the view's `shows` instead.
|
|
@@ -644,6 +865,15 @@ export interface SpaceActionOptions {
|
|
|
644
865
|
* answer a moment later. Hosts that predate it ignore it.
|
|
645
866
|
*/
|
|
646
867
|
fresh?: boolean;
|
|
868
|
+
/**
|
|
869
|
+
* A read that accepts an answer up to this many seconds old (1 to 300): a signed-in host answers it with the
|
|
870
|
+
* person's own result of that exact read from that window, checked like a last result (same sign-in, no write
|
|
871
|
+
* since), and asks the provider only when there is none. For data that changes slowly, such as a health board's
|
|
872
|
+
* provider reads, so a page opened again soon after costs the provider nothing. Pass it to `useAction(id).call`
|
|
873
|
+
* (or `callAction`); a `useActionQuery` read already opens on its last result. The host caps it at 300 and ignores
|
|
874
|
+
* it below 1, with `fresh` or `requestId`, and for Site or link visitors; hosts that predate it ignore it.
|
|
875
|
+
*/
|
|
876
|
+
maxAgeSeconds?: number;
|
|
647
877
|
}
|
|
648
878
|
|
|
649
879
|
export type SpaceDocumentBodyRequest = {
|