@notis_ai/cli 0.2.25 → 0.2.27
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 +186 -5
- package/config/notis_app_design_rules.json +36 -14
- package/config/portal-route-roots.json +1 -0
- package/dist/agent-hooks/notis-agent-hook.mjs +2866 -553
- package/dist/base-skills/notis-cli/.notis-base-skill.json +1 -1
- package/dist/base-skills/notis-cli/references/intelligence.md +1 -1
- package/dist/base-skills/notis-query/.notis-base-skill.json +1 -1
- package/dist/base-skills/notis-query/SKILL.md +0 -1
- package/dist/base-skills/notis-query/references/documents.md +7 -0
- package/dist/base-skills/notis-query/references/query.md +1 -0
- package/dist/base-skills/notis-spaces/.notis-base-skill.json +1 -1
- package/dist/base-skills/notis-spaces/SKILL.md +96 -24
- package/dist/base-skills/notis-spaces/references/architecture.md +4 -3
- package/dist/base-skills/notis-spaces/references/context.md +3 -0
- package/dist/base-skills/notis-spaces/references/design.md +37 -18
- package/dist/base-skills/notis-spaces/references/reading.md +8 -1
- package/dist/base-skills/notis-spaces/references/reports.md +6 -6
- package/dist/base-skills/notis-spaces/references/sdk.md +71 -7
- package/dist/base-skills/notis-spaces/references/store.md +22 -13
- package/dist/base-skills/notis-spaces/references/views.md +99 -6
- package/dist/sdk/package.json +3 -0
- package/dist/sdk/src/cloudComputerWords.ts +53 -0
- package/dist/sdk/src/components/Audience.tsx +76 -0
- package/dist/sdk/src/components/DocumentPage.tsx +15 -4
- package/dist/sdk/src/components/MarkdownEditor.tsx +44 -14
- package/dist/sdk/src/components/MultiSelectActionBar.tsx +16 -5
- package/dist/sdk/src/components/NotisSelectionBoundary.tsx +79 -25
- package/dist/sdk/src/components/Skeleton.tsx +162 -6
- package/dist/sdk/src/hooks/useAction.ts +12 -2
- package/dist/sdk/src/hooks/useAgentQueue.ts +125 -0
- package/dist/sdk/src/hooks/useCloudComputerJob.ts +142 -0
- package/dist/sdk/src/hooks/useCloudComputerService.ts +388 -0
- package/dist/sdk/src/hooks/useCloudComputerShell.ts +95 -7
- package/dist/sdk/src/hooks/useCollectionInteractions.ts +40 -2
- package/dist/sdk/src/hooks/useItemThread.ts +58 -0
- package/dist/sdk/src/hooks/useMarqueeSelection.ts +6 -1
- package/dist/sdk/src/hooks/useNativeDocuments.ts +61 -8
- package/dist/sdk/src/hooks/useNotisNavigation.ts +31 -8
- package/dist/sdk/src/hooks/useQuery.ts +67 -10
- package/dist/sdk/src/hooks/useViewParams.ts +47 -11
- package/dist/sdk/src/index.ts +31 -4
- package/dist/sdk/src/interactions.ts +2 -0
- package/dist/sdk/src/nativeData.ts +2 -0
- package/dist/sdk/src/optimisticRows.ts +329 -0
- package/dist/sdk/src/perf.ts +188 -0
- package/dist/sdk/src/provider.tsx +2 -1
- package/dist/sdk/src/queryCache.ts +366 -17
- package/dist/sdk/src/runtime.ts +55 -4
- package/dist/sdk/src/skeleton.ts +103 -0
- package/dist/sdk/src/space.ts +662 -28
- package/dist/sdk/src/spacePublicUI.ts +36 -0
- package/dist/sdk/src/ui/engine/step.ts +54 -0
- package/dist/sdk/src/ui/icons.tsx +3 -1
- package/dist/sdk/src/words/shell.ts +1 -0
- package/dist/skill-sync/index.js +88 -13
- package/dist/skill-sync-worker.mjs +127 -38
- package/dist/space-harness/host.js +272 -105
- package/dist/space-sdk/dist/chunk-BWHAORT4.js +5 -0
- package/dist/space-sdk/dist/index.js +9 -4
- package/dist/space-sdk/dist/ui.js +12 -12
- package/dist/space-sdk/package.json +3 -0
- package/dist/space-sdk/src/cloudComputerWords.d.ts +34 -0
- package/dist/space-sdk/src/components/Audience.d.ts +46 -0
- package/dist/space-sdk/src/components/DocumentPage.d.ts +3 -1
- package/dist/space-sdk/src/components/MarkdownEditor.d.ts +21 -0
- package/dist/space-sdk/src/components/MultiSelectActionBar.d.ts +5 -1
- package/dist/space-sdk/src/components/NotisSelectionBoundary.d.ts +19 -2
- package/dist/space-sdk/src/components/Skeleton.d.ts +7 -2
- package/dist/space-sdk/src/hooks/useAction.d.ts +8 -1
- package/dist/space-sdk/src/hooks/useAgentQueue.d.ts +61 -0
- package/dist/space-sdk/src/hooks/useCloudComputerJob.d.ts +35 -0
- package/dist/space-sdk/src/hooks/useCloudComputerService.d.ts +75 -0
- package/dist/space-sdk/src/hooks/useCloudComputerShell.d.ts +36 -3
- package/dist/space-sdk/src/hooks/useCollectionInteractions.d.ts +6 -0
- package/dist/space-sdk/src/hooks/useItemThread.d.ts +32 -0
- package/dist/space-sdk/src/hooks/useMarqueeSelection.d.ts +2 -1
- package/dist/space-sdk/src/hooks/useNativeDocumentBody.d.ts +1 -0
- package/dist/space-sdk/src/hooks/useNativeDocuments.d.ts +20 -5
- package/dist/space-sdk/src/hooks/useNotisNavigation.d.ts +11 -2
- package/dist/space-sdk/src/hooks/useQuery.d.ts +24 -2
- package/dist/space-sdk/src/hooks/useViewParams.d.ts +2 -0
- package/dist/space-sdk/src/index.d.ts +24 -4
- package/dist/space-sdk/src/nativeData.d.ts +6 -0
- package/dist/space-sdk/src/queryCache.d.ts +97 -2
- package/dist/space-sdk/src/runtime.d.ts +53 -4
- package/dist/space-sdk/src/skeleton.d.ts +42 -0
- package/dist/space-sdk/src/space.ts +662 -28
- package/dist/space-sdk/src/tailwind-candidates.d.ts +761 -6
- package/dist/space-sdk/src/ui/cloud/CloudComputerFrame.d.ts +29 -0
- package/dist/space-sdk/src/ui/cloud/CloudComputerWaking.d.ts +20 -0
- package/dist/space-sdk/src/ui/comments/CommentPane.d.ts +15 -2
- package/dist/space-sdk/src/ui/comments/PassageComments.d.ts +50 -0
- package/dist/space-sdk/src/ui/comments/commentFiles.d.ts +64 -0
- package/dist/space-sdk/src/ui/comments/commentModel.d.ts +49 -1
- package/dist/space-sdk/src/ui/comments/commentWords.d.ts +26 -0
- package/dist/space-sdk/src/ui/comments/index.d.ts +4 -0
- package/dist/space-sdk/src/ui/comments/passageModel.d.ts +82 -0
- package/dist/space-sdk/src/ui/comments/useComments.d.ts +34 -4
- package/dist/space-sdk/src/ui/comments/usePassageComments.d.ts +67 -0
- package/dist/space-sdk/src/ui/engine/index.d.ts +2 -2
- package/dist/space-sdk/src/ui/engine/step.d.ts +9 -0
- package/dist/space-sdk/src/ui/fields/fields.d.ts +2 -1
- package/dist/space-sdk/src/ui/index.d.ts +4 -0
- package/dist/space-sdk/src/ui/layout/Panels.d.ts +9 -2
- package/dist/space-sdk/src/ui/layout/SidePane.d.ts +42 -0
- package/dist/space-sdk/src/ui/layout/index.d.ts +2 -1
- package/dist/space-sdk/src/ui/layout/panelMath.d.ts +11 -2
- package/dist/space-sdk/src/ui/list/ListReader.d.ts +38 -7
- package/dist/space-sdk/src/ui/list/Row.d.ts +4 -0
- package/dist/space-sdk/src/ui/list/SelectionBar.d.ts +9 -4
- package/dist/space-sdk/src/ui/list/useListKeys.d.ts +4 -0
- package/dist/space-sdk/src/words/shell.ts +1 -0
- package/dist/view-renderer/dist/host.js +355 -188
- package/dist/view-renderer/dist/theme.css +1 -1
- package/dist/view-renderer/src/dom.js +15 -2
- package/dist/view-renderer/src/host.tsx +4 -1
- package/dist/view-renderer/src/index.js +3 -0
- package/dist/view-renderer/src/pool.js +8 -4
- package/dist/view-renderer/src/renderer.js +92 -23
- package/dist/view-renderer/src/skeleton.js +450 -0
- package/package.json +4 -4
- package/skills/notis-cli/AGENT_INSTRUCTIONS.md +8 -4
- package/skills/notis-onboarding/BRIEF.md +15 -9
- package/skills/notis-spaces/cli.md +43 -4
- package/src/command-specs/auth.js +5 -3
- package/src/command-specs/cc.js +410 -0
- package/src/command-specs/computer.js +320 -0
- package/src/command-specs/diagnostics.js +2 -13
- package/src/command-specs/documents.js +22 -4
- package/src/command-specs/index.js +7 -0
- package/src/command-specs/onboarding.js +127 -7
- package/src/command-specs/skills.js +2 -2
- package/src/command-specs/spaces.js +162 -30
- package/src/command-specs/tools.js +26 -8
- package/src/command-specs/views.js +4 -1
- package/src/runtime/agent-setup.js +20 -2
- package/src/runtime/app-boundary-validator.js +2 -1
- package/src/runtime/app-platform.js +13 -0
- package/src/runtime/auth-recovery.js +5 -0
- package/src/runtime/channel.js +16 -2
- package/src/runtime/cloud-transfer.js +587 -0
- package/src/runtime/computer-ssh.js +127 -0
- package/src/runtime/oauth.js +50 -4
- package/src/runtime/skill-sync/cloud-client.ts +98 -15
- package/src/runtime/skill-sync/index.ts +42 -4
- package/src/runtime/skill-sync/local-scanner.ts +1 -0
- package/src/runtime/skill-sync/types.ts +6 -0
- package/src/runtime/space-audience.js +94 -0
- package/src/runtime/space-collection-scaffold.js +2 -1
- package/src/runtime/space-fixture-broker.js +2 -1
- package/src/runtime/space-lock.js +1 -4
- package/src/runtime/space-platform.js +18 -2
- package/src/runtime/space-source.js +105 -7
- package/src/runtime/space-test-server.js +13 -2
- package/src/runtime/space-verification.js +99 -6
- package/src/runtime/space-view-manifest.js +22 -4
- package/src/runtime/sync-skills.js +24 -20
- package/src/runtime/transport.js +19 -0
- package/src/runtime/view-render.js +2 -2
- package/src/skill-sync-worker.js +5 -1
- package/template/.harness/index.html.tmpl +1 -1
- package/dist/skill-sync/index.js.map +0 -7
- package/dist/space-sdk/dist/chunk-SVZATGZB.js +0 -5
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loading skeleton capture shared by every caller of the view renderer (`notis-space-skeleton/v1`).
|
|
3
|
+
*
|
|
4
|
+
* `skeletonProbe` runs inside the page (serialized by `page.evaluate`, so it is fully self-contained):
|
|
5
|
+
* - mode `pending` reads the loading state: skeleton regions (`[data-notis-skeleton-key]`) clipped to the app
|
|
6
|
+
* root, landmark boxes, visible text, spinners, empty states and the ink of each region;
|
|
7
|
+
* - mode `final` measures the final DOM inside each pending region box into bones `[x, y, w, h, r, t]`
|
|
8
|
+
* (x and w percent of the region width, y and h px from the region top, t 0 leaf, 1 filled container,
|
|
9
|
+
* 2 outline, 3 divider), plus the sibling groups the Node side folds into repeat rows.
|
|
10
|
+
*
|
|
11
|
+
* The Node helpers build the document, validate it against the same caps as the server
|
|
12
|
+
* (`server/lib/space_skeleton.py`) and run the pending checks. Every finding is a warning in this release.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export const SKELETON_SCHEMA = 'notis-space-skeleton/v1';
|
|
16
|
+
export const SKELETON_PATH = 'bundle/skeleton.json';
|
|
17
|
+
export const SKELETON_WIDTHS = Object.freeze([390, 1440]);
|
|
18
|
+
export const SKELETON_LOCALES = Object.freeze(['en', 'fr']);
|
|
19
|
+
export const SKELETON_LIMITS = Object.freeze({ maxBytes: 512 * 1024, maxRegions: 16, maxBones: 400, maxRows: 8,
|
|
20
|
+
maxRowBones: 64, maxPx: 100000, maxRadius: 64, maxType: 3 });
|
|
21
|
+
export const SKELETON_REGION_KEY = /^[a-z0-9][a-z0-9_-]{0,31}$/;
|
|
22
|
+
export const LANDMARK_SELECTOR = '[role=tablist],[role=radiogroup],[role=toolbar],nav,.nui-tabrow,.nui-section-head,'
|
|
23
|
+
+ '.nui-lr-bar,.nui-lr-toolbar,.nui-lr-title,.nui-panels-list,.nui-panels-reader,.nui-panels-backbar';
|
|
24
|
+
export const LOADING_WORDS = /\b(en cours de chargement|chargement|loading|please wait|veuillez patienter)\b/i;
|
|
25
|
+
const DRIFT_PX = 8;
|
|
26
|
+
const JUMP_PX = 48;
|
|
27
|
+
|
|
28
|
+
/** In-page probe. Must not reference anything outside its own body. */
|
|
29
|
+
export function skeletonProbe({ mode, regions: wanted = [], landmarkSelector, loadingPattern } = {}) {
|
|
30
|
+
const LEAF = new Set(['IMG', 'SVG', 'svg', 'CANVAS', 'VIDEO', 'INPUT', 'TEXTAREA', 'SELECT', 'BUTTON', 'PICTURE']);
|
|
31
|
+
const KEY = /^[a-z0-9][a-z0-9_-]{0,31}$/;
|
|
32
|
+
const findRoot = () => {
|
|
33
|
+
const direct = document.querySelector('[data-notis-app-root]');
|
|
34
|
+
if (direct) return direct;
|
|
35
|
+
const hosts = [...document.querySelectorAll('*')].filter(node => node.shadowRoot);
|
|
36
|
+
for (let index = 0; index < hosts.length && index < 2000; index++) {
|
|
37
|
+
const root = hosts[index].shadowRoot;
|
|
38
|
+
const found = root.querySelector('[data-notis-app-root]');
|
|
39
|
+
if (found) return found;
|
|
40
|
+
for (const node of root.querySelectorAll('*')) if (node.shadowRoot) hosts.push(node);
|
|
41
|
+
}
|
|
42
|
+
return hosts[0]?.shadowRoot || document.body;
|
|
43
|
+
};
|
|
44
|
+
const appRoot = findRoot();
|
|
45
|
+
const frame = (appRoot.getBoundingClientRect ? appRoot : document.body).getBoundingClientRect();
|
|
46
|
+
const appStyle = appRoot instanceof Element ? getComputedStyle(appRoot) : null;
|
|
47
|
+
const pageBg = appStyle ? appStyle.backgroundColor : 'rgba(0, 0, 0, 0)';
|
|
48
|
+
const clear = value => !value || value === 'transparent' || value === 'rgba(0, 0, 0, 0)';
|
|
49
|
+
const shown = (el, style = getComputedStyle(el)) => style.display !== 'none' && style.visibility !== 'hidden'
|
|
50
|
+
&& Number(style.opacity) > 0.05 && (typeof el.checkVisibility !== 'function'
|
|
51
|
+
|| el.checkVisibility({ opacityProperty: true, visibilityProperty: true }));
|
|
52
|
+
// Every element under the app root, open shadow roots included, in DOM order.
|
|
53
|
+
const elements = (start, limit = 20000) => {
|
|
54
|
+
const out = [];
|
|
55
|
+
const visit = node => {
|
|
56
|
+
for (const child of node.children || []) {
|
|
57
|
+
if (out.length >= limit) return;
|
|
58
|
+
out.push(child);
|
|
59
|
+
visit(child);
|
|
60
|
+
if (child.shadowRoot) visit(child.shadowRoot);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
visit(start);
|
|
64
|
+
return out;
|
|
65
|
+
};
|
|
66
|
+
const landmarks = () => [...appRoot.querySelectorAll(landmarkSelector)].slice(0, 20).map(el => {
|
|
67
|
+
const r = el.getBoundingClientRect();
|
|
68
|
+
const role = el.getAttribute('role');
|
|
69
|
+
const token = [...el.classList].find(name => name.startsWith('nui-'));
|
|
70
|
+
return { sel: role ? `[role=${role}]` : token ? `.${token}` : el.tagName.toLowerCase(),
|
|
71
|
+
x: Math.round(r.left), y: Math.round(r.top), w: Math.round(r.width), h: Math.round(r.height) };
|
|
72
|
+
});
|
|
73
|
+
const viewport = { width: innerWidth, height: innerHeight };
|
|
74
|
+
const app = { x: Math.round(frame.left), y: Math.round(frame.top), width: Math.round(frame.width), height: Math.round(frame.height) };
|
|
75
|
+
|
|
76
|
+
if (mode === 'pending') {
|
|
77
|
+
const all = elements(appRoot);
|
|
78
|
+
const seen = new Map();
|
|
79
|
+
for (const el of all) {
|
|
80
|
+
const key = el.getAttribute('data-notis-skeleton-key');
|
|
81
|
+
if (key === null || seen.has(key) || seen.size >= 32) continue;
|
|
82
|
+
const r = el.getBoundingClientRect();
|
|
83
|
+
const left = Math.max(r.left, frame.left), right = Math.min(r.right, frame.right);
|
|
84
|
+
seen.set(key, { el, key, valid: KEY.test(key), x: left, y: r.top, width: Math.max(0, right - left), height: r.height });
|
|
85
|
+
}
|
|
86
|
+
const textOf = el => {
|
|
87
|
+
let text = '';
|
|
88
|
+
for (const node of el.childNodes) if (node.nodeType === 3) text += node.textContent;
|
|
89
|
+
return text.trim();
|
|
90
|
+
};
|
|
91
|
+
const visibleText = [];
|
|
92
|
+
const inked = new Set();
|
|
93
|
+
let total = 0;
|
|
94
|
+
for (const el of all) {
|
|
95
|
+
const style = getComputedStyle(el);
|
|
96
|
+
if (!shown(el, style)) continue;
|
|
97
|
+
const r = el.getBoundingClientRect();
|
|
98
|
+
if (r.width < 2 || r.height < 2) continue;
|
|
99
|
+
const text = textOf(el);
|
|
100
|
+
if (text && total < 20000) { visibleText.push(text); total += text.length; }
|
|
101
|
+
const border = ['Top', 'Right', 'Bottom', 'Left'].some(side => parseFloat(style[`border${side}Width`]) > 0
|
|
102
|
+
&& style[`border${side}Style`] !== 'none' && !clear(style[`border${side}Color`]));
|
|
103
|
+
if (text || LEAF.has(el.tagName) || el.getAttribute('role') === 'img' || border || style.backgroundImage !== 'none'
|
|
104
|
+
|| style.boxShadow !== 'none' || (!clear(style.backgroundColor) && style.backgroundColor !== pageBg)) inked.add(el);
|
|
105
|
+
}
|
|
106
|
+
// A spinner is a rotating element; the page shows only a spinner when nothing else draws outside it.
|
|
107
|
+
const spinning = (el, style) => !el.classList.contains('nui-skel') && !el.classList.contains('nui-bar')
|
|
108
|
+
&& (el.classList.contains('nui-row-tag-spin') || [style, getComputedStyle(el, '::before'), getComputedStyle(el, '::after')]
|
|
109
|
+
.some(value => /spin|rotate/i.test(value.animationName || '')));
|
|
110
|
+
const spinners = [];
|
|
111
|
+
for (const el of all.slice(0, 5000)) {
|
|
112
|
+
const style = getComputedStyle(el);
|
|
113
|
+
if (shown(el, style) && spinning(el, style)) spinners.push(el);
|
|
114
|
+
}
|
|
115
|
+
const insideSpinner = el => spinners.some(spinner => spinner === el || spinner.contains(el));
|
|
116
|
+
const content = [...inked].filter(el => !insideSpinner(el) && (textOf(el) || LEAF.has(el.tagName)
|
|
117
|
+
|| el.hasAttribute('data-notis-bone') || el.classList.contains('nui-skel') || el.getAttribute('role') === 'img'));
|
|
118
|
+
const empties = appRoot.querySelectorAll('.nui-empty,.nui-lr-empty,.nui-comment-empty,[data-notis-empty]');
|
|
119
|
+
const emptyStates = [...empties].filter(el => shown(el) && el.getBoundingClientRect().width >= 2
|
|
120
|
+
&& el.getBoundingClientRect().height >= 2).length;
|
|
121
|
+
const text = visibleText.join('\n');
|
|
122
|
+
const loading = new RegExp(loadingPattern, 'i').exec(text);
|
|
123
|
+
return { mode, viewport, app, landmarks: landmarks(), loadingText: loading ? loading[0] : null,
|
|
124
|
+
spinnerOnly: spinners.length > 0 && content.length === 0, emptyStates, appBlank: inked.size === 0,
|
|
125
|
+
regions: [...seen.values()].map(({ el, ...region }) => {
|
|
126
|
+
const inner = [el, ...elements(el, 5000)];
|
|
127
|
+
return { ...region, x: Math.round(region.x * 100) / 100, y: Math.round(region.y * 100) / 100,
|
|
128
|
+
width: Math.round(region.width * 100) / 100, height: Math.round(region.height * 100) / 100,
|
|
129
|
+
ink: inner.filter(node => inked.has(node)).length,
|
|
130
|
+
bones: inner.filter(node => node.hasAttribute('data-notis-bone') || node.classList.contains('nui-skel')).length };
|
|
131
|
+
}) };
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Final: measure each pending region box. The box stops at the next region below it in the same column.
|
|
135
|
+
const measured = wanted.map(region => {
|
|
136
|
+
const below = wanted.filter(other => other !== region && other.y > region.y + 1
|
|
137
|
+
&& other.x < region.x + region.width && other.x + other.width > region.x).map(other => other.y - region.y);
|
|
138
|
+
const R = { x: region.x, y: region.y, width: Math.max(1, region.width), maxH: Math.min(innerHeight * 2, ...below) };
|
|
139
|
+
const bones = [];
|
|
140
|
+
const groups = [];
|
|
141
|
+
// What a scrolling or clipping ancestor hides is not measured: a pane's content below its fold stays out.
|
|
142
|
+
const clipTo = (r, c) => {
|
|
143
|
+
const left = Math.max(r.left, c.left), top = Math.max(r.top, c.top);
|
|
144
|
+
return { left, top, width: Math.min(r.left + r.width, c.right) - left, height: Math.min(r.top + r.height, c.bottom) - top };
|
|
145
|
+
};
|
|
146
|
+
const push = (r, radius, type) => {
|
|
147
|
+
const left = Math.max(r.left, R.x), right = Math.min(r.left + r.width, R.x + R.width);
|
|
148
|
+
const width = right - left;
|
|
149
|
+
if (width < 2 || r.height <= 0 || (r.height < 2 && type !== 3)) return;
|
|
150
|
+
const y = r.top - R.y;
|
|
151
|
+
if (y < 0 || y > R.maxH) return;
|
|
152
|
+
const height = Math.max(type === 3 ? 1 : 0, Math.min(r.height, R.maxH - y));
|
|
153
|
+
bones.push([Math.round((left - R.x) / R.width * 10000) / 100, Math.round(y), Math.round(width / R.width * 10000) / 100,
|
|
154
|
+
Math.round(height), Math.max(0, Math.min(64, Math.round(radius))), type]);
|
|
155
|
+
};
|
|
156
|
+
const walk = (el, clip) => {
|
|
157
|
+
if (!(el instanceof Element)) return;
|
|
158
|
+
const s = getComputedStyle(el);
|
|
159
|
+
if (s.display === 'none' || s.visibility === 'hidden' || Number(s.opacity) <= 0.05) return;
|
|
160
|
+
if (el.getAttribute('aria-hidden') === 'true' && el.closest('[role=status]')) return;
|
|
161
|
+
const r = el.getBoundingClientRect();
|
|
162
|
+
if (r.bottom <= R.y || r.top - R.y > R.maxH || r.right <= R.x || r.left >= R.x + R.width
|
|
163
|
+
|| r.bottom <= clip.top || r.top >= clip.bottom || r.right <= clip.left || r.left >= clip.right) {
|
|
164
|
+
// Outside the region: only descend when the element may hold overflowing children.
|
|
165
|
+
if (s.overflow !== 'visible' || r.height > 0) return;
|
|
166
|
+
}
|
|
167
|
+
const radius = Math.min(parseFloat(s.borderTopLeftRadius) || 0, r.height / 2) | 0;
|
|
168
|
+
const seen = clipTo(r, clip);
|
|
169
|
+
if (LEAF.has(el.tagName) || el.getAttribute('role') === 'img') { push(seen, radius || 6, 0); return; }
|
|
170
|
+
const hasBg = !clear(s.backgroundColor) && s.backgroundColor !== pageBg;
|
|
171
|
+
const line = side => parseFloat(s[`border${side}Width`]) > 0 && s[`border${side}Style`] !== 'none' && !clear(s[`border${side}Color`]);
|
|
172
|
+
const hasBorder = ['Top', 'Right', 'Bottom', 'Left'].every(line);
|
|
173
|
+
if ((hasBg || hasBorder) && r.width < R.width * 0.98) push(seen, radius, hasBg ? 1 : 2);
|
|
174
|
+
else {
|
|
175
|
+
// Toolkit row dividers are a 1 px background-image, not a border.
|
|
176
|
+
const hairBg = s.backgroundImage !== 'none' && /(^|\s)[0-2]px$/.test((s.backgroundSize || '').trim());
|
|
177
|
+
if (line('Top') || hairBg) push(clipTo({ left: r.left, width: r.width, top: r.top, height: 1 }, clip), 0, 3);
|
|
178
|
+
if (line('Bottom')) push(clipTo({ left: r.left, width: r.width, top: r.bottom - 1, height: 1 }, clip), 0, 3);
|
|
179
|
+
}
|
|
180
|
+
const inner = s.overflowX === 'visible' && s.overflowY === 'visible' ? clip
|
|
181
|
+
: { left: Math.max(clip.left, r.left), top: Math.max(clip.top, r.top), right: Math.min(clip.right, r.right), bottom: Math.min(clip.bottom, r.bottom) };
|
|
182
|
+
const children = [];
|
|
183
|
+
const visitChild = child => {
|
|
184
|
+
const start = bones.length;
|
|
185
|
+
walk(child, inner);
|
|
186
|
+
const box = child.getBoundingClientRect();
|
|
187
|
+
children.push([start, bones.length, Math.round(box.top - R.y), Math.round(box.height)]);
|
|
188
|
+
};
|
|
189
|
+
for (const node of el.childNodes) {
|
|
190
|
+
if (node.nodeType === 3 && node.textContent.trim()) {
|
|
191
|
+
const range = document.createRange(); range.selectNodeContents(node);
|
|
192
|
+
const size = parseFloat(s.fontSize) || 14;
|
|
193
|
+
const lines = new Map();
|
|
194
|
+
for (const rect of range.getClientRects()) {
|
|
195
|
+
const key = Math.round(rect.top); const known = lines.get(key);
|
|
196
|
+
lines.set(key, known ? { left: Math.min(known.left, rect.left), right: Math.max(known.right, rect.right), top: rect.top, height: rect.height }
|
|
197
|
+
: { left: rect.left, right: rect.right, top: rect.top, height: rect.height });
|
|
198
|
+
}
|
|
199
|
+
for (const value of lines.values()) {
|
|
200
|
+
const height = Math.max(8, Math.round(size * 0.7));
|
|
201
|
+
push(clipTo({ left: value.left, width: value.right - value.left, top: value.top + (value.height - height) / 2, height }, inner), 4, 0);
|
|
202
|
+
}
|
|
203
|
+
} else if (node.nodeType === 1) visitChild(node);
|
|
204
|
+
}
|
|
205
|
+
if (el.shadowRoot) for (const child of el.shadowRoot.children) visitChild(child);
|
|
206
|
+
if (children.length >= 3 && groups.length < 200) groups.push(children.slice(0, 400));
|
|
207
|
+
};
|
|
208
|
+
for (const child of appRoot.children) walk(child, { left: -Infinity, top: -Infinity, right: Infinity, bottom: Infinity });
|
|
209
|
+
return { key: region.key, width: Math.round(R.width), bones, groups };
|
|
210
|
+
});
|
|
211
|
+
return { mode: 'final', viewport, app, landmarks: landmarks(), regions: measured };
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** In-page: resolve once the document and open shadow roots stay unchanged for `quietMs`, at most `capMs`. */
|
|
215
|
+
export function waitForQuietDom({ quietMs = 300, capMs = 5000 } = {}) {
|
|
216
|
+
return new Promise(resolve => {
|
|
217
|
+
const roots = [document];
|
|
218
|
+
const hosts = [...document.querySelectorAll('*')].filter(node => node.shadowRoot);
|
|
219
|
+
for (let index = 0; index < hosts.length && index < 2000; index++) {
|
|
220
|
+
roots.push(hosts[index].shadowRoot);
|
|
221
|
+
for (const node of hosts[index].shadowRoot.querySelectorAll('*')) if (node.shadowRoot) hosts.push(node);
|
|
222
|
+
}
|
|
223
|
+
let timer;
|
|
224
|
+
const done = () => { observer.disconnect(); clearTimeout(timer); clearTimeout(cap); resolve(); };
|
|
225
|
+
const observer = new MutationObserver(() => { clearTimeout(timer); timer = setTimeout(done, quietMs); });
|
|
226
|
+
for (const root of roots) observer.observe(root, { subtree: true, childList: true, attributes: true, characterData: true });
|
|
227
|
+
timer = setTimeout(done, quietMs);
|
|
228
|
+
const cap = setTimeout(done, capMs);
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const round2 = value => Math.round(value * 100) / 100;
|
|
233
|
+
const close = (a, b, tolerance) => Math.abs(a - b) <= tolerance;
|
|
234
|
+
|
|
235
|
+
function sameRow(a, b) {
|
|
236
|
+
if (a.length !== b.length) return false;
|
|
237
|
+
return a.every((bone, index) => {
|
|
238
|
+
const other = b[index];
|
|
239
|
+
return bone[5] === other[5] && close(bone[0], other[0], 2) && close(bone[2], other[2], 2)
|
|
240
|
+
&& close(bone[3], other[3], 4) && close(bone[1], other[1], 4);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Fold 3 or more consecutive stacked siblings with the same bone signature into one row template
|
|
246
|
+
* (`repeat: "fill"`). Runs never overlap, and a run is kept only when nothing else sits at or below its top
|
|
247
|
+
* in the same column, so repeating it down the pane never covers another bone.
|
|
248
|
+
*/
|
|
249
|
+
export function foldRepeatRows(bones, groups = [], limits = SKELETON_LIMITS) {
|
|
250
|
+
const relative = ([start, end, top]) => bones.slice(start, end).map(([x, y, w, h, r, t]) => [x, y - top, w, h, r, t]);
|
|
251
|
+
const candidates = [];
|
|
252
|
+
for (const children of groups) {
|
|
253
|
+
let index = 0;
|
|
254
|
+
while (index < children.length) {
|
|
255
|
+
const first = children[index];
|
|
256
|
+
if (first[1] - first[0] === 0) { index++; continue; }
|
|
257
|
+
const template = relative(first);
|
|
258
|
+
let end = index + 1, pitch = null;
|
|
259
|
+
while (end < children.length) {
|
|
260
|
+
const previous = children[end - 1], current = children[end];
|
|
261
|
+
const step = current[2] - previous[2];
|
|
262
|
+
if (current[0] !== previous[1] || step < 1 || (pitch !== null && !close(step, pitch, 4))
|
|
263
|
+
|| !close(current[3], first[3], 4) || !sameRow(template, relative(current))) break;
|
|
264
|
+
pitch ??= step;
|
|
265
|
+
end++;
|
|
266
|
+
}
|
|
267
|
+
if (end - index >= 3 && template.length <= limits.maxRowBones) {
|
|
268
|
+
candidates.push({ start: first[0], end: children[end - 1][1], top: first[2], pitch, template });
|
|
269
|
+
}
|
|
270
|
+
index = end > index + 1 ? end : index + 1;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
candidates.sort((a, b) => (b.end - b.start) - (a.end - a.start) || a.start - b.start);
|
|
274
|
+
const chosen = [];
|
|
275
|
+
for (const run of candidates) {
|
|
276
|
+
if (chosen.length >= limits.maxRows) break;
|
|
277
|
+
if (chosen.some(other => run.start < other.end && other.start < run.end)) continue;
|
|
278
|
+
const left = Math.min(...run.template.map(bone => bone[0])), right = Math.max(...run.template.map(bone => bone[0] + bone[2]));
|
|
279
|
+
const blocked = bones.some((bone, index) => (index < run.start || index >= run.end) && bone[1] >= run.top
|
|
280
|
+
&& bone[0] < right && bone[0] + bone[2] > left);
|
|
281
|
+
if (!blocked) chosen.push(run);
|
|
282
|
+
}
|
|
283
|
+
const inRun = index => chosen.some(run => index >= run.start && index < run.end);
|
|
284
|
+
return { bones: bones.filter((_, index) => !inRun(index)),
|
|
285
|
+
rows: chosen.sort((a, b) => a.top - b.top).map(run => ({ y: Math.max(0, run.top), h: Math.max(1, run.pitch), bones: run.template, repeat: 'fill' })) };
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** Keep at most `maxBones`: merge leaves on one line first, then drop the lowest bones. */
|
|
289
|
+
export function capBones(bones, maxBones = SKELETON_LIMITS.maxBones) {
|
|
290
|
+
if (bones.length <= maxBones) return bones;
|
|
291
|
+
const merged = [];
|
|
292
|
+
for (const bone of [...bones].sort((a, b) => a[1] - b[1] || a[3] - b[3] || a[0] - b[0])) {
|
|
293
|
+
const last = merged[merged.length - 1];
|
|
294
|
+
if (last && bone[5] === 0 && last[5] === 0 && last[1] === bone[1] && last[3] === bone[3] && bone[0] - (last[0] + last[2]) <= 2) {
|
|
295
|
+
last[2] = round2(Math.min(100 - last[0], Math.max(last[0] + last[2], bone[0] + bone[2]) - last[0]));
|
|
296
|
+
} else merged.push([...bone]);
|
|
297
|
+
}
|
|
298
|
+
return merged.length <= maxBones ? merged : merged.sort((a, b) => a[1] - b[1]).slice(0, maxBones);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** One region entry from a final measurement: height before folding, rows folded, bones capped. */
|
|
302
|
+
export function buildSkeletonEntry(measurement) {
|
|
303
|
+
const bones = measurement.bones || [];
|
|
304
|
+
const height = Math.max(0, Math.min(SKELETON_LIMITS.maxPx, bones.reduce((max, bone) => Math.max(max, bone[1] + bone[3]), 0)));
|
|
305
|
+
const folded = foldRepeatRows(bones, measurement.groups || []);
|
|
306
|
+
const entry = { height, bones: capBones(folded.bones) };
|
|
307
|
+
if (folded.rows.length) entry.rows = folded.rows;
|
|
308
|
+
return entry;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* The release document from per-width, per-locale measurements:
|
|
313
|
+
* `measurements[width][locale] = { regions: [{ key, bones, groups }] }`.
|
|
314
|
+
*/
|
|
315
|
+
export function buildSkeletonDocument({ sourceHash, measurements }) {
|
|
316
|
+
const regions = {};
|
|
317
|
+
for (const width of SKELETON_WIDTHS) for (const locale of SKELETON_LOCALES) {
|
|
318
|
+
for (const region of measurements?.[width]?.[locale]?.regions || []) {
|
|
319
|
+
if (!SKELETON_REGION_KEY.test(region.key) || !region.bones?.length) continue;
|
|
320
|
+
if (!regions[region.key] && Object.keys(regions).length >= SKELETON_LIMITS.maxRegions) continue;
|
|
321
|
+
((regions[region.key] ||= {})[String(width)] ||= {})[locale] = buildSkeletonEntry(region);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return Object.keys(regions).length ? { schema: SKELETON_SCHEMA, sourceHash, regions } : null;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
const sortKeys = value => Array.isArray(value) ? value.map(sortKeys)
|
|
328
|
+
: value && typeof value === 'object' ? Object.fromEntries(Object.keys(value).sort().map(key => [key, sortKeys(value[key])])) : value;
|
|
329
|
+
/** Canonical bytes: sorted keys, no whitespace. */
|
|
330
|
+
export function canonicalSkeletonJson(document) { return JSON.stringify(sortKeys(document)); }
|
|
331
|
+
|
|
332
|
+
/** Mirrors `validate_space_skeleton`; returns the first broken rule or null. `appJsSha256` is the hex digest. */
|
|
333
|
+
export function validateSkeletonDocument(document, { appJsSha256 } = {}) {
|
|
334
|
+
const L = SKELETON_LIMITS;
|
|
335
|
+
const plain = value => value && typeof value === 'object' && !Array.isArray(value);
|
|
336
|
+
const int = (value, low, high) => Number.isInteger(value) && value >= low && value <= high;
|
|
337
|
+
const percent = value => typeof value === 'number' && Number.isFinite(value) && value >= 0 && value <= 100
|
|
338
|
+
&& Math.abs(round2(value) - value) <= 1e-9;
|
|
339
|
+
const extra = (value, keys) => Object.keys(value).find(key => !keys.includes(key));
|
|
340
|
+
const bonesError = (value, limit, where) => {
|
|
341
|
+
if (!Array.isArray(value)) return `${where} bones must be a list`;
|
|
342
|
+
if (value.length > limit) return `${where} has more than ${limit} bones`;
|
|
343
|
+
for (const [index, bone] of value.entries()) {
|
|
344
|
+
if (!Array.isArray(bone) || bone.length !== 6) return `${where} bone ${index} must be [x, y, w, h, r, t]`;
|
|
345
|
+
const [x, y, w, h, r, t] = bone;
|
|
346
|
+
if (!percent(x) || !percent(w)) return `${where} bone ${index} x and w must be percents with at most 2 decimals`;
|
|
347
|
+
if (!int(y, 0, L.maxPx) || !int(h, 0, L.maxPx)) return `${where} bone ${index} y and h must be integers from 0 to ${L.maxPx}`;
|
|
348
|
+
if (!int(r, 0, L.maxRadius)) return `${where} bone ${index} r must be an integer from 0 to ${L.maxRadius}`;
|
|
349
|
+
if (!int(t, 0, L.maxType)) return `${where} bone ${index} t must be an integer from 0 to ${L.maxType}`;
|
|
350
|
+
}
|
|
351
|
+
return null;
|
|
352
|
+
};
|
|
353
|
+
if (!plain(document)) return 'it must be a JSON object';
|
|
354
|
+
let size;
|
|
355
|
+
try { size = Buffer.byteLength(canonicalSkeletonJson(document), 'utf8'); } catch { return 'it is not valid JSON'; }
|
|
356
|
+
if (size > L.maxBytes) return `it is larger than ${L.maxBytes / 1024} KiB`;
|
|
357
|
+
const top = extra(document, ['schema', 'sourceHash', 'regions']);
|
|
358
|
+
if (top) return `unknown top-level key "${top}"`;
|
|
359
|
+
if (document.schema !== SKELETON_SCHEMA) return `schema must be "${SKELETON_SCHEMA}"`;
|
|
360
|
+
if (typeof document.sourceHash !== 'string' || !/^[0-9a-f]{64}$/.test(document.sourceHash)) return 'sourceHash must be a sha256 hex digest';
|
|
361
|
+
if (appJsSha256 !== undefined && document.sourceHash !== appJsSha256) return 'sourceHash does not match the sha256 of bundle/app.js';
|
|
362
|
+
if (!plain(document.regions)) return 'regions must be an object';
|
|
363
|
+
const keys = Object.keys(document.regions);
|
|
364
|
+
if (keys.length > L.maxRegions) return `it has more than ${L.maxRegions} regions`;
|
|
365
|
+
for (const key of keys) {
|
|
366
|
+
if (!SKELETON_REGION_KEY.test(key)) return `region key "${key}" is invalid`;
|
|
367
|
+
const widths = document.regions[key];
|
|
368
|
+
if (!plain(widths)) return `region "${key}" must be an object`;
|
|
369
|
+
for (const [width, locales] of Object.entries(widths)) {
|
|
370
|
+
if (!['390', '1440'].includes(width)) return `region "${key}" width "${width}" must be "390" or "1440"`;
|
|
371
|
+
if (!plain(locales)) return `region "${key}" width "${width}" must be an object`;
|
|
372
|
+
for (const [locale, entry] of Object.entries(locales)) {
|
|
373
|
+
const where = `region "${key}" ${width} ${locale}`;
|
|
374
|
+
if (!['en', 'fr'].includes(locale)) return `${where} locale must be "en" or "fr"`;
|
|
375
|
+
if (!plain(entry)) return `${where} must be an object`;
|
|
376
|
+
const unknown = extra(entry, ['height', 'bones', 'rows']);
|
|
377
|
+
if (unknown) return `${where} has unknown key "${unknown}"`;
|
|
378
|
+
if (!int(entry.height, 0, L.maxPx)) return `${where} height must be an integer from 0 to ${L.maxPx}`;
|
|
379
|
+
const bones = bonesError(entry.bones, L.maxBones, where);
|
|
380
|
+
if (bones) return bones;
|
|
381
|
+
if (entry.rows === undefined) continue;
|
|
382
|
+
if (!Array.isArray(entry.rows)) return `${where} rows must be a list`;
|
|
383
|
+
if (entry.rows.length > L.maxRows) return `${where} has more than ${L.maxRows} rows`;
|
|
384
|
+
for (const [index, row] of entry.rows.entries()) {
|
|
385
|
+
const label = `${where} row ${index}`;
|
|
386
|
+
if (!plain(row)) return `${label} must be an object`;
|
|
387
|
+
const unknownRow = extra(row, ['y', 'h', 'bones', 'repeat']);
|
|
388
|
+
if (unknownRow) return `${label} has unknown key "${unknownRow}"`;
|
|
389
|
+
if (row.repeat !== 'fill') return `${label} repeat must be "fill"`;
|
|
390
|
+
if (!int(row.y, 0, L.maxPx) || !int(row.h, 1, L.maxPx)) return `${label} y and h must be integers (h at least 1)`;
|
|
391
|
+
const rowBones = bonesError(row.bones, L.maxRowBones, label);
|
|
392
|
+
if (rowBones) return rowBones;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return null;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Pending checks for one width and locale. `pending` is the probe of the pending pass that was looked at
|
|
402
|
+
* (with bones when a document exists, else the fallback skeleton), `regions` the pass 1 region boxes,
|
|
403
|
+
* `final` the final probe and `heights[key]` the measured final content height of each region.
|
|
404
|
+
*/
|
|
405
|
+
export function runSkeletonChecks({ width, locale, pending, regions = pending?.regions || [], final, heights = {} }) {
|
|
406
|
+
if (!pending || pending.static) return [];
|
|
407
|
+
const findings = [];
|
|
408
|
+
const add = (check, message, region) => findings.push({ check, severity: 'warning', width, locale,
|
|
409
|
+
...(region ? { region } : {}), message });
|
|
410
|
+
const viewport = pending.viewport?.height || 900;
|
|
411
|
+
for (const region of pending.regions || []) {
|
|
412
|
+
if (region.ink === 0) add('blank_region', `The "${region.key}" region is blank while its data loads. Render ViewSkeleton for it.`, region.key);
|
|
413
|
+
}
|
|
414
|
+
if (!(pending.regions || []).length && pending.appBlank) add('blank_region', 'The page is blank while its data loads. Render ViewSkeleton for the missing region.');
|
|
415
|
+
if (pending.loadingText) add('loading_text', `The loading state shows the text "${pending.loadingText}". Show the skeleton instead of a loading message.`);
|
|
416
|
+
if (pending.spinnerOnly) add('page_spinner', 'The loading state shows only a spinner. Show the skeleton instead.');
|
|
417
|
+
if (pending.emptyStates > 0) add('empty_before_data', 'An empty state is visible before the first read answers. Show the skeleton until the data arrives.');
|
|
418
|
+
if (final?.landmarks?.length) {
|
|
419
|
+
const seen = new Map();
|
|
420
|
+
const drifted = [];
|
|
421
|
+
for (const landmark of final.landmarks) {
|
|
422
|
+
const occurrence = seen.get(landmark.sel) || 0; seen.set(landmark.sel, occurrence + 1);
|
|
423
|
+
const before = (pending.landmarks || []).filter(value => value.sel === landmark.sel)[occurrence];
|
|
424
|
+
if (!before) continue;
|
|
425
|
+
const drift = Math.max(Math.abs(before.x - landmark.x), Math.abs(before.y - landmark.y));
|
|
426
|
+
if (drift > DRIFT_PX) drifted.push({ sel: landmark.sel, drift });
|
|
427
|
+
}
|
|
428
|
+
for (const { sel, drift } of drifted.slice(0, 5)) {
|
|
429
|
+
add('landmark_drift', `"${sel}" moves ${Math.round(drift)} px when the data arrives. Keep its place reserved while loading.`);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
for (const region of regions) {
|
|
433
|
+
if (!SKELETON_REGION_KEY.test(region.key)) {
|
|
434
|
+
add('no_bones', `The region key "${region.key}" is invalid, so no skeleton was measured for it. Use lowercase letters, digits, "-" or "_".`, region.key.slice(0, 32));
|
|
435
|
+
continue;
|
|
436
|
+
}
|
|
437
|
+
const height = heights[region.key];
|
|
438
|
+
if (!height) {
|
|
439
|
+
add('no_bones', `The "${region.key}" region was found but its final content gave no shapes to measure.`, region.key);
|
|
440
|
+
continue;
|
|
441
|
+
}
|
|
442
|
+
const now = (pending.regions || []).find(value => value.key === region.key);
|
|
443
|
+
if (!now) continue;
|
|
444
|
+
const skeletonBottom = Math.min(viewport, now.y + now.height);
|
|
445
|
+
const finalBottom = Math.min(viewport, region.y + height);
|
|
446
|
+
const jump = Math.round(finalBottom - skeletonBottom);
|
|
447
|
+
if (Math.abs(jump) > JUMP_PX) add('height_jump', `The "${region.key}" region ${jump > 0 ? 'grows' : 'shrinks'} by ${Math.abs(jump)} px when the data arrives.`, region.key);
|
|
448
|
+
}
|
|
449
|
+
return findings;
|
|
450
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@notis_ai/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.27",
|
|
4
4
|
"description": "Agent-first Notis CLI for Spaces, Skills and generic tool execution",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"ajv-formats": "^3.0.1",
|
|
36
36
|
"commander": "^15.0.0",
|
|
37
37
|
"esbuild": "^0.28.2",
|
|
38
|
-
"playwright-core": "1.
|
|
38
|
+
"playwright-core": "1.64.1"
|
|
39
39
|
},
|
|
40
40
|
"keywords": [
|
|
41
41
|
"notis",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"react-dom": "19.3.0"
|
|
53
53
|
},
|
|
54
54
|
"notisRelease": {
|
|
55
|
-
"sourceSha": "
|
|
55
|
+
"sourceSha": "7fda8d9020cc8bd18b3698e1ca4eb134d399b157",
|
|
56
56
|
"channel": "stable"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "7fda8d9020cc8bd18b3698e1ca4eb134d399b157"
|
|
59
59
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- notis-cli:instructions:start -->
|
|
2
2
|
## Notis CLI
|
|
3
3
|
|
|
4
|
-
Use the Notis CLI (`npx --package @notis_ai/cli@latest -- notis ...`) whenever the task involves the user's personal data or connected services: integrations (Gmail, Google Calendar, Notion, Slack, GitHub, ...), long-term memories, reminders, automations, native Notis databases and notes, and public
|
|
4
|
+
Use the Notis CLI (`npx --package @notis_ai/cli@latest -- notis ...`) whenever the task involves the user's personal data or connected services: integrations (Gmail, Google Calendar, Notion, Slack, GitHub, ...), long-term memories, reminders, automations, native Notis databases and notes, and public web research. Prefer it over telling the user to operate another app manually, and never treat a task as blocked merely because a capability is absent from the current tool list—reach it through the CLI.
|
|
5
5
|
|
|
6
6
|
On a local machine, `notis login` authorizes a scoped, revocable OAuth profile in the browser. Notis Desktop may authorize that profile automatically, but the Desktop app does not need to remain running. Hosted Notis shells use `NOTIS_JWT`. Before acting on personal data, run `notis whoami` when the intended account or endpoint is not already clear.
|
|
7
7
|
|
|
@@ -15,7 +15,7 @@ Relevant Notis long-term memory may be injected into a turn inside `<notis_relev
|
|
|
15
15
|
4. Execute: `notis tools exec <TOOL> --arguments '<json>'`; batch independent calls with `notis tools exec-parallel '<json-array>'`.
|
|
16
16
|
5. If an integration is not connected, `notis tools link <toolkit>` prints a connection URL to give the user.
|
|
17
17
|
|
|
18
|
-
For memory writes, reminders, automations, database writes, public
|
|
18
|
+
For memory writes, reminders, automations, database writes, public web research and Notis Spaces, discover the tools not listed below and follow the applicable installed Skill.
|
|
19
19
|
|
|
20
20
|
Run one discovery query per capability and reuse its tool names and schemas marked `hasFullSchema: true`; fetch a schema only when it is missing or incomplete. For a large answer, capture it once, keep stderr separate from stdout, and inspect the saved response locally instead of truncating it and repeating discovery. A returned session field is a tool argument, not an instruction to add CLI flags.
|
|
21
21
|
|
|
@@ -29,7 +29,11 @@ Call these with `notis tools exec <TOOL>` (add `--get-schema` first when you nee
|
|
|
29
29
|
[
|
|
30
30
|
{
|
|
31
31
|
"name": "LOCAL_NOTIS_LOAD_CONVERSATION_HISTORY",
|
|
32
|
-
"description": "Read the current or specified owned topical conversation, including user replies, sent messages, attachments, saved voice transcripts with speaker roles and delivery state. Use LOCAL_NOTIS_SEARCH_THREADS to find another conversation when its thread_id is unknown. Raw provider payloads and developer/tool internals are not returned. Omit after and limit for full history; pass limit (1–200) to page from the start, then reuse next_cursor as after. Cursor reads default to 50 records and return immediately, even when empty. Merge records by record_id, replacing that record’s items on each revision; removed records delete prior items. Reads are independent and never consume another agent’s replies. Poll as often as your task needs; sending is always a separate explicit action."
|
|
32
|
+
"description": "Read the current or specified owned topical conversation, including user replies, sent messages, attachments, saved voice transcripts with speaker roles and delivery state. Use LOCAL_NOTIS_SEARCH_THREADS to find another conversation when its thread_id is unknown. Raw provider payloads and developer/tool internals are not returned. Omit after and limit for full history; pass limit (1–200) to page from the start, then reuse next_cursor as after. To read what a conversation says now, pass latest (1–200) alone: the newest messages first, without change records. Cursor reads default to 50 records and return immediately, even when empty. Merge records by record_id, replacing that record’s items on each revision; removed records delete prior items. Full reads and the first page (no after) also return agents, one entry per agent that worked in the thread: agent_id, name, provider (notis, codex or claude), intelligence, status, first_run_at, last_run_at, runs, skills it loaded, the interaction_ids it handled and a one-line last_result; read one agent's full work with LOCAL_NOTIS_LOAD_AGENT_CONTEXT. Cursor reads (after) omit agents. Reads are independent and never consume another agent’s replies. Poll as often as your task needs; sending is always a separate explicit action."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "LOCAL_NOTIS_LOAD_AGENT_CONTEXT",
|
|
36
|
+
"description": "Read one agent's full recorded work in a conversation, oldest first: the instructions it received, user messages, its tool calls with arguments, complete tool results, its own messages and final answers, and compaction summaries where earlier context was compacted. Use an agent_id from the agents list of LOCAL_NOTIS_LOAD_CONVERSATION_HISTORY for the same thread; omit thread_id for the current one. Nothing is shortened: page with limit and reuse next_cursor while has_more is true, or pass turn_id for one run. The first page also returns system_instructions. It reads Notis's saved records, so Codex and Claude agents stay readable while the Cloud Computer is off; not_available says what Notis did not record."
|
|
33
37
|
},
|
|
34
38
|
{
|
|
35
39
|
"name": "LOCAL_NOTIS_SEARCH_THREADS",
|
|
@@ -57,7 +61,7 @@ Call these with `notis tools exec <TOOL>` (add `--get-schema` first when you nee
|
|
|
57
61
|
},
|
|
58
62
|
{
|
|
59
63
|
"name": "LOCAL_NOTIS_BEGIN_CHANNEL_CONNECTION",
|
|
60
|
-
"description": "Start a provider-verification or authorization flow for one messaging channel. To add an email address or alias, pass channel=email with identifier: Notis emails a one-time confirmation link
|
|
64
|
+
"description": "Start a provider-verification or authorization flow for one messaging channel. To add an email address or alias, pass channel=email with identifier: Notis emails a one-time confirmation link to that address; only that link adds it, an email sent to Notis never does. already_connected means the address is already on this account; code email_in_use means another account owns it. Never report the channel as connected until LOCAL_NOTIS_GET_CHANNEL_CONNECTION_STATUS reads back an owned account."
|
|
61
65
|
},
|
|
62
66
|
{
|
|
63
67
|
"name": "LOCAL_NOTIS_DISCONNECT_CHANNEL_CONNECTION",
|
|
@@ -78,7 +78,17 @@ npx --package @notis_ai/cli@latest -- notis tools exec LOCAL_NOTIS_SAVE_USER_SET
|
|
|
78
78
|
--arguments '{"first_name":"...","position":"...","language":"...","timezone":"..."}'
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
## 2.
|
|
81
|
+
## 2. Install the Space they came for
|
|
82
|
+
|
|
83
|
+
Skip this step unless the settings have `store_listing_id` and `notis spaces store installs` does not list that listing yet. You keep the basics, the connections and step 4; the Space's own Skill only adds to them.
|
|
84
|
+
|
|
85
|
+
1. Check it: `notis spaces store check <store_listing_id>` (add `--locale fr` for a French speaker).
|
|
86
|
+
2. Tell the user, in plain words, what it brings, each item of `risks` and the `recommendation`. If the result has a `trust_line`, quote it on its own line exactly as written: never reword or shorten it.
|
|
87
|
+
3. Wait for an explicit yes in their next message: ask, then end your turn. A question or "maybe" is not a yes.
|
|
88
|
+
4. Install it: `notis spaces store install <store_listing_id> --request-id space-<store_listing_id> --receipt <receipt_id> --confirmed`. Its automations arrive paused; say so.
|
|
89
|
+
5. If the result has `onboarding_skill`, follow its `instructions` now. It never asks again for the basics and never finishes onboarding: step 4 stays yours.
|
|
90
|
+
|
|
91
|
+
## 3. Connect one app, then immediately read from it
|
|
82
92
|
|
|
83
93
|
Ask what they use day to day. Gmail, Google Calendar, Notion, Slack, Linear, and
|
|
84
94
|
their CRM are the common answers. For each:
|
|
@@ -94,15 +104,11 @@ through the connection and show them the actual result: today's calendar events,
|
|
|
94
104
|
their most recent email threads, the databases in their Notion. A connected
|
|
95
105
|
integration is a claim; their own data on screen is proof.
|
|
96
106
|
|
|
97
|
-
If they connect nothing, you may offer a Space from the Space Store instead
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
not available for this account (`spaces_unavailable` or
|
|
101
|
-
`spaces_store_unavailable`), skip this fallback without retrying and go to
|
|
102
|
-
step 3. Otherwise install one with
|
|
103
|
-
`notis spaces store install <listing-id> --request-id <stable-id>`.
|
|
107
|
+
If they connect nothing, you may offer a Space from the Space Store instead:
|
|
108
|
+
list them with `notis spaces store list`, then check and install the one they
|
|
109
|
+
pick exactly as in step 2.
|
|
104
110
|
|
|
105
|
-
##
|
|
111
|
+
## 4. Finish onboarding
|
|
106
112
|
|
|
107
113
|
**Do this. It is not optional.**
|
|
108
114
|
|