opc-agent 1.3.1 → 1.4.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/.github/ISSUE_TEMPLATE/bug_report.md +20 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +14 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +13 -0
- package/CHANGELOG.md +23 -57
- package/CONTRIBUTING.md +36 -75
- package/dist/channels/slack.js +93 -10
- package/dist/channels/web.d.ts +10 -0
- package/dist/channels/web.js +33 -2
- package/dist/cli.js +137 -26
- package/dist/core/runtime.d.ts +4 -0
- package/dist/core/runtime.js +27 -0
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.js +7 -1
- package/examples/README.md +22 -0
- package/examples/basic-agent.ts +90 -0
- package/examples/brain-integration.ts +71 -0
- package/examples/multi-channel.ts +74 -0
- package/package.json +1 -1
- package/src/channels/slack.ts +67 -10
- package/src/channels/web.ts +38 -2
- package/src/cli.ts +158 -26
- package/src/core/runtime.ts +31 -0
- package/src/providers/index.ts +9 -1
- package/test-agent/Dockerfile +9 -0
- package/test-agent/README.md +50 -0
- package/test-agent/agent.yaml +23 -0
- package/test-agent/docker-compose.yml +11 -0
- package/test-agent/oad.yaml +31 -0
- package/test-agent/package-lock.json +1492 -0
- package/test-agent/package.json +18 -0
- package/test-agent/src/index.ts +24 -0
- package/test-agent/src/skills/echo.ts +15 -0
- package/test-agent/tsconfig.json +25 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "test-agent",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"start": "opc run",
|
|
7
|
+
"dev": "opc dev",
|
|
8
|
+
"chat": "opc chat",
|
|
9
|
+
"build": "tsc"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"opc-agent": "^1.3.0"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"typescript": "^5.5.0",
|
|
16
|
+
"tsx": "^4.0.0"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AgentRuntime } from 'opc-agent';
|
|
2
|
+
import { EchoSkill } from './skills/echo';
|
|
3
|
+
|
|
4
|
+
async function main() {
|
|
5
|
+
const runtime = new AgentRuntime();
|
|
6
|
+
|
|
7
|
+
// Load OAD config
|
|
8
|
+
await runtime.loadConfig('./agent.yaml');
|
|
9
|
+
|
|
10
|
+
// Initialize agent with channels, memory, etc.
|
|
11
|
+
const agent = await runtime.initialize();
|
|
12
|
+
|
|
13
|
+
// Register custom skills
|
|
14
|
+
runtime.registerSkill(new EchoSkill());
|
|
15
|
+
|
|
16
|
+
// Start serving
|
|
17
|
+
await runtime.start();
|
|
18
|
+
|
|
19
|
+
console.log('🤖 Agent is running!');
|
|
20
|
+
console.log(' Web UI: http://localhost:3000');
|
|
21
|
+
console.log(' Press Ctrl+C to stop');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
main().catch(console.error);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseSkill } from 'opc-agent';
|
|
2
|
+
import type { AgentContext, Message, SkillResult } from 'opc-agent';
|
|
3
|
+
|
|
4
|
+
export class EchoSkill extends BaseSkill {
|
|
5
|
+
name = 'echo';
|
|
6
|
+
description = 'Echo back the message (test skill)';
|
|
7
|
+
|
|
8
|
+
async execute(context: AgentContext, message: Message): Promise<SkillResult> {
|
|
9
|
+
if (message.content.toLowerCase().startsWith('/echo ')) {
|
|
10
|
+
const text = message.content.slice(6);
|
|
11
|
+
return this.match(`🔊 Echo: ${text}`);
|
|
12
|
+
}
|
|
13
|
+
return this.noMatch();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": [
|
|
6
|
+
"ES2022"
|
|
7
|
+
],
|
|
8
|
+
"outDir": "dist",
|
|
9
|
+
"rootDir": "src",
|
|
10
|
+
"strict": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"forceConsistentCasingInFileNames": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"declaration": true,
|
|
16
|
+
"sourceMap": true
|
|
17
|
+
},
|
|
18
|
+
"include": [
|
|
19
|
+
"src/**/*"
|
|
20
|
+
],
|
|
21
|
+
"exclude": [
|
|
22
|
+
"node_modules",
|
|
23
|
+
"dist"
|
|
24
|
+
]
|
|
25
|
+
}
|