@agentuity/workbench 0.0.54

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.
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file is the entry point for the Workbench app, it sets up the root
3
+ * element and renders the Workbench component to the DOM.
4
+ *
5
+ * It is included in `src/app/index.html`.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=workbench.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workbench.d.ts","sourceRoot":"","sources":["../../src/app/workbench.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * This file is the entry point for the Workbench app, it sets up the root
4
+ * element and renders the Workbench component to the DOM.
5
+ *
6
+ * It is included in `src/app/index.html`.
7
+ */
8
+ import { StrictMode } from 'react';
9
+ import { createRoot } from 'react-dom/client';
10
+ import { AgentuityContext } from '@agentuity/react';
11
+ import { Workbench } from '../components';
12
+ import { getWorkbenchConfig } from '@agentuity/core';
13
+ // Get workbench config from environment variable (set during build)
14
+ const workbenchConfig = getWorkbenchConfig();
15
+ const workbenchInstance = { config: workbenchConfig };
16
+ // Use the port from config to set the base URL
17
+ const baseUrl = `http://localhost:${workbenchConfig.port}`;
18
+ const elem = document.getElementById('workbench-root');
19
+ if (!elem) {
20
+ console.error('workbench-root element not found');
21
+ throw new Error('Failed to mount workbench: root element not found');
22
+ }
23
+ const app = (_jsx(StrictMode, { children: _jsxs(AgentuityContext.Provider, { value: { baseUrl }, children: [baseUrl, _jsx(Workbench, { workbench: workbenchInstance })] }) }));
24
+ // Simple rendering without hot module reloading for compatibility
25
+ createRoot(elem).render(app);
26
+ //# sourceMappingURL=workbench.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workbench.js","sourceRoot":"","sources":["../../src/app/workbench.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,oEAAoE;AACpE,MAAM,eAAe,GAAG,kBAAkB,EAAE,CAAC;AAC7C,MAAM,iBAAiB,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;AAEtD,+CAA+C;AAC/C,MAAM,OAAO,GAAG,oBAAoB,eAAe,CAAC,IAAI,EAAE,CAAC;AAE3D,MAAM,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;AACvD,IAAI,CAAC,IAAI,EAAE,CAAC;IACX,OAAO,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAClD,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;AACtE,CAAC;AACD,MAAM,GAAG,GAAG,CACX,KAAC,UAAU,cACV,MAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,OAAO,EAAE,aAC3C,OAAO,EACR,KAAC,SAAS,IAAC,SAAS,EAAE,iBAAiB,GAAI,IAChB,GAChB,CACb,CAAC;AAEF,kEAAkE;AAClE,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { WorkbenchInstance } from './types';
2
+ export interface WorkbenchProps {
3
+ workbench: WorkbenchInstance;
4
+ className?: string;
5
+ }
6
+ export declare function Workbench({ workbench, className }: WorkbenchProps): import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,MAAM,WAAW,cAAc;IAC9B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,cAAc,2CA2DjE"}
@@ -0,0 +1,39 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState, useContext } from 'react';
3
+ import { AgentuityContext } from '@agentuity/react';
4
+ export function Workbench({ workbench, className }) {
5
+ const { baseUrl } = useContext(AgentuityContext);
6
+ const [status, setStatus] = useState('idle');
7
+ const [response, setResponse] = useState(null);
8
+ const handleApiCall = async () => {
9
+ setStatus('loading');
10
+ try {
11
+ const url = `${baseUrl}/api`;
12
+ const res = await fetch(url, {
13
+ method: 'GET',
14
+ headers: {
15
+ 'Content-Type': 'application/json',
16
+ ...workbench.config.headers,
17
+ },
18
+ });
19
+ if (!res.ok) {
20
+ throw new Error(`HTTP ${res.status}: ${res.statusText}`);
21
+ }
22
+ const data = await res.json();
23
+ setResponse(data);
24
+ setStatus('success');
25
+ }
26
+ catch (error) {
27
+ console.error('API call failed:', error);
28
+ setResponse({ error: error instanceof Error ? error.message : 'Unknown error' });
29
+ setStatus('error');
30
+ }
31
+ };
32
+ return (_jsxs("div", { className: `workbench ${className || ''}`, children: [_jsxs("div", { className: "workbench-header", children: [_jsx("h3", { children: "Workbench" }), _jsxs("p", { children: ["Route: ", workbench.config.route] })] }), _jsx("div", { className: "workbench-controls", children: _jsx("button", { onClick: handleApiCall, disabled: status === 'loading', children: status === 'loading' ? 'Loading...' : 'Hit API' }) }), _jsxs("div", { className: "workbench-response", children: [_jsx("h4", { children: "Response:" }), _jsx("pre", { style: {
33
+ background: '#f5f5f5',
34
+ padding: '10px',
35
+ borderRadius: '4px',
36
+ overflow: 'auto',
37
+ }, children: response ? JSON.stringify(response, null, 2) : 'No response yet' })] })] }));
38
+ }
39
+ //# sourceMappingURL=components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAQpD,MAAM,UAAU,SAAS,CAAC,EAAE,SAAS,EAAE,SAAS,EAAkB;IACjE,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC;IACjD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAA2C,MAAM,CAAC,CAAC;IACvF,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAU,IAAI,CAAC,CAAC;IAExD,MAAM,aAAa,GAAG,KAAK,IAAI,EAAE;QAChC,SAAS,CAAC,SAAS,CAAC,CAAC;QACrB,IAAI,CAAC;YACJ,MAAM,GAAG,GAAG,GAAG,OAAO,MAAM,CAAC;YAC7B,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;gBAC5B,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACR,cAAc,EAAE,kBAAkB;oBAClC,GAAG,SAAS,CAAC,MAAM,CAAC,OAAO;iBAC3B;aACD,CAAC,CAAC;YAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;gBACb,MAAM,IAAI,KAAK,CAAC,QAAQ,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;YAC1D,CAAC;YAED,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAC9B,WAAW,CAAC,IAAI,CAAC,CAAC;YAClB,SAAS,CAAC,SAAS,CAAC,CAAC;QACtB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;YACzC,WAAW,CAAC,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;YACjF,SAAS,CAAC,OAAO,CAAC,CAAC;QACpB,CAAC;IACF,CAAC,CAAC;IAEF,OAAO,CACN,eAAK,SAAS,EAAE,aAAa,SAAS,IAAI,EAAE,EAAE,aAC7C,eAAK,SAAS,EAAC,kBAAkB,aAChC,qCAAkB,EAClB,mCAAW,SAAS,CAAC,MAAM,CAAC,KAAK,IAAK,IACjC,EAEN,cAAK,SAAS,EAAC,oBAAoB,YAClC,iBAAQ,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,KAAK,SAAS,YAC5D,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,GACxC,GACJ,EAEN,eAAK,SAAS,EAAC,oBAAoB,aAClC,qCAAkB,EAClB,cACC,KAAK,EAAE;4BACN,UAAU,EAAE,SAAS;4BACrB,OAAO,EAAE,MAAM;4BACf,YAAY,EAAE,KAAK;4BACnB,QAAQ,EAAE,MAAM;yBAChB,YAEA,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,GAC5D,IACD,IACD,CACN,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { createWorkbench, Workbench } from './workbench';
2
+ export type { WorkbenchInstance } from './types';
3
+ export { encodeWorkbenchConfig, decodeWorkbenchConfig, getWorkbenchConfig, type WorkbenchConfig, } from '@agentuity/core';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EACN,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,eAAe,GACpB,MAAM,iBAAiB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { createWorkbench, Workbench } from './workbench';
2
+ // Re-export workbench config utilities from core
3
+ export { encodeWorkbenchConfig, decodeWorkbenchConfig, getWorkbenchConfig, } from '@agentuity/core';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEzD,iDAAiD;AACjD,OAAO,EACN,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,GAElB,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { WorkbenchConfig } from '@agentuity/core';
2
+ export interface WorkbenchInstance {
3
+ config: WorkbenchConfig;
4
+ }
5
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,WAAW,iBAAiB;IACjC,MAAM,EAAE,eAAe,CAAC;CACxB"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { WorkbenchConfig } from '@agentuity/core';
2
+ import type { WorkbenchInstance } from './types';
3
+ export declare function createWorkbench(config?: WorkbenchConfig): WorkbenchInstance;
4
+ export { Workbench } from './components';
5
+ //# sourceMappingURL=workbench.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workbench.d.ts","sourceRoot":"","sources":["../src/workbench.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,wBAAgB,eAAe,CAC9B,MAAM,GAAE,eAAsD,GAC5D,iBAAiB,CASnB;AAGD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,12 @@
1
+ export function createWorkbench(config = { route: '/workbench', headers: {} }) {
2
+ const finalConfig = {
3
+ route: config.route,
4
+ headers: config.headers,
5
+ };
6
+ return {
7
+ config: finalConfig,
8
+ };
9
+ }
10
+ // Export the actual component for use in HTML generation
11
+ export { Workbench } from './components';
12
+ //# sourceMappingURL=workbench.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workbench.js","sourceRoot":"","sources":["../src/workbench.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,eAAe,CAC9B,SAA0B,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,EAAE;IAE9D,MAAM,WAAW,GAAoB;QACpC,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,OAAO,EAAE,MAAM,CAAC,OAAO;KACvB,CAAC;IAEF,OAAO;QACN,MAAM,EAAE,WAAW;KACnB,CAAC;AACH,CAAC;AAED,yDAAyD;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@agentuity/workbench",
3
+ "version": "0.0.54",
4
+ "license": "Apache-2.0",
5
+ "author": "Agentuity employees and contributors",
6
+ "type": "module",
7
+ "main": "./src/index.ts",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./src/index.ts",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "README.md",
17
+ "dist",
18
+ "src"
19
+ ],
20
+ "scripts": {
21
+ "clean": "rm -rf dist",
22
+ "build": "bunx tsc --build --force",
23
+ "typecheck": "bunx tsc --noEmit",
24
+ "prepublishOnly": "bun run clean && bun run build"
25
+ },
26
+ "dependencies": {
27
+ "@agentuity/core": "0.0.54",
28
+ "@agentuity/react": "0.0.54"
29
+ },
30
+ "devDependencies": {
31
+ "@types/bun": "latest",
32
+ "bun-types": "latest",
33
+ "typescript": "^5.9.0"
34
+ },
35
+ "peerDependencies": {
36
+ "@types/react": "^19.0.0",
37
+ "@types/react-dom": "^19.0.0",
38
+ "react": "^19.0.0",
39
+ "react-dom": "^19.0.0"
40
+ },
41
+ "publishConfig": {
42
+ "access": "public"
43
+ }
44
+ }
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Workbench</title>
7
+ <script type="module" src="./workbench.tsx" async></script>
8
+ </head>
9
+ <body>
10
+ <div id="workbench-root"></div>
11
+ </body>
12
+ </html>
@@ -0,0 +1,36 @@
1
+ /**
2
+ * This file is the entry point for the Workbench app, it sets up the root
3
+ * element and renders the Workbench component to the DOM.
4
+ *
5
+ * It is included in `src/app/index.html`.
6
+ */
7
+
8
+ import React, { StrictMode } from 'react';
9
+ import { createRoot } from 'react-dom/client';
10
+ import { AgentuityContext } from '@agentuity/react';
11
+ import { Workbench } from '../components';
12
+ import { getWorkbenchConfig } from '@agentuity/core';
13
+
14
+ // Get workbench config from environment variable (set during build)
15
+ const workbenchConfig = getWorkbenchConfig();
16
+ const workbenchInstance = { config: workbenchConfig };
17
+
18
+ // Use the port from config to set the base URL
19
+ const baseUrl = `http://localhost:${workbenchConfig.port}`;
20
+
21
+ const elem = document.getElementById('workbench-root');
22
+ if (!elem) {
23
+ console.error('workbench-root element not found');
24
+ throw new Error('Failed to mount workbench: root element not found');
25
+ }
26
+ const app = (
27
+ <StrictMode>
28
+ <AgentuityContext.Provider value={{ baseUrl }}>
29
+ {baseUrl}
30
+ <Workbench workbench={workbenchInstance} />
31
+ </AgentuityContext.Provider>
32
+ </StrictMode>
33
+ );
34
+
35
+ // Simple rendering without hot module reloading for compatibility
36
+ createRoot(elem).render(app);
@@ -0,0 +1,69 @@
1
+ import React, { useState, useContext } from 'react';
2
+ import { AgentuityContext } from '@agentuity/react';
3
+ import type { WorkbenchInstance } from './types';
4
+
5
+ export interface WorkbenchProps {
6
+ workbench: WorkbenchInstance;
7
+ className?: string;
8
+ }
9
+
10
+ export function Workbench({ workbench, className }: WorkbenchProps) {
11
+ const { baseUrl } = useContext(AgentuityContext);
12
+ const [status, setStatus] = useState<'idle' | 'loading' | 'success' | 'error'>('idle');
13
+ const [response, setResponse] = useState<unknown>(null);
14
+
15
+ const handleApiCall = async () => {
16
+ setStatus('loading');
17
+ try {
18
+ const url = `${baseUrl}/api`;
19
+ const res = await fetch(url, {
20
+ method: 'GET',
21
+ headers: {
22
+ 'Content-Type': 'application/json',
23
+ ...workbench.config.headers,
24
+ },
25
+ });
26
+
27
+ if (!res.ok) {
28
+ throw new Error(`HTTP ${res.status}: ${res.statusText}`);
29
+ }
30
+
31
+ const data = await res.json();
32
+ setResponse(data);
33
+ setStatus('success');
34
+ } catch (error) {
35
+ console.error('API call failed:', error);
36
+ setResponse({ error: error instanceof Error ? error.message : 'Unknown error' });
37
+ setStatus('error');
38
+ }
39
+ };
40
+
41
+ return (
42
+ <div className={`workbench ${className || ''}`}>
43
+ <div className="workbench-header">
44
+ <h3>Workbench</h3>
45
+ <p>Route: {workbench.config.route}</p>
46
+ </div>
47
+
48
+ <div className="workbench-controls">
49
+ <button onClick={handleApiCall} disabled={status === 'loading'}>
50
+ {status === 'loading' ? 'Loading...' : 'Hit API'}
51
+ </button>
52
+ </div>
53
+
54
+ <div className="workbench-response">
55
+ <h4>Response:</h4>
56
+ <pre
57
+ style={{
58
+ background: '#f5f5f5',
59
+ padding: '10px',
60
+ borderRadius: '4px',
61
+ overflow: 'auto',
62
+ }}
63
+ >
64
+ {response ? JSON.stringify(response, null, 2) : 'No response yet'}
65
+ </pre>
66
+ </div>
67
+ </div>
68
+ );
69
+ }
package/src/index.ts ADDED
@@ -0,0 +1,9 @@
1
+ export { createWorkbench, Workbench } from './workbench';
2
+ export type { WorkbenchInstance } from './types';
3
+ // Re-export workbench config utilities from core
4
+ export {
5
+ encodeWorkbenchConfig,
6
+ decodeWorkbenchConfig,
7
+ getWorkbenchConfig,
8
+ type WorkbenchConfig,
9
+ } from '@agentuity/core';
package/src/types.ts ADDED
@@ -0,0 +1,5 @@
1
+ import type { WorkbenchConfig } from '@agentuity/core';
2
+
3
+ export interface WorkbenchInstance {
4
+ config: WorkbenchConfig;
5
+ }
@@ -0,0 +1,18 @@
1
+ import type { WorkbenchConfig } from '@agentuity/core';
2
+ import type { WorkbenchInstance } from './types';
3
+
4
+ export function createWorkbench(
5
+ config: WorkbenchConfig = { route: '/workbench', headers: {} }
6
+ ): WorkbenchInstance {
7
+ const finalConfig: WorkbenchConfig = {
8
+ route: config.route,
9
+ headers: config.headers,
10
+ };
11
+
12
+ return {
13
+ config: finalConfig,
14
+ };
15
+ }
16
+
17
+ // Export the actual component for use in HTML generation
18
+ export { Workbench } from './components';