@skrr-ai/cli 0.1.102 → 0.1.103
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/dist/base-command.js +24 -0
- package/dist/commands/agent/message/send.js +6 -2
- package/dist/commands/agents/triggers/create.js +7 -17
- package/dist/commands/agents/triggers/update.js +41 -28
- package/dist/commands/commitments/preflight.js +18 -1
- package/dist/commands/commitments/roster.d.ts +15 -0
- package/dist/commands/commitments/roster.js +39 -0
- package/dist/commands/commitments/show.js +1 -1
- package/dist/commands/commitments/status.d.ts +17 -0
- package/dist/commands/commitments/status.js +41 -0
- package/dist/commands/commitments/update.js +12 -0
- package/dist/commands/daemon/logs.d.ts +39 -1
- package/dist/commands/daemon/logs.js +140 -13
- package/dist/commands/followups/checkin.js +46 -3
- package/dist/commands/tasks/approvals/resolve.d.ts +12 -0
- package/dist/commands/tasks/approvals/resolve.js +21 -5
- package/dist/commands/triggers/create.js +8 -17
- package/dist/commands/triggers/fire.js +3 -0
- package/dist/commands/triggers/update.js +41 -27
- package/dist/commands/widgets/check.d.ts +39 -0
- package/dist/commands/widgets/check.js +179 -0
- package/dist/lib/agent-mailbox.d.ts +0 -1
- package/dist/lib/agent-mailbox.js +0 -1
- package/dist/lib/commitment-loop-status.d.ts +16 -0
- package/dist/lib/commitment-loop-status.js +164 -0
- package/dist/lib/commitments.d.ts +28 -1
- package/dist/lib/commitments.js +184 -5
- package/dist/lib/delegated-cli.d.ts +23 -1
- package/dist/lib/delegated-cli.js +61 -4
- package/dist/lib/first-party-harness.d.ts +1 -1
- package/dist/lib/first-party-harness.js +1 -1
- package/dist/lib/session-task-write.d.ts +13 -0
- package/dist/lib/session-task-write.js +63 -3
- package/dist/lib/triggers.d.ts +26 -0
- package/dist/lib/triggers.js +134 -1
- package/dist/lib/widgetCheck.d.ts +123 -0
- package/dist/lib/widgetCheck.js +998 -0
- package/dist/lib/widgetStaticScan.d.ts +111 -0
- package/dist/lib/widgetStaticScan.js +833 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.d.ts +9 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +12 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.d.ts +9 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +12 -0
- package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +11902 -8696
- package/oclif.manifest.json +218 -5
- package/package.json +2 -2
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generative UI — a cheap, conservative static scan of a widget's CSS, HTML and
|
|
3
|
+
* JavaScript for things that predict a failure INSIDE the sandboxed frame.
|
|
4
|
+
*
|
|
5
|
+
* WHAT THIS IS NOT. It is not the frame. The frame's Content-Security-Policy and
|
|
6
|
+
* `sandbox="allow-scripts"` (packages/data-provider `generativeUi/csp.ts`) decide
|
|
7
|
+
* what actually runs; this module only reads source text and says what the frame
|
|
8
|
+
* would very likely refuse. Every finding is therefore tagged `heuristic` by the
|
|
9
|
+
* caller, and the wording never claims more than the text shows ("looks like a
|
|
10
|
+
* fetch() call"). A finding can be a false positive (a name inside a string that
|
|
11
|
+
* never runs); the ABSENCE of findings proves nothing, because a script can
|
|
12
|
+
* assemble `fetch` at run time. It exists so a harness can notice the likely
|
|
13
|
+
* mistake before it sends the message, when fixing it is free.
|
|
14
|
+
*
|
|
15
|
+
* Severity: `error` means "the frame's CSP or sandbox blocks this if it runs";
|
|
16
|
+
* `warn` means "this probably does not do what the author meant".
|
|
17
|
+
*
|
|
18
|
+
* It is a lexer-light scanner on purpose. JavaScript is read once into a CODE
|
|
19
|
+
* view (comments, string and template text and regular-expression bodies blanked,
|
|
20
|
+
* same length, line breaks kept) and a list of the string literals: the rules about
|
|
21
|
+
* calls and names run over the code view only, so `"eval( is blocked"` in a label and
|
|
22
|
+
* a comment that says "do not call fetch()" are not findings, and the rules about
|
|
23
|
+
* what a string SAYS (a URL, markup that loads one) run over the literals only. No
|
|
24
|
+
* regular expression here can backtrack on the size the widget limits allow, and
|
|
25
|
+
* HTML is walked with `indexOf`, not with a lazy regex.
|
|
26
|
+
*
|
|
27
|
+
* The eval's static checks (`api/.../eval/generativeUi/staticChecks.js`) ask most
|
|
28
|
+
* of the same questions with a lexer of their own (`sourceLexers.js`), because this
|
|
29
|
+
* package may not import from `api/`. `generativeUiScannerAgreement.spec.js` runs
|
|
30
|
+
* both over one corpus and fails when they disagree about what the frame refuses.
|
|
31
|
+
*/
|
|
32
|
+
import { UI_WIDGET_FENCE } from '@skrr-ai/data-provider';
|
|
33
|
+
export type ScanSection = Exclude<(typeof UI_WIDGET_FENCE.sections)[number], 'fallback'>;
|
|
34
|
+
export type StaticSeverity = 'error' | 'warn';
|
|
35
|
+
export type StaticCode = 'external-resource' | 'external-url' | 'external-link' | 'relative-url' | 'network-api' | 'worker' | 'dynamic-code' | 'storage' | 'host-access' | 'popup' | 'navigation' | 'form-action' | 'base-element' | 'nested-frame' | 'plugin-element' | 'element-close' | 'webrtc';
|
|
36
|
+
export interface StaticFinding {
|
|
37
|
+
severity: StaticSeverity;
|
|
38
|
+
code: StaticCode;
|
|
39
|
+
section: ScanSection;
|
|
40
|
+
/** 1-based line within the section's own text. */
|
|
41
|
+
line: number;
|
|
42
|
+
message: string;
|
|
43
|
+
fix?: string;
|
|
44
|
+
}
|
|
45
|
+
/** A classic inline `<script>` found inside the html section. */
|
|
46
|
+
export interface InlineScript {
|
|
47
|
+
content: string;
|
|
48
|
+
/** 1-based line within the html section where the script's text starts. */
|
|
49
|
+
line: number;
|
|
50
|
+
}
|
|
51
|
+
export interface StaticScanResult {
|
|
52
|
+
findings: StaticFinding[];
|
|
53
|
+
/** Classic inline scripts of the html section, for a syntax check by the caller. */
|
|
54
|
+
inlineScripts: InlineScript[];
|
|
55
|
+
}
|
|
56
|
+
export interface WidgetSource {
|
|
57
|
+
css: string;
|
|
58
|
+
html: string;
|
|
59
|
+
js: string;
|
|
60
|
+
}
|
|
61
|
+
/** One string, template chunk or regular expression found in a script. */
|
|
62
|
+
export interface JsLiteral {
|
|
63
|
+
kind: 'string' | 'template' | 'regex';
|
|
64
|
+
/** Offset of the delimiter that opened it (a quote, a backtick, the `}` that resumed a template, a `/`). */
|
|
65
|
+
open: number;
|
|
66
|
+
/** Offset of the first character of its text. */
|
|
67
|
+
start: number;
|
|
68
|
+
/** Its text as written in the source: escapes are NOT interpreted. */
|
|
69
|
+
value: string;
|
|
70
|
+
}
|
|
71
|
+
export interface LexedJs {
|
|
72
|
+
/**
|
|
73
|
+
* The script with comments, string and template text and regular-expression
|
|
74
|
+
* bodies replaced by spaces: the same length, every line break kept, delimiters
|
|
75
|
+
* kept. What is left is what the engine would read as code (template `${ … }`
|
|
76
|
+
* expressions included).
|
|
77
|
+
*/
|
|
78
|
+
code: string;
|
|
79
|
+
/** The script with only its comments blanked. */
|
|
80
|
+
commentless: string;
|
|
81
|
+
literals: JsLiteral[];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Read a script once. Total and linear: it never throws, every loop advances, and
|
|
85
|
+
* a misread costs a missed or an extra finding, never a hang. It is a heuristic
|
|
86
|
+
* where JavaScript is ambiguous (a `/` after `)` is read as division; an unclosed
|
|
87
|
+
* quote ends at the line break), and picks the reading that leaves the rest of the
|
|
88
|
+
* text lexable.
|
|
89
|
+
*/
|
|
90
|
+
export declare function lexJs(src: string): LexedJs;
|
|
91
|
+
/**
|
|
92
|
+
* Blank the comments of JavaScript, leaving strings, template text and regular
|
|
93
|
+
* expressions untouched (the URLs a script uses live in strings). Strings end at
|
|
94
|
+
* a line break, so one unbalanced quote cannot swallow the rest of the file; the
|
|
95
|
+
* cost of a misread is a missed finding, never a false one.
|
|
96
|
+
*/
|
|
97
|
+
export declare function maskJsComments(src: string): string;
|
|
98
|
+
/** Blank the block comments of CSS, stepping over quoted strings. */
|
|
99
|
+
export declare function maskCssComments(src: string): string;
|
|
100
|
+
/** Blank `<!-- … -->` comments of HTML. */
|
|
101
|
+
export declare function maskHtmlComments(src: string): string;
|
|
102
|
+
type UrlKind = 'external' | 'inline' | 'relative' | 'empty';
|
|
103
|
+
/** A URL the frame cannot fetch from, a self-contained one, or one with no base to resolve against. */
|
|
104
|
+
export declare function classifyUrl(raw: string): UrlKind;
|
|
105
|
+
/**
|
|
106
|
+
* Scan one widget's three sections. Pure and total: it never throws and reads
|
|
107
|
+
* only the strings it is given; the cost is linear in their length, which the
|
|
108
|
+
* caller has already bounded by the widget limits.
|
|
109
|
+
*/
|
|
110
|
+
export declare function scanWidgetSource(source: WidgetSource): StaticScanResult;
|
|
111
|
+
export {};
|