commit 5ff0d80e7ee274cdefd2e66bd7d7aa5275271974 Author: Juergen Kunz Date: Tue May 5 12:03:46 2026 +0000 Add agents package diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4336e0e --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +node_modules/ +dist/ +dist_*/ +dist_ts/ +coverage/ +.nyc_output/ +.nogit/ +.playwright-mcp/ +*.log +.DS_Store +.env +.env.* +!.env.example diff --git a/package.json b/package.json new file mode 100644 index 0000000..0eee021 --- /dev/null +++ b/package.json @@ -0,0 +1,40 @@ +{ + "name": "@smarthome.exchange/agents", + "version": "0.1.0", + "private": false, + "description": "Reference agent definitions for smarthome.exchange.", + "exports": { + ".": "./dist_ts/index.js" + }, + "type": "module", + "author": "Task Venture Capital GmbH", + "license": "MIT", + "scripts": { + "test": "tstest test/ --verbose --logfile --timeout 60", + "build": "tsbuild tsfolders --allowimplicitany", + "buildDocs": "tsdoc" + }, + "dependencies": { + "@smarthome.exchange/interfaces": "workspace:*" + }, + "devDependencies": { + "@git.zone/tsbuild": "^4.4.0", + "@git.zone/tsdoc": "^2.0.3", + "@git.zone/tsrun": "^2.0.3", + "@git.zone/tstest": "^3.6.3", + "@types/node": "^25.6.0" + }, + "files": [ + "ts/**/*", + "dist/**/*", + "dist_*/**/*", + "dist_ts/**/*", + "readme.md", + "changelog.md", + "license" + ], + "browserslist": [ + "last 1 chrome versions" + ], + "packageManager": "pnpm@10.28.2" +} diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..8daca91 --- /dev/null +++ b/readme.md @@ -0,0 +1,3 @@ +# @smarthome.exchange/agents + +Editable reference agent definitions for smarthome.exchange installs. diff --git a/test/test.node.ts b/test/test.node.ts new file mode 100644 index 0000000..a798e82 --- /dev/null +++ b/test/test.node.ts @@ -0,0 +1,9 @@ +import { expect, tap } from '@git.zone/tstest/tapbundle'; +import { referenceAgents } from '../ts/index.js'; + +tap.test('ships six reference agents', async () => { + expect(referenceAgents.length).toEqual(6); + expect(referenceAgents.map((agentArg) => agentArg.id)).toContain('comfort'); +}); + +export default tap.start(); diff --git a/ts/index.ts b/ts/index.ts new file mode 100644 index 0000000..7f84154 --- /dev/null +++ b/ts/index.ts @@ -0,0 +1 @@ +export * from './referenceagents.js'; diff --git a/ts/plugins.ts b/ts/plugins.ts new file mode 100644 index 0000000..9c0b14f --- /dev/null +++ b/ts/plugins.ts @@ -0,0 +1,4 @@ +// Project scope +import * as shxInterfaces from '@smarthome.exchange/interfaces'; + +export { shxInterfaces }; diff --git a/ts/referenceagents.ts b/ts/referenceagents.ts new file mode 100644 index 0000000..a78b1d7 --- /dev/null +++ b/ts/referenceagents.ts @@ -0,0 +1,80 @@ +import * as plugins from './plugins.js'; + +export const referenceAgents: plugins.shxInterfaces.data.IAgentDefinition[] = [ + { + id: 'comfort', + name: 'Comfort', + role: 'Climate, light, ambience', + glyph: 'comfort', + color: '#f59e0b', + mode: 'auto', + model: 'local:small', + scopes: ['climate.read', 'climate.write', 'light.read', 'light.write', 'device.read'], + systemPrompt: 'Keep rooms comfortable while minimizing waste. Explain any tradeoff involving energy or privacy.', + enabled: true, + }, + { + id: 'sentinel', + name: 'Sentinel', + role: 'Locks, cameras, presence', + glyph: 'sentinel', + color: '#ef4444', + mode: 'ask', + model: 'local:small', + scopes: ['lock.read', 'lock.write', 'camera.read', 'alarm.write', 'device.read'], + systemPrompt: 'Protect the home with conservative defaults. Ask before irreversible or alarming actions.', + enabled: true, + }, + { + id: 'watt', + name: 'Watt', + role: 'Energy, solar, EV, appliances', + glyph: 'watt', + color: '#22c55e', + mode: 'ask', + model: 'local:small', + scopes: ['energy.read', 'energy.write', 'climate.read', 'device.read', 'device.write'], + systemPrompt: 'Shift energy loads toward cheap, local, and renewable windows without reducing household comfort.', + enabled: true, + }, + { + id: 'dawn', + name: 'Dawn', + role: 'Wake, wind-down, daily ritual', + glyph: 'dawn', + color: '#a78bfa', + mode: 'auto', + model: 'local:small', + scopes: ['light.read', 'light.write', 'device.read', 'device.write'], + systemPrompt: 'Run gentle daily routines that respect calendars, presence, and explicit quiet hours.', + enabled: true, + }, + { + id: 'echo', + name: 'Echo', + role: 'Audio, media, follow-me', + glyph: 'echo', + color: '#60a5fa', + mode: 'suggest', + model: 'local:small', + scopes: ['device.read', 'device.write'], + systemPrompt: 'Manage media experiences without interrupting active calls, sleep windows, or private rooms.', + enabled: true, + }, + { + id: 'steward', + name: 'Steward', + role: 'Errands, deliveries, household ops', + glyph: 'steward', + color: '#f87171', + mode: 'ask', + model: 'local:small', + scopes: ['*.read', 'approval.write'], + systemPrompt: 'Coordinate household operations. Prefer reminders and approval requests over direct action.', + enabled: true, + }, +]; + +export const getReferenceAgentById = (agentIdArg: string) => { + return referenceAgents.find((agentArg) => agentArg.id === agentIdArg); +}; diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..7862634 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "verbatimModuleSyntax": true, + "types": ["node"] + }, + "exclude": [ + "dist_*/**/*.d.ts" + ] +}