diff --git a/package-lock.json b/package-lock.json index 4de149d0..fc40a756 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "@agent-relay/sdk": "^6.3.1", "@agentworkforce/deploy": "^3.0.15", + "@monaco-editor/react": "^4.7.0", "@xterm/addon-fit": "^0.10.0", "@xterm/addon-web-links": "^0.11.0", "@xterm/xterm": "^5.5.0", @@ -2010,6 +2011,29 @@ "url": "https://opencollective.com/js-sdsl" } }, + "node_modules/@monaco-editor/loader": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@monaco-editor/loader/-/loader-1.7.0.tgz", + "integrity": "sha512-gIwR1HrJrrx+vfyOhYmCZ0/JcWqG5kbfG7+d3f/C1LXk2EvzAbHSg3MQ5lO2sMlo9izoAZ04shohfKLVT6crVA==", + "license": "MIT", + "dependencies": { + "state-local": "^1.0.6" + } + }, + "node_modules/@monaco-editor/react": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@monaco-editor/react/-/react-4.7.0.tgz", + "integrity": "sha512-cyzXQCtO47ydzxpQtCGSQGOC8Gk3ZUeBXFAxD+CWXYFo5OqZyZUonFl0DwUlTyAfRHntBfw2p3w4s9R6oe1eCA==", + "license": "MIT", + "dependencies": { + "@monaco-editor/loader": "^1.5.0" + }, + "peerDependencies": { + "monaco-editor": ">= 0.25.0 < 1", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, "node_modules/@nodable/entities": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/@nodable/entities/-/entities-2.1.0.tgz", @@ -2857,9 +2881,6 @@ "cpu": [ "arm" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2880,9 +2901,6 @@ "cpu": [ "arm" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2903,9 +2921,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2926,9 +2941,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2949,9 +2961,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2972,9 +2981,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -4398,6 +4404,70 @@ "node": ">=14.0.0" } }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/core": { + "version": "1.8.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.1.0", + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/runtime": { + "version": "1.8.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/wasi-threads": { + "version": "1.1.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": { + "version": "1.1.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "^1.7.1", + "@emnapi/runtime": "^1.7.1", + "@tybys/wasm-util": "^0.10.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@tybys/wasm-util": { + "version": "0.10.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/tslib": { + "version": "2.8.1", + "dev": true, + "inBundle": true, + "license": "0BSD", + "optional": true + }, "node_modules/@tailwindcss/oxide-win32-arm64-msvc": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.2.1.tgz", @@ -4601,6 +4671,14 @@ "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", "license": "MIT" }, + "node_modules/@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "license": "MIT", + "optional": true, + "peer": true + }, "node_modules/@types/unist": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", @@ -5485,6 +5563,16 @@ "integrity": "sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw==", "license": "Apache-2.0" }, + "node_modules/dompurify": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.7.tgz", + "integrity": "sha512-WhL/YuveyGXJaerVlMYGWhvQswa7myDG17P7Vu65EWC05o8vfeNbvNf4d/BOvH99+ZW+LlQsc1GDKMa1vNK6dw==", + "license": "(MPL-2.0 OR Apache-2.0)", + "peer": true, + "optionalDependencies": { + "@types/trusted-types": "^2.0.7" + } + }, "node_modules/dotenv": { "version": "17.4.2", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz", @@ -6769,6 +6857,19 @@ "@jridgewell/sourcemap-codec": "^1.5.5" } }, + "node_modules/marked": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-14.0.0.tgz", + "integrity": "sha512-uIj4+faQ+MgHgwUW1l2PsPglZLOLOT1uErt06dAPtx2kjteLAkbsd/0FiYg/MGS+i7ZKLb7w2WClxHkzOOuryQ==", + "license": "MIT", + "peer": true, + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 18" + } + }, "node_modules/math-intrinsics": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", @@ -6982,6 +7083,17 @@ "integrity": "sha512-EGWKgxALGMgzvxYF1UyGTy0HXX/2vHLkw6+NvDKW2jypWbHpjQuj4UMcqQWXHERJhVGKikolT06G3bcKe4fi7w==", "license": "MIT" }, + "node_modules/monaco-editor": { + "version": "0.55.1", + "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.55.1.tgz", + "integrity": "sha512-jz4x+TJNFHwHtwuV9vA9rMujcZRb0CEilTEwG2rRSpe/A7Jdkuj8xPKttCgOh+v/lkHy7HsZ64oj+q3xoAFl9A==", + "license": "MIT", + "peer": true, + "dependencies": { + "dompurify": "3.2.7", + "marked": "14.0.0" + } + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -7674,6 +7786,12 @@ "nan": "^2.23.0" } }, + "node_modules/state-local": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/state-local/-/state-local-1.0.7.tgz", + "integrity": "sha512-HTEHMNieakEnoe33shBYcZ7NX83ACUjCu8c40iOGEZsngj9zRnkqS9j1pqQPXwobB0ZcVTk27REb7COQ0UR59w==", + "license": "MIT" + }, "node_modules/stream-browserify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz", diff --git a/package.json b/package.json index 569556c2..6616acc4 100644 --- a/package.json +++ b/package.json @@ -6,12 +6,15 @@ "main": "./out/main/index.js", "scripts": { "dev": "electron-vite dev", + "prebuild": "node scripts/sync-runtime-types.mjs", "build": "electron-vite build", - "preview": "electron-vite preview" + "preview": "electron-vite preview", + "sync:runtime-types": "node scripts/sync-runtime-types.mjs" }, "dependencies": { "@agent-relay/sdk": "^6.3.1", "@agentworkforce/deploy": "^3.0.15", + "@monaco-editor/react": "^4.7.0", "@xterm/addon-fit": "^0.10.0", "@xterm/addon-web-links": "^0.11.0", "@xterm/xterm": "^5.5.0", diff --git a/scripts/sync-runtime-types.mjs b/scripts/sync-runtime-types.mjs new file mode 100644 index 00000000..2ccfb139 --- /dev/null +++ b/scripts/sync-runtime-types.mjs @@ -0,0 +1,93 @@ +import { mkdir, writeFile } from 'node:fs/promises' +import { dirname, resolve } from 'node:path' +import { fileURLToPath } from 'node:url' + +const rootDir = resolve(dirname(fileURLToPath(import.meta.url)), '..') +const outPath = resolve(rootDir, 'vendor/agentworkforce-runtime-types.d.ts') + +const source = `// Generated by scripts/sync-runtime-types.mjs. +// Keep this file vendored so the proactive-agent editor can type-check +// handler snippets without requiring the workforce repo in packaged builds. + +declare module '@agentworkforce/runtime' { + export type WatchEvent = 'created' | 'updated' | 'deleted' + + export interface WatchRule { + paths: string[] + events: WatchEvent[] + debounceMs?: number + match?: string + } + + export interface WorkforceEventBase { + id: string + type: string + workspace: string + occurredAt: string + attempt?: number + } + + export interface RelayfileChangedEvent extends WorkforceEventBase { + type: 'relayfile.changed' | 'relayfile.created' | 'relayfile.updated' | 'relayfile.deleted' + path: string + resource?: unknown + } + + export type WorkforceEvent = WorkforceEventBase | RelayfileChangedEvent + + export interface FilesContext { + read(path: string): Promise + write(path: string, contents: string): Promise + exists(path: string): Promise + } + + export interface NotifyInput { + channel?: string + text: string + } + + export interface WorkforceCtx { + workspaceId: string + agentId: string + fs: FilesContext + notify(input: NotifyInput): Promise + log(level: 'debug' | 'info' | 'warn' | 'error', message: string, data?: Record): void + } + + export type WorkforceHandler = (ctx: WorkforceCtx, event: WorkforceEvent) => Promise | void + + export function handler(fn: WorkforceHandler): WorkforceHandler +} + +declare module '@agentworkforce/persona-kit' { + export type Harness = 'claude' | 'codex' | 'opencode' + export type WatchEvent = 'created' | 'updated' | 'deleted' + + export interface WatchRule { + paths: string[] + events: WatchEvent[] + debounceMs?: number + match?: string + } + + export interface PersonaSpec { + id: string + name?: string + description?: string + harness: Harness + model: string + systemPrompt: string + integrations?: Record + watch?: WatchRule[] + onEvent?: string + inputs?: Record + memory?: boolean | { enabled?: boolean; scopes?: string[]; ttlDays?: number } + harnessSettings?: { reasoning?: 'low' | 'medium' | 'high'; timeoutSeconds?: number } + mount?: { enabled?: boolean } + } +} +` + +await mkdir(dirname(outPath), { recursive: true }) +await writeFile(outPath, source, 'utf8') +console.log(`wrote ${outPath}`) diff --git a/vendor/agentworkforce-runtime-types.d.ts b/vendor/agentworkforce-runtime-types.d.ts new file mode 100644 index 00000000..b5c89181 --- /dev/null +++ b/vendor/agentworkforce-runtime-types.d.ts @@ -0,0 +1,81 @@ +// Generated by scripts/sync-runtime-types.mjs. +// Keep this file vendored so the proactive-agent editor can type-check +// handler snippets without requiring the workforce repo in packaged builds. + +declare module '@agentworkforce/runtime' { + export type WatchEvent = 'created' | 'updated' | 'deleted' + + export interface WatchRule { + paths: string[] + events: WatchEvent[] + debounceMs?: number + match?: string + } + + export interface WorkforceEventBase { + id: string + type: string + workspace: string + occurredAt: string + attempt?: number + } + + export interface RelayfileChangedEvent extends WorkforceEventBase { + type: 'relayfile.changed' | 'relayfile.created' | 'relayfile.updated' | 'relayfile.deleted' + path: string + resource?: unknown + } + + export type WorkforceEvent = WorkforceEventBase | RelayfileChangedEvent + + export interface FilesContext { + read(path: string): Promise + write(path: string, contents: string): Promise + exists(path: string): Promise + } + + export interface NotifyInput { + channel?: string + text: string + } + + export interface WorkforceCtx { + workspaceId: string + agentId: string + fs: FilesContext + notify(input: NotifyInput): Promise + log(level: 'debug' | 'info' | 'warn' | 'error', message: string, data?: Record): void + } + + export type WorkforceHandler = (ctx: WorkforceCtx, event: WorkforceEvent) => Promise | void + + export function handler(fn: WorkforceHandler): WorkforceHandler +} + +declare module '@agentworkforce/persona-kit' { + export type Harness = 'claude' | 'codex' | 'opencode' + export type WatchEvent = 'created' | 'updated' | 'deleted' + + export interface WatchRule { + paths: string[] + events: WatchEvent[] + debounceMs?: number + match?: string + } + + export interface PersonaSpec { + id: string + name?: string + description?: string + harness: Harness + model: string + systemPrompt: string + integrations?: Record + watch?: WatchRule[] + onEvent?: string + inputs?: Record + memory?: boolean | { enabled?: boolean; scopes?: string[]; ttlDays?: number } + harnessSettings?: { reasoning?: 'low' | 'medium' | 'high'; timeoutSeconds?: number } + mount?: { enabled?: boolean } + } +}