@signhify/web 0.0.0-stage → 0.3.2
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 +11 -2
- package/dist/__tests__/terminal-preview.test.d.ts +2 -0
- package/dist/__tests__/terminal-preview.test.d.ts.map +1 -0
- package/dist/__tests__/terminal-preview.test.js +38 -0
- package/dist/__tests__/terminal-preview.test.js.map +1 -0
- package/dist/components/InstallCommandBar.d.ts +4 -0
- package/dist/components/InstallCommandBar.d.ts.map +1 -0
- package/dist/components/InstallCommandBar.js +11 -0
- package/dist/components/InstallCommandBar.js.map +1 -0
- package/dist/components/TerminalPreview.d.ts +14 -0
- package/dist/components/TerminalPreview.d.ts.map +1 -0
- package/dist/components/TerminalPreview.js +45 -0
- package/dist/components/TerminalPreview.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/package.json +35 -4
package/README.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @signhify/web
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Web components and UI primitives for Signhify documentation and landing experiences.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **TerminalPreview**: Interactive terminal simulator demonstrating agent workflows and streaming execution in web browsers.
|
|
8
|
+
- **InstallCommandBar**: One-click install snippet copy bar supporting npm, Homebrew, curl, and PowerShell commands.
|
|
9
|
+
|
|
10
|
+
## License
|
|
11
|
+
|
|
12
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-preview.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/terminal-preview.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { generateTerminalPreviewMarkup, MOCK_SESSION_FIXTURE } from '../components/TerminalPreview.js';
|
|
3
|
+
// The fixture is a real transcript captured from the mock provider:
|
|
4
|
+
// SIGNHIFY_MOCK_PROVIDER=1 node packages/cli/dist/index.js \
|
|
5
|
+
// run "Does <script>& x>y pipeline work?" --output json
|
|
6
|
+
const fixture = MOCK_SESSION_FIXTURE;
|
|
7
|
+
describe('generateTerminalPreviewMarkup', () => {
|
|
8
|
+
it('renders every fixture transcript line', () => {
|
|
9
|
+
const markup = generateTerminalPreviewMarkup({ transcript: fixture });
|
|
10
|
+
// Fixture content is escaped in output, so compare against the escaped form.
|
|
11
|
+
const escape = (value) => value.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>');
|
|
12
|
+
for (const line of fixture) {
|
|
13
|
+
expect(markup).toContain(escape(line.content));
|
|
14
|
+
}
|
|
15
|
+
expect(markup).toContain('data-role="user"');
|
|
16
|
+
expect(markup).toContain('data-role="assistant"');
|
|
17
|
+
});
|
|
18
|
+
it('escapes <, >, & in transcript content (no injection)', () => {
|
|
19
|
+
const markup = generateTerminalPreviewMarkup({ transcript: fixture });
|
|
20
|
+
// Hostile chars from the real prompt must be escaped, not raw.
|
|
21
|
+
expect(markup).not.toContain('<script>');
|
|
22
|
+
expect(markup).toContain('<script>');
|
|
23
|
+
expect(markup).toContain('&');
|
|
24
|
+
expect(markup).toContain('>');
|
|
25
|
+
});
|
|
26
|
+
it('bar content rides on trusted props, not transcript input', () => {
|
|
27
|
+
const markup = generateTerminalPreviewMarkup({
|
|
28
|
+
mode: 'plan',
|
|
29
|
+
activeRouter: 'groq-cloud (fallback)',
|
|
30
|
+
contextUsagePct: 41,
|
|
31
|
+
transcript: [],
|
|
32
|
+
});
|
|
33
|
+
expect(markup).toContain('PLAN');
|
|
34
|
+
expect(markup).toContain('groq-cloud (fallback)');
|
|
35
|
+
expect(markup).toContain('Context: 41%');
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=terminal-preview.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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AC,CAAC;QACzC,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QAC3C,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAClC,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAClE,MAAM,MAAM,GAAG,6BAA6B,CAAC;YAC3C,IAAI,EAAE,MAAM;YACZ,YAAY,EAAE,uBAAuB;YACrC,eAAe,EAAE,EAAE;YACnB,UAAU,EAAE,EAAE;SACf,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACjC,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;QAClD,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InstallCommandBar.d.ts","sourceRoot":"","sources":["../../src/components/InstallCommandBar.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;AAE5E,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAM3D,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,cAAc,GAAG,MAAM,CAE5D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const INSTALL_COMMANDS = {
|
|
2
|
+
curl: 'curl -fsSL https://signhify-cli.vercel.app/install.sh | bash',
|
|
3
|
+
powershell: 'irm https://signhify-cli.vercel.app/install.ps1 | iex',
|
|
4
|
+
npm: 'npm install -g @signhify/cli',
|
|
5
|
+
pnpm: 'pnpm add -g @signhify/cli',
|
|
6
|
+
bun: 'bun add -g @signhify/cli',
|
|
7
|
+
};
|
|
8
|
+
export function getInstallCommand(pm) {
|
|
9
|
+
return INSTALL_COMMANDS[pm] || INSTALL_COMMANDS.curl;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=InstallCommandBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InstallCommandBar.js","sourceRoot":"","sources":["../../src/components/InstallCommandBar.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAmC;IAC9D,IAAI,EAAE,8DAA8D;IACpE,UAAU,EAAE,uDAAuD;IACnE,GAAG,EAAE,8BAA8B;IACnC,IAAI,EAAE,2BAA2B;IACjC,GAAG,EAAE,0BAA0B;CAChC,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAAC,EAAkB;IAClD,OAAO,gBAAgB,CAAC,EAAE,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface TerminalTranscriptLine {
|
|
2
|
+
role: 'user' | 'assistant' | 'system';
|
|
3
|
+
content: string;
|
|
4
|
+
}
|
|
5
|
+
export interface TerminalPreviewProps {
|
|
6
|
+
title?: string;
|
|
7
|
+
mode?: 'build' | 'plan';
|
|
8
|
+
activeRouter?: string;
|
|
9
|
+
contextUsagePct?: number;
|
|
10
|
+
transcript?: TerminalTranscriptLine[];
|
|
11
|
+
}
|
|
12
|
+
export declare const MOCK_SESSION_FIXTURE: TerminalTranscriptLine[];
|
|
13
|
+
export declare function generateTerminalPreviewMarkup(props?: TerminalPreviewProps): string;
|
|
14
|
+
//# sourceMappingURL=TerminalPreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TerminalPreview.d.ts","sourceRoot":"","sources":["../../src/components/TerminalPreview.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,sBAAsB,EAAE,CAAC;CACvC;AASD,eAAO,MAAM,oBAAoB,EAAE,sBAAsB,EAGxD,CAAC;AAYF,wBAAgB,6BAA6B,CAAC,KAAK,CAAC,EAAE,oBAAoB,GAAG,MAAM,CAyBlF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Fixture transcript from a real capture:
|
|
2
|
+
// SIGNHIFY_MOCK_PROVIDER=1 node packages/cli/dist/index.js \
|
|
3
|
+
// run "Does <script>& x>y pipeline work?" --output json
|
|
4
|
+
// The user line is the CLI-reported task; the assistant line is the mock
|
|
5
|
+
// adapter's fixed response (packages/providers/src/adapter.ts). The hostile
|
|
6
|
+
// characters come straight from the user prompt, which is why the escaping
|
|
7
|
+
// below is testable against real input rather than a synthetic string.
|
|
8
|
+
export const MOCK_SESSION_FIXTURE = [
|
|
9
|
+
{ role: 'user', content: 'Does <script>& x>y pipeline work?' },
|
|
10
|
+
{ role: 'assistant', content: 'Task completed successfully by mock provider.' },
|
|
11
|
+
];
|
|
12
|
+
// Attribute context only — never interpolates raw content into tags.
|
|
13
|
+
function escapeHtml(value) {
|
|
14
|
+
return value
|
|
15
|
+
.replaceAll('&', '&') // ampersand first so entities survive
|
|
16
|
+
.replaceAll('<', '<')
|
|
17
|
+
.replaceAll('>', '>')
|
|
18
|
+
.replaceAll('"', '"')
|
|
19
|
+
.replaceAll("'", ''');
|
|
20
|
+
}
|
|
21
|
+
export function generateTerminalPreviewMarkup(props) {
|
|
22
|
+
const mode = props?.mode ?? 'build';
|
|
23
|
+
const router = props?.activeRouter ?? '9router (port 20128)';
|
|
24
|
+
const usage = props?.contextUsagePct ?? 62;
|
|
25
|
+
const transcript = props?.transcript ?? [];
|
|
26
|
+
const transcriptMarkup = transcript
|
|
27
|
+
.map((line) => {
|
|
28
|
+
const attrs = `data-role="${escapeHtml(line.role)}"`;
|
|
29
|
+
return ` <div class="tp-line" ${attrs}>${escapeHtml(line.content)}</div>`;
|
|
30
|
+
})
|
|
31
|
+
.join('\n');
|
|
32
|
+
return `
|
|
33
|
+
<div class="terminal-preview" data-mode="${mode}" data-router="${router}">
|
|
34
|
+
<div class="terminal-bar">
|
|
35
|
+
<span class="badge ${mode}">${mode.toUpperCase()}</span>
|
|
36
|
+
<span class="router-info">${router}</span>
|
|
37
|
+
<span class="context-meter">Context: ${usage}%</span>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="terminal-transcript">
|
|
40
|
+
${transcriptMarkup}
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
`.trim();
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=TerminalPreview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TerminalPreview.js","sourceRoot":"","sources":["../../src/components/TerminalPreview.ts"],"names":[],"mappings":"AAaA,0CAA0C;AAC1C,+DAA+D;AAC/D,4DAA4D;AAC5D,yEAAyE;AACzE,4EAA4E;AAC5E,2EAA2E;AAC3E,uEAAuE;AACvE,MAAM,CAAC,MAAM,oBAAoB,GAA6B;IAC5D,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,mCAAmC,EAAE;IAC9D,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,+CAA+C,EAAE;CAChF,CAAC;AAEF,qEAAqE;AACrE,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,KAAK;SACT,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAE,sCAAsC;SAChE,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@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,6BAA6B,GAC9B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAEL,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,mCAAmC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signhify/web",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.3.2",
|
|
4
|
+
"description": "Signhify Web Platform and UI preview components",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc -b",
|
|
20
|
+
"dev": "tsc -b --watch",
|
|
21
|
+
"test": "vitest run",
|
|
22
|
+
"typecheck": "tsc --noEmit",
|
|
23
|
+
"clean": "node -e \"const {rmSync,existsSync}=require('fs');['dist','*.tsbuildinfo'].forEach(p=>{if(existsSync(p))rmSync(p,{recursive:true,force:true})})\""
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@signhify/core": "^0.3.2",
|
|
27
|
+
"@signhify/providers": "^0.3.2"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^20.11.0",
|
|
31
|
+
"typescript": "^5.5.0",
|
|
32
|
+
"vitest": "^2.0.0"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
}
|
|
37
|
+
}
|