@notis_ai/cli 0.2.28 → 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 +1476 -712
- 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 +86 -14
- package/dist/sdk/src/components/NotisCommentBoundary.tsx +29 -96
- package/dist/sdk/src/components/NotisSelectionBoundary.tsx +3 -8
- package/dist/sdk/src/components/SelectionActionBar.tsx +144 -23
- package/dist/sdk/src/components/selectionId.ts +6 -0
- package/dist/sdk/src/hooks/useThreadItem.ts +56 -0
- package/dist/sdk/src/index.ts +6 -1
- package/dist/sdk/src/runtime.ts +13 -1
- package/dist/sdk/src/space.ts +230 -0
- package/dist/skill-sync-worker.mjs +185 -30
- package/dist/space-harness/host.js +260 -114
- 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 +19 -14
- package/dist/space-sdk/src/components/NotisCommentBoundary.d.ts +0 -10
- 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 +13 -1
- package/dist/space-sdk/src/space.ts +230 -0
- package/dist/space-sdk/src/tailwind-candidates.d.ts +505 -22
- 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 +165 -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 +330 -184
- package/dist/view-renderer/src/host.tsx +6 -3
- package/dist/view-renderer/src/renderer.js +62 -3
- 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 +57 -23
- package/src/command-specs/tools.js +1 -1
- package/src/runtime/agent-identity.js +187 -0
- package/src/runtime/api-hosts.js +92 -0
- package/src/runtime/app-platform.js +74 -11
- 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-fixture-broker.js +23 -2
- 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 +66 -10
- 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,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React, { useCallback, useEffect, useLayoutEffect, useRef, useState, type ReactNode, type RefObject } from 'react';
|
|
3
|
+
import { useToolkitLocale } from '../ui/engine/hooks';
|
|
3
4
|
import type { Words } from '../words/types';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -70,12 +71,48 @@ function isCoarsePointer(view: Window | null): boolean {
|
|
|
70
71
|
return Boolean(view?.matchMedia?.('(pointer: coarse)').matches);
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
// Where a selection may not start or end: fields, editable text and the bar itself.
|
|
73
75
|
const EDITABLE = 'input,textarea,select,[contenteditable]:not([contenteditable="false"]),[data-notis-selection-ui]';
|
|
74
76
|
|
|
77
|
+
/** The live selection's ends, to tell when it moved away from what the bar shows. */
|
|
78
|
+
type Ends = { startContainer: Node; startOffset: number; endContainer: Node; endOffset: number };
|
|
79
|
+
function endsOf(range: Range): Ends {
|
|
80
|
+
return { startContainer: range.startContainer, startOffset: range.startOffset, endContainer: range.endContainer, endOffset: range.endOffset };
|
|
81
|
+
}
|
|
82
|
+
function sameEnds(a: Ends, b: Ends): boolean {
|
|
83
|
+
return a.startContainer === b.startContainer && a.startOffset === b.startOffset
|
|
84
|
+
&& a.endContainer === b.endContainer && a.endOffset === b.endOffset;
|
|
85
|
+
}
|
|
86
|
+
|
|
75
87
|
function elementOf(node: Node): Element | null {
|
|
76
88
|
return node.nodeType === Node.ELEMENT_NODE ? node as Element : node.parentElement;
|
|
77
89
|
}
|
|
78
90
|
|
|
91
|
+
function selectionIn(node: Node): Selection | null {
|
|
92
|
+
const scope = node.getRootNode() as ShadowRoot & { getSelection?: () => Selection | null };
|
|
93
|
+
return scope.getSelection?.() || node.ownerDocument?.defaultView?.getSelection() || null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The surface's box. A `display: contents` element draws none: its content's own box stands in when it draws one
|
|
98
|
+
* (a boundary given a className), else the nearest ancestor that does.
|
|
99
|
+
*/
|
|
100
|
+
function boundsOf(node: HTMLElement): DOMRect {
|
|
101
|
+
let element: Element = node;
|
|
102
|
+
let box = element.getBoundingClientRect();
|
|
103
|
+
for (let depth = 0; !box.width && element.firstElementChild && depth < 8; depth += 1) {
|
|
104
|
+
const child = element.firstElementChild.getBoundingClientRect();
|
|
105
|
+
if (child.width) return child;
|
|
106
|
+
element = element.firstElementChild;
|
|
107
|
+
}
|
|
108
|
+
element = node;
|
|
109
|
+
while (!box.width && element.parentElement) {
|
|
110
|
+
element = element.parentElement;
|
|
111
|
+
box = element.getBoundingClientRect();
|
|
112
|
+
}
|
|
113
|
+
return box;
|
|
114
|
+
}
|
|
115
|
+
|
|
79
116
|
export interface UseSelectionAnchorOptions {
|
|
80
117
|
/** Off while the surface has nowhere to send a quote (a public Site, a chat that cannot send). */
|
|
81
118
|
enabled?: boolean;
|
|
@@ -85,6 +122,8 @@ export interface UseSelectionAnchorOptions {
|
|
|
85
122
|
clip?(range: Range, root: HTMLElement): Range | null;
|
|
86
123
|
/** The bar's size, measured once it shows; used to keep it inside the viewport. */
|
|
87
124
|
barSize?: { width: number; height: number };
|
|
125
|
+
/** More places a selection may not start or end in, on top of inputs and editable text (a CSS selector). */
|
|
126
|
+
exclude?: string;
|
|
88
127
|
}
|
|
89
128
|
|
|
90
129
|
/**
|
|
@@ -94,26 +133,35 @@ export interface UseSelectionAnchorOptions {
|
|
|
94
133
|
export function useSelectionAnchor(root: RefObject<HTMLElement | null>, options: UseSelectionAnchorOptions = {}) {
|
|
95
134
|
const { enabled = true } = options;
|
|
96
135
|
const [anchor, setAnchor] = useState<SelectionAnchor | null>(null);
|
|
136
|
+
const anchorRef = useRef<SelectionAnchor | null>(null);
|
|
137
|
+
anchorRef.current = anchor;
|
|
97
138
|
const optionsRef = useRef(options);
|
|
98
139
|
optionsRef.current = options;
|
|
99
140
|
const settle = useRef<number | undefined>(undefined);
|
|
141
|
+
const pending = useRef<number | undefined>(undefined);
|
|
142
|
+
// The live selection the shown bar was read from: a different one hides the bar until it is read again.
|
|
143
|
+
const shownEnds = useRef<Ends | null>(null);
|
|
100
144
|
|
|
101
145
|
const read = useCallback((): SelectionAnchor | null => {
|
|
102
146
|
const node = root.current;
|
|
103
147
|
if (!node) return null;
|
|
104
|
-
const scope = node.getRootNode() as ShadowRoot & { getSelection?: () => Selection | null };
|
|
105
148
|
const view = node.ownerDocument.defaultView;
|
|
106
|
-
const selection =
|
|
149
|
+
const selection = selectionIn(node);
|
|
107
150
|
if (!selection?.rangeCount || selection.isCollapsed || !selection.toString().trim()) return null;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
151
|
+
const live = selection.getRangeAt(0);
|
|
152
|
+
let range: Range | null = live.cloneRange();
|
|
153
|
+
const clipped = !node.contains(range.startContainer) || !node.contains(range.endContainer);
|
|
154
|
+
if (clipped) {
|
|
155
|
+
// A selection in another tree (the page around a Space's shadow root) cannot be compared with this one.
|
|
156
|
+
try { range = optionsRef.current.clip?.(range, node) ?? null; } catch { range = null; }
|
|
111
157
|
if (!range) return null;
|
|
112
158
|
}
|
|
113
159
|
const start = elementOf(range.startContainer);
|
|
114
160
|
const end = elementOf(range.endContainer);
|
|
115
|
-
|
|
161
|
+
const excluded = optionsRef.current.exclude ? `${EDITABLE},${optionsRef.current.exclude}` : EDITABLE;
|
|
162
|
+
if (start?.closest(excluded) || end?.closest(excluded)) return null;
|
|
116
163
|
if (optionsRef.current.accept && !optionsRef.current.accept(range, node)) return null;
|
|
164
|
+
// The range's own text: it is what the chat finds again when a quote link highlights the words.
|
|
117
165
|
const text = range.toString().trim();
|
|
118
166
|
if (!text) return null;
|
|
119
167
|
const lines = Array.from(range.getClientRects?.() || []).filter(line => line.width > 0 && line.height > 0);
|
|
@@ -126,11 +174,12 @@ export function useSelectionAnchor(root: RefObject<HTMLElement | null>, options:
|
|
|
126
174
|
remainder.setStart(range.endContainer, range.endOffset);
|
|
127
175
|
if (remainder.toString().trim()) trailing.push(...Array.from(remainder.getClientRects?.() || []).filter(line => line.width > 0 && line.height > 0));
|
|
128
176
|
}
|
|
129
|
-
const bounds = node
|
|
177
|
+
const bounds = boundsOf(node);
|
|
130
178
|
const position = getSelectionBarPosition(lines.length ? lines : [rect],
|
|
131
179
|
{ width: view?.innerWidth ?? 1024, height: view?.innerHeight ?? 768 },
|
|
132
180
|
optionsRef.current.barSize ?? { width: 80, height: 32 },
|
|
133
181
|
{ rightBoundary: bounds.width ? bounds.right : undefined, trailing, coarse: isCoarsePointer(view) });
|
|
182
|
+
shownEnds.current = endsOf(live);
|
|
134
183
|
return { ...position, text, range };
|
|
135
184
|
}, [root]);
|
|
136
185
|
|
|
@@ -139,7 +188,12 @@ export function useSelectionAnchor(root: RefObject<HTMLElement | null>, options:
|
|
|
139
188
|
// The bar measured itself: place it again with its real width, so its edge lines up with the selection.
|
|
140
189
|
const barWidth = options.barSize?.width;
|
|
141
190
|
const barHeight = options.barSize?.height;
|
|
142
|
-
useEffect(() => {
|
|
191
|
+
useEffect(() => {
|
|
192
|
+
// Read here, not inside the state updater: React may run an updater lazily or twice.
|
|
193
|
+
if (!anchorRef.current) return;
|
|
194
|
+
const next = read();
|
|
195
|
+
setAnchor(current => current ? next : current);
|
|
196
|
+
}, [barWidth, barHeight, read]);
|
|
143
197
|
|
|
144
198
|
useEffect(() => {
|
|
145
199
|
const node = root.current;
|
|
@@ -147,37 +201,61 @@ export function useSelectionAnchor(root: RefObject<HTMLElement | null>, options:
|
|
|
147
201
|
const document = node.ownerDocument;
|
|
148
202
|
const view = document.defaultView;
|
|
149
203
|
const scope = node.getRootNode() as ShadowRoot | Document;
|
|
204
|
+
// Cheap checks only while the selection moves: no layout until it is read again.
|
|
205
|
+
const liveSelection = () => {
|
|
206
|
+
const selection = selectionIn(node);
|
|
207
|
+
const inside = (point: Node | null | undefined) => Boolean(point && node.contains(point));
|
|
208
|
+
if (!selection?.rangeCount || selection.isCollapsed || !(inside(selection.anchorNode) || inside(selection.focusNode))) return null;
|
|
209
|
+
return selection;
|
|
210
|
+
};
|
|
150
211
|
const capture = (event: Event) => {
|
|
151
212
|
if (event.target instanceof Element && event.target.closest('[data-notis-selection-ui]')) return;
|
|
152
213
|
// Let the browser finish the selection (a double click selects the word after mouseup).
|
|
153
|
-
view?.
|
|
214
|
+
view?.clearTimeout(pending.current);
|
|
215
|
+
pending.current = view?.setTimeout(() => setAnchor(read()), 0);
|
|
154
216
|
};
|
|
217
|
+
// Keys go to the focused element (often the page body), so a keyboard selection is followed on the document.
|
|
155
218
|
const onKeyUp = (event: KeyboardEvent) => {
|
|
156
|
-
if (event.shiftKey || event.key === 'Shift' || ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === 'a'))
|
|
219
|
+
if (!(event.shiftKey || event.key === 'Shift' || ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === 'a'))) return;
|
|
220
|
+
// Only a selection touching this surface (or a bar it shows) is worth reading: typing capitals elsewhere is not.
|
|
221
|
+
if (!liveSelection() && !anchorRef.current) return;
|
|
222
|
+
capture(event);
|
|
157
223
|
};
|
|
158
224
|
const onSelectionChange = () => {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
225
|
+
if (!isCoarsePointer(view)) {
|
|
226
|
+
// A mouse or keyboard selection shows the bar when it ends (mouse up, key up). While it moves, the bar hides
|
|
227
|
+
// as soon as the selection is gone or is no longer the one the bar was read from (a clipped one included).
|
|
228
|
+
const current = selectionIn(node);
|
|
229
|
+
const moved = !current?.rangeCount || current.isCollapsed || !shownEnds.current
|
|
230
|
+
|| !sameEnds(endsOf(current.getRangeAt(0)), shownEnds.current);
|
|
231
|
+
if (moved) setAnchor(shown => shown ? null : shown);
|
|
232
|
+
return;
|
|
166
233
|
}
|
|
234
|
+
const selection = liveSelection();
|
|
235
|
+
// A touch selection has no mouse up: show the bar once its handles stop moving.
|
|
236
|
+
view?.clearTimeout(settle.current);
|
|
237
|
+
setAnchor(current => current ? null : current);
|
|
238
|
+
if (!selection) return;
|
|
239
|
+
settle.current = view?.setTimeout(() => setAnchor(read()), 450);
|
|
240
|
+
};
|
|
241
|
+
const onScroll = () => {
|
|
242
|
+
if (!anchorRef.current) return;
|
|
243
|
+
const next = read();
|
|
244
|
+
setAnchor(current => current ? next : current);
|
|
167
245
|
};
|
|
168
|
-
const onScroll = () => setAnchor(current => current ? read() : current);
|
|
169
246
|
node.addEventListener('mouseup', capture);
|
|
170
247
|
node.addEventListener('dblclick', capture);
|
|
171
|
-
|
|
248
|
+
document.addEventListener('keyup', onKeyUp);
|
|
172
249
|
document.addEventListener('selectionchange', onSelectionChange);
|
|
173
250
|
if (scope !== document) scope.addEventListener('selectionchange', onSelectionChange);
|
|
174
251
|
view?.addEventListener('scroll', onScroll, true);
|
|
175
252
|
view?.addEventListener('resize', onScroll);
|
|
176
253
|
return () => {
|
|
177
254
|
view?.clearTimeout(settle.current);
|
|
255
|
+
view?.clearTimeout(pending.current);
|
|
178
256
|
node.removeEventListener('mouseup', capture);
|
|
179
257
|
node.removeEventListener('dblclick', capture);
|
|
180
|
-
|
|
258
|
+
document.removeEventListener('keyup', onKeyUp);
|
|
181
259
|
document.removeEventListener('selectionchange', onSelectionChange);
|
|
182
260
|
if (scope !== document) scope.removeEventListener('selectionchange', onSelectionChange);
|
|
183
261
|
view?.removeEventListener('scroll', onScroll, true);
|
|
@@ -190,9 +268,52 @@ export function useSelectionAnchor(root: RefObject<HTMLElement | null>, options:
|
|
|
190
268
|
|
|
191
269
|
/** Clears the page's selection once its text was cited, so the bar does not linger over it. */
|
|
192
270
|
export function clearSelectionIn(node: Node | null | undefined): void {
|
|
193
|
-
if (
|
|
194
|
-
|
|
195
|
-
|
|
271
|
+
if (node) selectionIn(node)?.removeAllRanges();
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* The Cite action of a selection bar: the same words and glyph everywhere; it clears the selection and hides the bar
|
|
276
|
+
* before handing over the cited text.
|
|
277
|
+
*/
|
|
278
|
+
export function citeSelectionAction(locale: keyof typeof SELECTION_BAR_WORDS.cite, anchor: SelectionAnchor,
|
|
279
|
+
root: RefObject<HTMLElement | null>, dismiss: () => void, onCite: (range: Range, text: string) => void): SelectionBarAction {
|
|
280
|
+
return {
|
|
281
|
+
key: 'cite', label: SELECTION_BAR_WORDS.cite[locale], title: SELECTION_BAR_WORDS.citeHint[locale], icon: QUOTE_GLYPH,
|
|
282
|
+
onSelect: () => {
|
|
283
|
+
const { range, text } = anchor;
|
|
284
|
+
clearSelectionIn(root.current);
|
|
285
|
+
dismiss();
|
|
286
|
+
onCite(range, text);
|
|
287
|
+
},
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export interface CiteSelectionBarProps {
|
|
292
|
+
/** The surface whose selected text Cite quotes. */
|
|
293
|
+
root: RefObject<HTMLElement | null>;
|
|
294
|
+
/** Receives the cited text once the bar has cleared the selection. */
|
|
295
|
+
onCite(range: Range, text: string): void;
|
|
296
|
+
enabled?: boolean;
|
|
297
|
+
accept?: UseSelectionAnchorOptions['accept'];
|
|
298
|
+
/**
|
|
299
|
+
* Draws the bar somewhere other than beside the surface. The Portal's own pages hand the bar to a React portal on
|
|
300
|
+
* the page body, out of a container that clips or transforms it. A Space view never gives one: a Notis app stays
|
|
301
|
+
* inside its app surface, so its bar is drawn there, fixed to the viewport.
|
|
302
|
+
*/
|
|
303
|
+
portal?(bar: ReactNode): ReactNode;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* The Cite-only bar every quoting surface shows (chat, Space views, Skills and automations; truth PRT-087): it follows
|
|
308
|
+
* the selection in `root`, measures itself, and hands the cited text to `onCite`.
|
|
309
|
+
*/
|
|
310
|
+
export function CiteSelectionBar({ root, onCite, enabled = true, accept, portal }: CiteSelectionBarProps) {
|
|
311
|
+
const locale = useToolkitLocale();
|
|
312
|
+
const [barSize, setBarSize] = useState({ width: 72, height: 32 });
|
|
313
|
+
const { anchor, dismiss } = useSelectionAnchor(root, { enabled, accept, barSize });
|
|
314
|
+
if (!anchor) return null;
|
|
315
|
+
const bar = <SelectionActionBar anchor={anchor} onSize={setBarSize} actions={[citeSelectionAction(locale, anchor, root, dismiss, onCite)]} />;
|
|
316
|
+
return portal ? portal(bar) : bar;
|
|
196
317
|
}
|
|
197
318
|
|
|
198
319
|
export const QUOTE_GLYPH = <svg aria-hidden="true" width="14" height="14" viewBox="0 0 256 256" fill="currentColor"><path d="M100,56H40A16,16,0,0,0,24,72v64a16,16,0,0,0,16,16h60v8a32,32,0,0,1-32,32,8,8,0,0,0,0,16,48.05,48.05,0,0,0,48-48V72A16,16,0,0,0,100,56Zm0,80H40V72h60ZM216,56H156a16,16,0,0,0-16,16v64a16,16,0,0,0,16,16h60v8a32,32,0,0,1-32,32,8,8,0,0,0,0,16,48.05,48.05,0,0,0,48-48V72A16,16,0,0,0,216,56Zm0,80H156V72h60Z" /></svg>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** A fresh id for a quote or a comment taken from the selection. */
|
|
2
|
+
export function newSelectionId(): string {
|
|
3
|
+
return typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function'
|
|
4
|
+
? crypto.randomUUID()
|
|
5
|
+
: `selection-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
6
|
+
}
|
|
@@ -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
|
|
@@ -205,6 +205,11 @@ export interface NotisRuntimeContext {
|
|
|
205
205
|
resourceId?: string | null;
|
|
206
206
|
/** Loading bones measured from this release at build time; `ViewSkeleton` draws them. Absent until the host has them. */
|
|
207
207
|
readonly skeleton?: NotisSpaceSkeleton;
|
|
208
|
+
/**
|
|
209
|
+
* The signed-in viewer's first name, for signing what they write (comments). Display only, never an identity
|
|
210
|
+
* or a permission. Absent for visitors of a Site or a link, and on hosts that predate it.
|
|
211
|
+
*/
|
|
212
|
+
readonly viewerName?: string | null;
|
|
208
213
|
}
|
|
209
214
|
|
|
210
215
|
// ---------------------------------------------------------------------------
|
|
@@ -625,6 +630,13 @@ export interface NotisRuntime {
|
|
|
625
630
|
* older hosts.
|
|
626
631
|
*/
|
|
627
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;
|
|
628
640
|
/** Authenticated runtime identity; app below is presentation metadata only. */
|
|
629
641
|
resource?: RuntimeResource;
|
|
630
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 = {
|