@nxisai/agent-harness 0.2.0
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 +434 -0
- package/dist/a2ui/cards.d.ts +55 -0
- package/dist/a2ui/cards.d.ts.map +1 -0
- package/dist/a2ui/cards.js +133 -0
- package/dist/a2ui/cards.js.map +1 -0
- package/dist/a2ui/emit.d.ts +33 -0
- package/dist/a2ui/emit.d.ts.map +1 -0
- package/dist/a2ui/emit.js +116 -0
- package/dist/a2ui/emit.js.map +1 -0
- package/dist/a2ui/form.d.ts +20 -0
- package/dist/a2ui/form.d.ts.map +1 -0
- package/dist/a2ui/form.js +92 -0
- package/dist/a2ui/form.js.map +1 -0
- package/dist/a2ui/host.d.ts +34 -0
- package/dist/a2ui/host.d.ts.map +1 -0
- package/dist/a2ui/host.js +47 -0
- package/dist/a2ui/host.js.map +1 -0
- package/dist/a2ui/index.d.ts +23 -0
- package/dist/a2ui/index.d.ts.map +1 -0
- package/dist/a2ui/index.js +20 -0
- package/dist/a2ui/index.js.map +1 -0
- package/dist/a2ui/stepper.d.ts +26 -0
- package/dist/a2ui/stepper.d.ts.map +1 -0
- package/dist/a2ui/stepper.js +162 -0
- package/dist/a2ui/stepper.js.map +1 -0
- package/dist/a2ui/theme.d.ts +21 -0
- package/dist/a2ui/theme.d.ts.map +1 -0
- package/dist/a2ui/theme.js +134 -0
- package/dist/a2ui/theme.js.map +1 -0
- package/dist/a2ui/to-v09.d.ts +31 -0
- package/dist/a2ui/to-v09.d.ts.map +1 -0
- package/dist/a2ui/to-v09.js +104 -0
- package/dist/a2ui/to-v09.js.map +1 -0
- package/dist/engine.d.ts +209 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +505 -0
- package/dist/engine.js.map +1 -0
- package/dist/harness/harness.d.ts +284 -0
- package/dist/harness/harness.d.ts.map +1 -0
- package/dist/harness/harness.js +568 -0
- package/dist/harness/harness.js.map +1 -0
- package/dist/harness/plan.d.ts +32 -0
- package/dist/harness/plan.d.ts.map +1 -0
- package/dist/harness/plan.js +68 -0
- package/dist/harness/plan.js.map +1 -0
- package/dist/harness/policy.d.ts +49 -0
- package/dist/harness/policy.d.ts.map +1 -0
- package/dist/harness/policy.js +34 -0
- package/dist/harness/policy.js.map +1 -0
- package/dist/harness/renderer.d.ts +163 -0
- package/dist/harness/renderer.d.ts.map +1 -0
- package/dist/harness/renderer.js +12 -0
- package/dist/harness/renderer.js.map +1 -0
- package/dist/harness/router/coordinator.d.ts +120 -0
- package/dist/harness/router/coordinator.d.ts.map +1 -0
- package/dist/harness/router/coordinator.js +145 -0
- package/dist/harness/router/coordinator.js.map +1 -0
- package/dist/harness/router/rules.d.ts +48 -0
- package/dist/harness/router/rules.d.ts.map +1 -0
- package/dist/harness/router/rules.js +38 -0
- package/dist/harness/router/rules.js.map +1 -0
- package/dist/harness/slots.d.ts +73 -0
- package/dist/harness/slots.d.ts.map +1 -0
- package/dist/harness/slots.js +68 -0
- package/dist/harness/slots.js.map +1 -0
- package/dist/harness/tools/bridge.d.ts +71 -0
- package/dist/harness/tools/bridge.d.ts.map +1 -0
- package/dist/harness/tools/bridge.js +271 -0
- package/dist/harness/tools/bridge.js.map +1 -0
- package/dist/harness/tools/client.d.ts +11 -0
- package/dist/harness/tools/client.d.ts.map +1 -0
- package/dist/harness/tools/client.js +21 -0
- package/dist/harness/tools/client.js.map +1 -0
- package/dist/harness/tools/discovery.d.ts +13 -0
- package/dist/harness/tools/discovery.d.ts.map +1 -0
- package/dist/harness/tools/discovery.js +43 -0
- package/dist/harness/tools/discovery.js.map +1 -0
- package/dist/harness/tools/local-context.d.ts +38 -0
- package/dist/harness/tools/local-context.d.ts.map +1 -0
- package/dist/harness/tools/local-context.js +55 -0
- package/dist/harness/tools/local-context.js.map +1 -0
- package/dist/harness/tools/schema.d.ts +52 -0
- package/dist/harness/tools/schema.d.ts.map +1 -0
- package/dist/harness/tools/schema.js +175 -0
- package/dist/harness/tools/schema.js.map +1 -0
- package/dist/harness/tools/source.d.ts +65 -0
- package/dist/harness/tools/source.d.ts.map +1 -0
- package/dist/harness/tools/source.js +89 -0
- package/dist/harness/tools/source.js.map +1 -0
- package/dist/harness/tools/webmcp.d.ts +50 -0
- package/dist/harness/tools/webmcp.d.ts.map +1 -0
- package/dist/harness/tools/webmcp.js +114 -0
- package/dist/harness/tools/webmcp.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/types.d.ts +123 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +2 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/types.d.ts +223 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/agent-fullscreen.d.ts +41 -0
- package/dist/ui/agent-fullscreen.d.ts.map +1 -0
- package/dist/ui/agent-fullscreen.js +2821 -0
- package/dist/ui/agent-fullscreen.js.map +1 -0
- package/dist/ui/config.d.ts +88 -0
- package/dist/ui/config.d.ts.map +1 -0
- package/dist/ui/config.js +96 -0
- package/dist/ui/config.js.map +1 -0
- package/dist/ui/index.d.ts +22 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +19 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/tailwind.generated.d.ts +2 -0
- package/dist/ui/tailwind.generated.d.ts.map +1 -0
- package/dist/ui/tailwind.generated.js +3 -0
- package/dist/ui/tailwind.generated.js.map +1 -0
- package/dist/webmcp-contract.d.ts +57 -0
- package/dist/webmcp-contract.d.ts.map +1 -0
- package/dist/webmcp-contract.js +11 -0
- package/dist/webmcp-contract.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepper.js","sourceRoot":"","sources":["../../src/a2ui/stepper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,MAA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AAI,EAAE,EAAE;SAClF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme tokens for A2UI surfaces.
|
|
3
|
+
*
|
|
4
|
+
* The Lit renderer styles its components entirely through `--a2ui-*` custom
|
|
5
|
+
* properties. Those inherit across shadow boundaries, so setting them on the
|
|
6
|
+
* element containing `<a2ui-surface>` restyles everything inside it without
|
|
7
|
+
* `::part()`, a forked catalog, or a patched package.
|
|
8
|
+
*
|
|
9
|
+
* Values map onto the tokens the packaged element already declares, so surfaces
|
|
10
|
+
* follow the same palette rather than carrying a second copy of it.
|
|
11
|
+
*
|
|
12
|
+
* The rules encoded here:
|
|
13
|
+
* - sans first: Manrope for the title, Inter for everything readable
|
|
14
|
+
* - mono for labels only: field labels and tags, never body copy
|
|
15
|
+
* - blue for trust and action: the primary button and focus ring
|
|
16
|
+
* - light by default
|
|
17
|
+
*/
|
|
18
|
+
export declare const A2UI_THEME_CSS = "\n .a2ui-scope {\n /* Core roles */\n --a2ui-color-primary: var(--blue);\n --a2ui-color-primary-hover: var(--blue-strong);\n --a2ui-color-primary-dark: var(--blue-strong);\n --a2ui-color-primary-light: var(--blue-tint);\n --a2ui-color-on-primary: #FFFFFF;\n --a2ui-color-secondary: var(--surface);\n --a2ui-color-secondary-hover: var(--surface-2);\n --a2ui-color-on-secondary: var(--ink);\n --a2ui-color-surface: var(--bg);\n --a2ui-color-on-surface: var(--ink);\n --a2ui-color-on-background: var(--ink);\n --a2ui-color-border: var(--border);\n --a2ui-color-input: var(--bg);\n --a2ui-color-on-input: var(--ink);\n\n /* Type \u2014 Manrope displays, Inter reads (design.md \u00A71) */\n --a2ui-font-family-title: var(--display);\n --a2ui-font-size-xs: 11px; /* eyebrow / label size, matching .dc-row dt */\n --a2ui-font-size-s: 13px;\n --a2ui-font-size-m: 14px;\n --a2ui-font-size-l: 18px; /* markdown ### \u2192 .dc-title size */\n --a2ui-font-size-xl: 22px;\n --a2ui-font-size-2xl: 31px;\n --a2ui-line-height-body: 1.65;\n --a2ui-line-height-headings: 1.25;\n --a2ui-text-color-text: var(--ink);\n --a2ui-text-caption-color: var(--ink-3); /* same muted label ink as .dc-row dt */\n --a2ui-text-a-color: var(--blue);\n --a2ui-text-a-font-weight: 600;\n\n /* Radii \u2014 14px cards, 10px buttons, 999px pills (design.md \u00A71) */\n --a2ui-border-radius: var(--radius-sm);\n --a2ui-border: 1px solid var(--border);\n --a2ui-border-width: 1px;\n\n --a2ui-card-background: var(--bg);\n --a2ui-card-border: 1px solid var(--border);\n --a2ui-card-border-radius: var(--radius);\n --a2ui-card-box-shadow: var(--shadow-sm);\n /* 22px matches .detailcard, so an input card and a review card sitting in\n the same thread share one rhythm rather than three inherited paddings. */\n --a2ui-card-padding: 22px;\n --a2ui-card-margin: 0;\n\n /* Buttons: radius 10, weight 600, one primary per view (design.md \u00A74) */\n --a2ui-button-border-radius: var(--radius-sm);\n --a2ui-button-font-weight: 600;\n --a2ui-button-padding: 11px 20px;\n --a2ui-button-border: 1px solid var(--border-strong);\n --a2ui-button-background: var(--bg);\n --a2ui-button-box-shadow: none;\n /* Buttons sit in a Row with its own gap; a margin here would double it. */\n --a2ui-button-margin: 0;\n /* The label is a Text child, so the button's own colour comes from the\n secondary text token \u2014 this is what makes a default A2UI button read as\n .btn.ghost rather than as unstyled chrome. */\n --a2ui-color-on-secondary: var(--ink);\n --a2ui-color-secondary-hover: var(--surface-2);\n\n /* Inputs */\n --a2ui-textfield-border: 1px solid var(--border);\n --a2ui-textfield-border-radius: var(--radius-sm);\n --a2ui-textfield-padding: 10px 12px;\n --a2ui-textfield-color-border-focus: var(--blue);\n --a2ui-textfield-color-error: var(--red);\n --a2ui-textfield-label-font-size: 11px;\n --a2ui-textfield-label-font-weight: 500;\n\n --a2ui-checkbox-border: 1px solid var(--border-strong);\n --a2ui-checkbox-border-radius: 6px;\n --a2ui-checkbox-background: var(--bg);\n --a2ui-checkbox-color-error: var(--red);\n --a2ui-checkbox-size: 18px;\n --a2ui-checkbox-gap: 10px;\n --a2ui-checkbox-label-font-size: 14px;\n --a2ui-checkbox-label-font-weight: 400;\n\n /* Tags render as ChoicePicker chips / caption Text \u2014 pill radius */\n --a2ui-choicepicker-chip-border-radius: var(--radius-pill);\n --a2ui-choicepicker-chip-padding: 6px 12px;\n --a2ui-choicepicker-label-color: var(--ink-3);\n --a2ui-choicepicker-label-font-size: 11px;\n --a2ui-choicepicker-label-font-weight: 500;\n\n /* Rhythm */\n --a2ui-spacing-xs: 4px;\n --a2ui-spacing-s: 8px;\n --a2ui-spacing-m: 12px;\n --a2ui-spacing-l: 18px;\n --a2ui-column-gap: 12px;\n --a2ui-row-gap: 10px;\n --a2ui-list-gap: 12px;\n --a2ui-list-padding: 0;\n\n font-family: var(--sans);\n color: var(--ink);\n }\n\n /*\n * Mono for labels only (design.md \u00A73.2). The renderer has no token for label\n * *family*, only size and weight, so the eyebrow treatment is applied to the\n * label elements directly. Scoped to .a2ui-scope so it cannot leak.\n */\n .a2ui-scope a2ui-surface::part(label),\n .a2ui-scope label {\n font-family: var(--mono);\n letter-spacing: .14em;\n text-transform: uppercase;\n color: var(--ink-3);\n }\n";
|
|
19
|
+
/** Signal Blue — the one theme value A2UI itself carries on createSurface. */
|
|
20
|
+
export declare const NXIS_PRIMARY = "#2563EB";
|
|
21
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/a2ui/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,cAAc,q8IAiH1B,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,YAAY,YAAY,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme tokens for A2UI surfaces.
|
|
3
|
+
*
|
|
4
|
+
* The Lit renderer styles its components entirely through `--a2ui-*` custom
|
|
5
|
+
* properties. Those inherit across shadow boundaries, so setting them on the
|
|
6
|
+
* element containing `<a2ui-surface>` restyles everything inside it without
|
|
7
|
+
* `::part()`, a forked catalog, or a patched package.
|
|
8
|
+
*
|
|
9
|
+
* Values map onto the tokens the packaged element already declares, so surfaces
|
|
10
|
+
* follow the same palette rather than carrying a second copy of it.
|
|
11
|
+
*
|
|
12
|
+
* The rules encoded here:
|
|
13
|
+
* - sans first: Manrope for the title, Inter for everything readable
|
|
14
|
+
* - mono for labels only: field labels and tags, never body copy
|
|
15
|
+
* - blue for trust and action: the primary button and focus ring
|
|
16
|
+
* - light by default
|
|
17
|
+
*/
|
|
18
|
+
export const A2UI_THEME_CSS = `
|
|
19
|
+
.a2ui-scope {
|
|
20
|
+
/* Core roles */
|
|
21
|
+
--a2ui-color-primary: var(--blue);
|
|
22
|
+
--a2ui-color-primary-hover: var(--blue-strong);
|
|
23
|
+
--a2ui-color-primary-dark: var(--blue-strong);
|
|
24
|
+
--a2ui-color-primary-light: var(--blue-tint);
|
|
25
|
+
--a2ui-color-on-primary: #FFFFFF;
|
|
26
|
+
--a2ui-color-secondary: var(--surface);
|
|
27
|
+
--a2ui-color-secondary-hover: var(--surface-2);
|
|
28
|
+
--a2ui-color-on-secondary: var(--ink);
|
|
29
|
+
--a2ui-color-surface: var(--bg);
|
|
30
|
+
--a2ui-color-on-surface: var(--ink);
|
|
31
|
+
--a2ui-color-on-background: var(--ink);
|
|
32
|
+
--a2ui-color-border: var(--border);
|
|
33
|
+
--a2ui-color-input: var(--bg);
|
|
34
|
+
--a2ui-color-on-input: var(--ink);
|
|
35
|
+
|
|
36
|
+
/* Type — Manrope displays, Inter reads (design.md §1) */
|
|
37
|
+
--a2ui-font-family-title: var(--display);
|
|
38
|
+
--a2ui-font-size-xs: 11px; /* eyebrow / label size, matching .dc-row dt */
|
|
39
|
+
--a2ui-font-size-s: 13px;
|
|
40
|
+
--a2ui-font-size-m: 14px;
|
|
41
|
+
--a2ui-font-size-l: 18px; /* markdown ### → .dc-title size */
|
|
42
|
+
--a2ui-font-size-xl: 22px;
|
|
43
|
+
--a2ui-font-size-2xl: 31px;
|
|
44
|
+
--a2ui-line-height-body: 1.65;
|
|
45
|
+
--a2ui-line-height-headings: 1.25;
|
|
46
|
+
--a2ui-text-color-text: var(--ink);
|
|
47
|
+
--a2ui-text-caption-color: var(--ink-3); /* same muted label ink as .dc-row dt */
|
|
48
|
+
--a2ui-text-a-color: var(--blue);
|
|
49
|
+
--a2ui-text-a-font-weight: 600;
|
|
50
|
+
|
|
51
|
+
/* Radii — 14px cards, 10px buttons, 999px pills (design.md §1) */
|
|
52
|
+
--a2ui-border-radius: var(--radius-sm);
|
|
53
|
+
--a2ui-border: 1px solid var(--border);
|
|
54
|
+
--a2ui-border-width: 1px;
|
|
55
|
+
|
|
56
|
+
--a2ui-card-background: var(--bg);
|
|
57
|
+
--a2ui-card-border: 1px solid var(--border);
|
|
58
|
+
--a2ui-card-border-radius: var(--radius);
|
|
59
|
+
--a2ui-card-box-shadow: var(--shadow-sm);
|
|
60
|
+
/* 22px matches .detailcard, so an input card and a review card sitting in
|
|
61
|
+
the same thread share one rhythm rather than three inherited paddings. */
|
|
62
|
+
--a2ui-card-padding: 22px;
|
|
63
|
+
--a2ui-card-margin: 0;
|
|
64
|
+
|
|
65
|
+
/* Buttons: radius 10, weight 600, one primary per view (design.md §4) */
|
|
66
|
+
--a2ui-button-border-radius: var(--radius-sm);
|
|
67
|
+
--a2ui-button-font-weight: 600;
|
|
68
|
+
--a2ui-button-padding: 11px 20px;
|
|
69
|
+
--a2ui-button-border: 1px solid var(--border-strong);
|
|
70
|
+
--a2ui-button-background: var(--bg);
|
|
71
|
+
--a2ui-button-box-shadow: none;
|
|
72
|
+
/* Buttons sit in a Row with its own gap; a margin here would double it. */
|
|
73
|
+
--a2ui-button-margin: 0;
|
|
74
|
+
/* The label is a Text child, so the button's own colour comes from the
|
|
75
|
+
secondary text token — this is what makes a default A2UI button read as
|
|
76
|
+
.btn.ghost rather than as unstyled chrome. */
|
|
77
|
+
--a2ui-color-on-secondary: var(--ink);
|
|
78
|
+
--a2ui-color-secondary-hover: var(--surface-2);
|
|
79
|
+
|
|
80
|
+
/* Inputs */
|
|
81
|
+
--a2ui-textfield-border: 1px solid var(--border);
|
|
82
|
+
--a2ui-textfield-border-radius: var(--radius-sm);
|
|
83
|
+
--a2ui-textfield-padding: 10px 12px;
|
|
84
|
+
--a2ui-textfield-color-border-focus: var(--blue);
|
|
85
|
+
--a2ui-textfield-color-error: var(--red);
|
|
86
|
+
--a2ui-textfield-label-font-size: 11px;
|
|
87
|
+
--a2ui-textfield-label-font-weight: 500;
|
|
88
|
+
|
|
89
|
+
--a2ui-checkbox-border: 1px solid var(--border-strong);
|
|
90
|
+
--a2ui-checkbox-border-radius: 6px;
|
|
91
|
+
--a2ui-checkbox-background: var(--bg);
|
|
92
|
+
--a2ui-checkbox-color-error: var(--red);
|
|
93
|
+
--a2ui-checkbox-size: 18px;
|
|
94
|
+
--a2ui-checkbox-gap: 10px;
|
|
95
|
+
--a2ui-checkbox-label-font-size: 14px;
|
|
96
|
+
--a2ui-checkbox-label-font-weight: 400;
|
|
97
|
+
|
|
98
|
+
/* Tags render as ChoicePicker chips / caption Text — pill radius */
|
|
99
|
+
--a2ui-choicepicker-chip-border-radius: var(--radius-pill);
|
|
100
|
+
--a2ui-choicepicker-chip-padding: 6px 12px;
|
|
101
|
+
--a2ui-choicepicker-label-color: var(--ink-3);
|
|
102
|
+
--a2ui-choicepicker-label-font-size: 11px;
|
|
103
|
+
--a2ui-choicepicker-label-font-weight: 500;
|
|
104
|
+
|
|
105
|
+
/* Rhythm */
|
|
106
|
+
--a2ui-spacing-xs: 4px;
|
|
107
|
+
--a2ui-spacing-s: 8px;
|
|
108
|
+
--a2ui-spacing-m: 12px;
|
|
109
|
+
--a2ui-spacing-l: 18px;
|
|
110
|
+
--a2ui-column-gap: 12px;
|
|
111
|
+
--a2ui-row-gap: 10px;
|
|
112
|
+
--a2ui-list-gap: 12px;
|
|
113
|
+
--a2ui-list-padding: 0;
|
|
114
|
+
|
|
115
|
+
font-family: var(--sans);
|
|
116
|
+
color: var(--ink);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/*
|
|
120
|
+
* Mono for labels only (design.md §3.2). The renderer has no token for label
|
|
121
|
+
* *family*, only size and weight, so the eyebrow treatment is applied to the
|
|
122
|
+
* label elements directly. Scoped to .a2ui-scope so it cannot leak.
|
|
123
|
+
*/
|
|
124
|
+
.a2ui-scope a2ui-surface::part(label),
|
|
125
|
+
.a2ui-scope label {
|
|
126
|
+
font-family: var(--mono);
|
|
127
|
+
letter-spacing: .14em;
|
|
128
|
+
text-transform: uppercase;
|
|
129
|
+
color: var(--ink-3);
|
|
130
|
+
}
|
|
131
|
+
`;
|
|
132
|
+
/** Signal Blue — the one theme value A2UI itself carries on createSurface. */
|
|
133
|
+
export const NXIS_PRIMARY = '#2563EB';
|
|
134
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/a2ui/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiH7B,CAAC;AAEF,8EAA8E;AAC9E,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Downgrades A2UI v1.0 messages to v0.9.
|
|
3
|
+
*
|
|
4
|
+
* The emitters target v1.0, which is the documented spec and the one with
|
|
5
|
+
* published JSON Schemas, but available renderers support v0.9 and earlier, so
|
|
6
|
+
* messages are downgraded before rendering.
|
|
7
|
+
*
|
|
8
|
+
* Two mechanical differences:
|
|
9
|
+
*
|
|
10
|
+
* 1. `version` is the string "v0.9", not "v1.0".
|
|
11
|
+
* 2. v0.9's `createSurface` carries only surfaceId/catalogId: it rejects
|
|
12
|
+
* inline `components` and `dataModel` as additional properties. They have
|
|
13
|
+
* to follow as separate `updateComponents` / `updateDataModel` messages for
|
|
14
|
+
* the same surfaceId. So one v1.0 message becomes up to three.
|
|
15
|
+
*
|
|
16
|
+
* No longer needed once a v1.0 renderer is available.
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import type { A2uiMessage } from './emit.js';
|
|
21
|
+
type Msg = Record<string, any>;
|
|
22
|
+
/**
|
|
23
|
+
* Downgrade v1.0 messages to v0.9.
|
|
24
|
+
*
|
|
25
|
+
* @param messages - The messages as authored by the emitters.
|
|
26
|
+
* @returns The equivalent v0.9 messages, which may be more numerous because a
|
|
27
|
+
* v1.0 surface creation splits into separate component and data updates.
|
|
28
|
+
*/
|
|
29
|
+
export declare function toV09(messages: A2uiMessage[]): Msg[];
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=to-v09.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-v09.d.ts","sourceRoot":"","sources":["../../src/a2ui/to-v09.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG7C,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AA0C/B;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,GAAG,EAAE,CA6CpD"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Downgrades A2UI v1.0 messages to v0.9.
|
|
3
|
+
*
|
|
4
|
+
* The emitters target v1.0, which is the documented spec and the one with
|
|
5
|
+
* published JSON Schemas, but available renderers support v0.9 and earlier, so
|
|
6
|
+
* messages are downgraded before rendering.
|
|
7
|
+
*
|
|
8
|
+
* Two mechanical differences:
|
|
9
|
+
*
|
|
10
|
+
* 1. `version` is the string "v0.9", not "v1.0".
|
|
11
|
+
* 2. v0.9's `createSurface` carries only surfaceId/catalogId: it rejects
|
|
12
|
+
* inline `components` and `dataModel` as additional properties. They have
|
|
13
|
+
* to follow as separate `updateComponents` / `updateDataModel` messages for
|
|
14
|
+
* the same surfaceId. So one v1.0 message becomes up to three.
|
|
15
|
+
*
|
|
16
|
+
* No longer needed once a v1.0 renderer is available.
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import { NXIS_PRIMARY } from './theme.js';
|
|
21
|
+
/**
|
|
22
|
+
* The catalog is versioned alongside the protocol, and the renderer looks it up
|
|
23
|
+
* by exact id, so a v1.0 id against a v0.9 catalog registry throws
|
|
24
|
+
* "Catalog not found" rather than falling back.
|
|
25
|
+
*/
|
|
26
|
+
const CATALOG_V1 = 'https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json';
|
|
27
|
+
const CATALOG_V09 = 'https://a2ui.org/specification/v0_9/catalogs/basic/catalog.json';
|
|
28
|
+
const downgradeCatalog = (id) => id === CATALOG_V1 ? CATALOG_V09 : id;
|
|
29
|
+
/**
|
|
30
|
+
* v1.0 interpolates with `${expr}` inside a string. v0.9 has no interpolation
|
|
31
|
+
* at all: a dynamic value is a DataBinding object, `{ path }`. A `${title}`
|
|
32
|
+
* left as-is is not an error: it renders as the literal characters, which is
|
|
33
|
+
* how it first showed up on the verification page.
|
|
34
|
+
*
|
|
35
|
+
* Only a string that is *entirely* one expression can convert. "Hi ${name}"
|
|
36
|
+
* has no v0.9 equivalent, so it is left alone and will render literally; the
|
|
37
|
+
* emitters avoid mixed interpolation for that reason.
|
|
38
|
+
*/
|
|
39
|
+
const INTERPOLATION = /^\$\{([^}]+)\}$/;
|
|
40
|
+
function bindStrings(value) {
|
|
41
|
+
if (typeof value === 'string') {
|
|
42
|
+
const m = INTERPOLATION.exec(value);
|
|
43
|
+
return m ? { path: m[1] } : value;
|
|
44
|
+
}
|
|
45
|
+
if (Array.isArray(value))
|
|
46
|
+
return value.map(bindStrings);
|
|
47
|
+
if (value && typeof value === 'object') {
|
|
48
|
+
const out = {};
|
|
49
|
+
for (const [k, v] of Object.entries(value)) {
|
|
50
|
+
// Identity and structure keys are never data-bound.
|
|
51
|
+
out[k] = k === 'id' || k === 'component' || k === 'componentId' ? v : bindStrings(v);
|
|
52
|
+
}
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Downgrade v1.0 messages to v0.9.
|
|
59
|
+
*
|
|
60
|
+
* @param messages - The messages as authored by the emitters.
|
|
61
|
+
* @returns The equivalent v0.9 messages, which may be more numerous because a
|
|
62
|
+
* v1.0 surface creation splits into separate component and data updates.
|
|
63
|
+
*/
|
|
64
|
+
export function toV09(messages) {
|
|
65
|
+
const out = [];
|
|
66
|
+
for (const msg of messages) {
|
|
67
|
+
if (msg.createSurface) {
|
|
68
|
+
const { surfaceId, catalogId, components, dataModel } = msg.createSurface;
|
|
69
|
+
// `theme` exists in v0.9 and was dropped in v1.0, so it is set here
|
|
70
|
+
// rather than in the emitters, which must stay v1.0-valid. The CSS
|
|
71
|
+
// custom properties do the real styling; this carries the accent for any
|
|
72
|
+
// renderer that never sees our stylesheet.
|
|
73
|
+
out.push({
|
|
74
|
+
version: 'v0.9',
|
|
75
|
+
createSurface: {
|
|
76
|
+
surfaceId,
|
|
77
|
+
catalogId: downgradeCatalog(catalogId),
|
|
78
|
+
theme: { primaryColor: NXIS_PRIMARY },
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
if (components) {
|
|
82
|
+
out.push({ version: 'v0.9', updateComponents: { surfaceId, components: bindStrings(components) } });
|
|
83
|
+
}
|
|
84
|
+
// v0.9 patches one path at a time, so a whole-model seed becomes one
|
|
85
|
+
// message per top-level key rather than a single root write. The payload
|
|
86
|
+
// key is `value` and the object is additionalProperties:false, so a
|
|
87
|
+
// wrong name here is rejected outright rather than ignored.
|
|
88
|
+
if (dataModel) {
|
|
89
|
+
for (const [key, value] of Object.entries(dataModel)) {
|
|
90
|
+
out.push({ version: 'v0.9', updateDataModel: { surfaceId, path: `/${key}`, value } });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (msg.updateDataModel) {
|
|
96
|
+
const { surfaceId, path, value } = msg.updateDataModel;
|
|
97
|
+
out.push({ version: 'v0.9', updateDataModel: { surfaceId, path, value } });
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
out.push({ ...msg, version: 'v0.9' });
|
|
101
|
+
}
|
|
102
|
+
return out;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=to-v09.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-v09.js","sourceRoot":"","sources":["../../src/a2ui/to-v09.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI1C;;;;GAIG;AACH,MAAM,UAAU,GAAG,iEAAiE,CAAC;AACrF,MAAM,WAAW,GAAG,iEAAiE,CAAC;AAEtF,MAAM,gBAAgB,GAAG,CAAC,EAAsB,EAAsB,EAAE,CACtE,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;AAEvC;;;;;;;;;GASG;AACH,MAAM,aAAa,GAAG,iBAAiB,CAAC;AAExC,SAAS,WAAW,CAAC,KAAc;IACjC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpC,OAAO,CAAC,CAAC,CAAC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E,CAAC;gBACf,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC;YACtG,CAAC;YACD,qEAAqE;YACrE,yEAAyE;YACzE,oEAAoE;YACpE,4DAA4D;YAC5D,IAAI,SAAS,EAAE,CAAC;gBACd,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;oBACrD,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;gBACxF,CAAC;YACH,CAAC;YACD,SAAS;QACX,CAAC;QAED,IAAI,GAAG,CAAC,eAAe,EAAE,CAAC;YACxB,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,eAAe,CAAC;YACvD,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;YAC3E,SAAS;QACX,CAAC;QAED,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/engine.d.ts
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bundled model provider, plus the shared constants and helpers the UI
|
|
3
|
+
* layer draws on.
|
|
4
|
+
*
|
|
5
|
+
* {@link LocalGemmaProvider} runs Gemma 4 (E2B) in the browser through
|
|
6
|
+
* Transformers.js on WebGPU. The runtime is fetched from a CDN at first use
|
|
7
|
+
* rather than bundled, so installing this package does not pull in a model
|
|
8
|
+
* runtime, and the weights are cached by the browser after the first load.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import type { ChatMessage, GenerationUsage, ModelContextToolInfo, ParsedToolCall, PreloadMode, ProgressDetail, ToolDef } from './types.js';
|
|
13
|
+
import type { Completion, CompletionRequest, ModelProvider } from './providers/types.js';
|
|
14
|
+
export type { ChatMessage, GenerationUsage, ParsedToolCall, PreloadMode, ProgressDetail, ToolDef, };
|
|
15
|
+
export declare const TRANSFORMERS_CDN = "https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.2.0";
|
|
16
|
+
/** The Hugging Face repository the weights are loaded from. */
|
|
17
|
+
export declare const MODEL_ID = "onnx-community/gemma-4-E2B-it-ONNX";
|
|
18
|
+
/** Origin to load weights from. Empty serves them from the Hugging Face Hub. */
|
|
19
|
+
export declare const MODEL_HOST = "";
|
|
20
|
+
/** Path template applied under {@link MODEL_HOST}. `{model}` is substituted. */
|
|
21
|
+
export declare const MODEL_PATH_TEMPLATE = "{model}/";
|
|
22
|
+
/** Generations allowed per goal. One is enough unless the model must retry. */
|
|
23
|
+
export declare const MAX_STEPS = 3;
|
|
24
|
+
/** Default token ceiling for one generation. */
|
|
25
|
+
export declare const MAX_NEW_TOKENS = 512;
|
|
26
|
+
/** How long {@link WebMcpTools.waitForTools} waits for tools to register. */
|
|
27
|
+
export declare const TOOLS_TIMEOUT_MS = 20000;
|
|
28
|
+
/**
|
|
29
|
+
* The default instructions, used when no `systemPrompt` is supplied.
|
|
30
|
+
*
|
|
31
|
+
* Directs the model to call a tool as soon as it knows which one applies, with
|
|
32
|
+
* whatever fields it has, because the harness collects the rest.
|
|
33
|
+
*/
|
|
34
|
+
export declare const SYSTEM_PROMPT: string;
|
|
35
|
+
/** Where the attribution badge points. */
|
|
36
|
+
export declare const NXIS_SITE_URL = "https://nxis.ai";
|
|
37
|
+
export declare const NXIS_LOGO_SVG = "<svg viewBox=\"0 0 39.6 30.4\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <defs>\n <radialGradient id=\"nx-g1\" cx=\"20.65\" cy=\"-40.83\" fx=\"20.65\" fy=\"-40.83\" r=\"14.12\" gradientTransform=\"translate(0 -25.62) scale(1 -1)\" gradientUnits=\"userSpaceOnUse\">\n <stop offset=\"0\" stop-color=\"#3f9cf8\"/><stop offset=\".22\" stop-color=\"#3891f6\"/><stop offset=\".59\" stop-color=\"#2675f3\"/><stop offset=\".79\" stop-color=\"#1c64f2\"/>\n </radialGradient>\n <radialGradient id=\"nx-g2\" cx=\"8.54\" cy=\"485.55\" fx=\"8.54\" fy=\"485.55\" r=\"11.08\" gradientTransform=\"translate(0 -294)\" href=\"#nx-g1\"/>\n <radialGradient id=\"nx-g3\" cx=\"31.03\" cy=\"479.6\" fx=\"31.03\" fy=\"479.6\" r=\"10.02\" gradientTransform=\"translate(0 -294)\" href=\"#nx-g1\"/>\n </defs>\n <path fill=\"url(#nx-g1)\" d=\"M33.65.1c-1,1.7-1.9,3.2-2.7,4.7-4.8,8.3-9.6,16.6-14.4,24.9-.3.5-.5.6-1.1.6h-7.8c.2-.2.2-.4.3-.6C13.55,20,19.15,10.3,24.75.6c.2-.4.5-.6,1-.6h7.1c.3.1.4.1.8.1h0Z\"/>\n <path fill=\"url(#nx-g2)\" d=\"M17.15.1c-1.2,2.1-2.3,4-3.5,6-1.7,2.9-3.3,5.8-5,8.6-.2.4-.3.7,0,1.2.6.9,1.1,1.8,1.6,2.7.1.2.2.5.1.6-1.3,2.3-2.7,4.7-4.1,7.1-.2-.3-.3-.4-.4-.6-1.9-3.3-3.8-6.6-5.7-9.8-.2-.4-.2-.7,0-1.1C2.85,10.1,5.55,5.4,8.25.7c.3-.4.6-.6,1.1-.6C11.85.1,14.45,0,17.15.1h0Z\"/>\n <path fill=\"url(#nx-g3)\" d=\"M22.45,30.3c4.4-7.6,8.7-15,13-22.5.1.2.2.3.3.5,1.2,2.1,2.4,4.2,3.7,6.3.2.4.2.7,0,1-2.7,4.7-5.5,9.4-8.2,14.2-.2.4-.5.6-1,.6-2.5-.1-5.1,0-7.8-.1h0Z\"/>\n</svg>";
|
|
38
|
+
/** Heroicon `check-circle`, for a success state. */
|
|
39
|
+
export declare const ICON_CHECK = "<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z\"/></svg>";
|
|
40
|
+
/** Heroicon `exclamation-triangle`, for an error state. */
|
|
41
|
+
export declare const ICON_WARN = "<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z\"/></svg>";
|
|
42
|
+
/** Heroicon `arrow-long-right`, for send and submit controls. */
|
|
43
|
+
export declare const ICON_ARROW = "<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"currentColor\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3\"/></svg>";
|
|
44
|
+
/** Heroicon `cog-6-tooth`, for settings. */
|
|
45
|
+
export declare const ICON_GEAR = "<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.24-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281Z\"/><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z\"/></svg>";
|
|
46
|
+
/** Heroicon `plus`, for a new conversation. */
|
|
47
|
+
export declare const ICON_PLUS = "<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"currentColor\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 4.5v15m7.5-7.5h-15\"/></svg>";
|
|
48
|
+
/** Heroicon `bars-3`, for the conversation drawer. */
|
|
49
|
+
export declare const ICON_MENU = "<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.8\" stroke=\"currentColor\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M3.75 6.75h16.5M3.75 12h16.5M3.75 17.25h16.5\"/></svg>";
|
|
50
|
+
/** Heroicon `stop`, shown on the send button while a turn can be stopped. */
|
|
51
|
+
export declare const ICON_STOP = "<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.8\" stroke=\"currentColor\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M5.25 7.5A2.25 2.25 0 0 1 7.5 5.25h9a2.25 2.25 0 0 1 2.25 2.25v9a2.25 2.25 0 0 1-2.25 2.25h-9a2.25 2.25 0 0 1-2.25-2.25v-9Z\"/></svg>";
|
|
52
|
+
/** Heroicon `clipboard-document`, for copying a message. */
|
|
53
|
+
export declare const ICON_COPY = "<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M15.666 3.888A2.25 2.25 0 0 0 13.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 0 1-.75.75H9a.75.75 0 0 1-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 0 1-2.25 2.25H6.75A2.25 2.25 0 0 1 4.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 0 1 1.927-.184\"/></svg>";
|
|
54
|
+
/** Heroicon `pencil-square`, for editing a message. */
|
|
55
|
+
export declare const ICON_PENCIL = "<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.862 4.487l1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10\"/></svg>";
|
|
56
|
+
/** Heroicon `arrow-path`, for sending a message again. */
|
|
57
|
+
export declare const ICON_REDO = "<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99\"/></svg>";
|
|
58
|
+
/** Heroicon `check`, the confirmation shown after a copy. */
|
|
59
|
+
export declare const ICON_CHECK_MARK = "<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"currentColor\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"/></svg>";
|
|
60
|
+
/** Heroicon `trash`, for deleting a conversation. */
|
|
61
|
+
export declare const ICON_TRASH = "<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" aria-hidden=\"true\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0\"/></svg>";
|
|
62
|
+
export declare function humanize(s: unknown): string;
|
|
63
|
+
/** Lower-case the first character, for a name used mid-sentence. */
|
|
64
|
+
export declare function lcFirst(s: string): string;
|
|
65
|
+
/** Escape `&`, `<`, `>` and `"` for interpolation into markup. */
|
|
66
|
+
export declare function escapeHtml(s: unknown): string;
|
|
67
|
+
/** Extract a tool call from model output, or null for a plain answer. */
|
|
68
|
+
export declare function parseToolCall(text: string): ParsedToolCall | null;
|
|
69
|
+
/** Strip tool-call blocks and special tokens for human-readable display. */
|
|
70
|
+
export declare function stripMarkers(text: string): string;
|
|
71
|
+
/** Options for {@link LocalGemmaProvider}. */
|
|
72
|
+
export interface AgentEngineOptions {
|
|
73
|
+
modelHost?: string;
|
|
74
|
+
modelPathTemplate?: string;
|
|
75
|
+
/** Override the generic form-filling SYSTEM_PROMPT (e.g. a domain skill). */
|
|
76
|
+
systemPrompt?: string;
|
|
77
|
+
onStatus?: (text: string, isError?: boolean) => void;
|
|
78
|
+
onProgress?: (pct: number, detail?: ProgressDetail) => void;
|
|
79
|
+
/**
|
|
80
|
+
* Whether Transformers.js may keep model files in Cache Storage.
|
|
81
|
+
*
|
|
82
|
+
* Defaults to true, which is the difference between downloading the weights
|
|
83
|
+
* once and on every visit. Set false only where the cache itself is failing.
|
|
84
|
+
*/
|
|
85
|
+
useBrowserCache?: boolean;
|
|
86
|
+
}
|
|
87
|
+
interface LoadedEngine {
|
|
88
|
+
tokenizer: any;
|
|
89
|
+
model: any;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The default provider: Gemma 4 (E2B) running on WebGPU in the browser.
|
|
93
|
+
*
|
|
94
|
+
* Owns everything model-specific, including fetching Transformers.js and the
|
|
95
|
+
* weights, applying the chat template, and parsing Gemma's tool-call markers,
|
|
96
|
+
* so that the harness sees only text and structured calls.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* const provider = new LocalGemmaProvider({ useBrowserCache: true });
|
|
101
|
+
* const harness = new AgentHarness({ renderer, provider });
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export declare class LocalGemmaProvider implements ModelProvider {
|
|
105
|
+
readonly name = "gemma-4-e2b";
|
|
106
|
+
readonly local = true;
|
|
107
|
+
modelHost: string;
|
|
108
|
+
modelPathTemplate: string;
|
|
109
|
+
systemPrompt: string;
|
|
110
|
+
onStatus: (text: string, isError?: boolean) => void;
|
|
111
|
+
onProgress: (pct: number, detail?: ProgressDetail) => void;
|
|
112
|
+
useBrowserCache: boolean;
|
|
113
|
+
/** True when this load dropped the cache because the last one never returned. */
|
|
114
|
+
cacheDisabledAfterCrash: boolean;
|
|
115
|
+
engine: LoadedEngine | null;
|
|
116
|
+
T: any;
|
|
117
|
+
private _enginePromise;
|
|
118
|
+
private _progress;
|
|
119
|
+
constructor(opts?: AgentEngineOptions);
|
|
120
|
+
/**
|
|
121
|
+
* Whether the weights are loaded and usable right now.
|
|
122
|
+
*
|
|
123
|
+
* Side-effect free: reading it does not start a load. Use it to distinguish a
|
|
124
|
+
* first visit, where a load takes tens of seconds, from a warm one.
|
|
125
|
+
*/
|
|
126
|
+
get ready(): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Whether a load is in flight.
|
|
129
|
+
*
|
|
130
|
+
* Distinct from {@link LocalGemmaProvider.ready}: both false means nothing
|
|
131
|
+
* has been requested yet, while `loading` alone means a download is running.
|
|
132
|
+
*/
|
|
133
|
+
get loading(): boolean;
|
|
134
|
+
private _status;
|
|
135
|
+
/**
|
|
136
|
+
* Begin downloading the weights in the background.
|
|
137
|
+
*
|
|
138
|
+
* @param mode - `'idle'` waits for the browser to be free, keeping the
|
|
139
|
+
* download off the critical path of the host page. `'eager'` starts at once,
|
|
140
|
+
* which spends hundreds of megabytes of a visitor's bandwidth before they
|
|
141
|
+
* have asked for anything, and suits only pages where the agent is the point.
|
|
142
|
+
*/
|
|
143
|
+
schedulePreload(mode?: Exclude<PreloadMode, 'none'>): void;
|
|
144
|
+
/** Single shared promise so preload + open + send never double-download. */
|
|
145
|
+
ensureEngine(): Promise<LoadedEngine>;
|
|
146
|
+
private _loadEngine;
|
|
147
|
+
private _warmup;
|
|
148
|
+
private _trackProgress;
|
|
149
|
+
/** How many loads have started and not come back. Survives the tab dying. */
|
|
150
|
+
private _readGuard;
|
|
151
|
+
private _writeGuard;
|
|
152
|
+
/**
|
|
153
|
+
* Begin measuring a new load stage from zero.
|
|
154
|
+
*
|
|
155
|
+
* Stages are measured separately because they differ by orders of magnitude
|
|
156
|
+
* in size and the label names one at a time. Pooling them would report the
|
|
157
|
+
* tokenizer's completion as progress on the weights.
|
|
158
|
+
*/
|
|
159
|
+
private _resetProgress;
|
|
160
|
+
/**
|
|
161
|
+
* Generate one completion.
|
|
162
|
+
*
|
|
163
|
+
* Gemma expresses tool calls as markers within its output, so they are parsed
|
|
164
|
+
* here and reported as {@link Completion.call}, leaving the harness with text
|
|
165
|
+
* it can render directly.
|
|
166
|
+
*
|
|
167
|
+
* @param req - The conversation, tools, abort signal and token callback.
|
|
168
|
+
* @returns The generated text with markers stripped, and the tool call it
|
|
169
|
+
* contained, if any.
|
|
170
|
+
*/
|
|
171
|
+
complete(req: CompletionRequest): Promise<Completion>;
|
|
172
|
+
/** Satisfies `ModelProvider.load`; the work is in ensureEngine. */
|
|
173
|
+
load(): Promise<void>;
|
|
174
|
+
/** Satisfies `ModelProvider.preload`. */
|
|
175
|
+
preload(mode?: Exclude<PreloadMode, 'none'>): void;
|
|
176
|
+
buildToolDefs(tools: ModelContextToolInfo[]): ToolDef[];
|
|
177
|
+
/** Token count of arbitrary text via the loaded tokenizer (0 if unavailable). */
|
|
178
|
+
countTokens(text: string): Promise<number>;
|
|
179
|
+
/**
|
|
180
|
+
* Run one generation.
|
|
181
|
+
*
|
|
182
|
+
* @param messages - The conversation, including the system prompt.
|
|
183
|
+
* @param toolDefs - Tool definitions in the form the chat template expects.
|
|
184
|
+
* @param options - Streaming, usage reporting, token cap and abort signal.
|
|
185
|
+
* @returns The generated text, with protocol markers stripped.
|
|
186
|
+
* @throws `AbortError` if the signal is already aborted when called.
|
|
187
|
+
*/
|
|
188
|
+
generate(messages: ChatMessage[], toolDefs: ToolDef[], { onToken, onUsage, maxNewTokens, signal, }?: {
|
|
189
|
+
onToken?: (text: string) => void;
|
|
190
|
+
onUsage?: (usage: GenerationUsage) => void;
|
|
191
|
+
/**
|
|
192
|
+
* Token ceiling, for generations that are not answers.
|
|
193
|
+
*
|
|
194
|
+
* Defaults to {@link MAX_NEW_TOKENS}. Lower it for short outputs such as
|
|
195
|
+
* a routing decision, which would otherwise run to the full answer budget.
|
|
196
|
+
*/
|
|
197
|
+
maxNewTokens?: number;
|
|
198
|
+
/** Aborts the generation, which stops at the next token. */
|
|
199
|
+
signal?: AbortSignal;
|
|
200
|
+
}): Promise<string>;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* @deprecated Use {@link LocalGemmaProvider}. The harness takes a
|
|
204
|
+
* {@link ModelProvider}, of which this is one implementation.
|
|
205
|
+
*/
|
|
206
|
+
export declare const AgentEngine: typeof LocalGemmaProvider;
|
|
207
|
+
/** @deprecated Use {@link LocalGemmaProvider}. */
|
|
208
|
+
export type AgentEngine = LocalGemmaProvider;
|
|
209
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"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