opc-agent 1.3.0 → 1.3.1

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,24 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ node-version: [18, 20, 22]
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-node@v4
18
+ with:
19
+ node-version: ${{ matrix.node-version }}
20
+ - run: npm ci
21
+ - run: npm run build --if-present
22
+ - run: npx vitest run --reporter=verbose
23
+ env:
24
+ CI: true
package/dist/cli.js CHANGED
@@ -61,7 +61,6 @@ const workflow_1 = require("./core/workflow");
61
61
  const versioning_1 = require("./core/versioning");
62
62
  const providers_1 = require("./providers");
63
63
  const knowledge_1 = require("./core/knowledge");
64
- const marketplace_1 = require("./marketplace");
65
64
  const program = new commander_1.Command();
66
65
  const color = {
67
66
  green: (s) => `\x1b[32m${s}\x1b[0m`,
@@ -684,51 +683,23 @@ kbCmd.command('clear').action(() => {
684
683
  kb.clear();
685
684
  console.log(`${icon.success} Knowledge base cleared.`);
686
685
  });
687
- // 📦 Marketplace commands ───────────────────────────────────
686
+ // 📦 Package commands ───────────────────────────────────
688
687
  program
689
688
  .command('publish')
690
689
  .description('Package agent for distribution')
691
690
  .option('-f, --file <file>', 'OAD file', 'oad.yaml')
692
691
  .option('-o, --output <dir>', 'Output directory', '.')
693
692
  .option('--include-kb', 'Include knowledge base')
694
- .action(async (opts) => {
695
- try {
696
- console.log(`\n${icon.package} Packaging agent...\n`);
697
- const result = await (0, marketplace_1.publishAgent)({
698
- oadPath: opts.file,
699
- outputDir: opts.output,
700
- includeKnowledge: opts.includeKb,
701
- });
702
- console.log(`${icon.success} Published: ${color.bold(result.archivePath)}`);
703
- console.log(` Name: ${result.manifest.name}`);
704
- console.log(` Version: ${result.manifest.version}`);
705
- console.log(` Files: ${result.manifest.files.length}`);
706
- console.log();
707
- }
708
- catch (err) {
709
- console.error(`${icon.error} Publish failed:`, err instanceof Error ? err.message : err);
710
- process.exit(1);
711
- }
693
+ .action(async () => {
694
+ console.log(`\n${icon.package} Agent packaging coming soon.\n`);
712
695
  });
713
696
  program
714
697
  .command('install')
715
698
  .description('Install agent from package')
716
699
  .argument('<source>', 'Package file path or URL')
717
700
  .option('-d, --dir <dir>', 'Install directory')
718
- .action(async (source, opts) => {
719
- try {
720
- console.log(`\n${icon.package} Installing agent from ${color.bold(source)}...\n`);
721
- const result = await (0, marketplace_1.installAgent)({ source, targetDir: opts.dir });
722
- console.log(`${icon.success} Installed: ${color.bold(result.manifest.name)} v${result.manifest.version}`);
723
- console.log(` Directory: ${result.dir}`);
724
- console.log(`\n${color.bold('Next steps:')}`);
725
- console.log(` cd ${result.dir}`);
726
- console.log(` opc run\n`);
727
- }
728
- catch (err) {
729
- console.error(`${icon.error} Install failed:`, err instanceof Error ? err.message : err);
730
- process.exit(1);
731
- }
701
+ .action(async () => {
702
+ console.log(`\n${icon.package} Agent install coming soon.\n`);
732
703
  });
733
704
  // 🔌 Plugin commands ────────────────────────────────────────
734
705
  const pluginCmd = program.command('plugin').description('Manage plugins');
@@ -838,5 +809,118 @@ program
838
809
  process.exit(1);
839
810
  }
840
811
  });
812
+ // ── Brain command ────────────────────────────────────────────
813
+ program
814
+ .command('brain')
815
+ .description('Show agent memory/brain status from DeepBrain')
816
+ .option('--url <url>', 'DeepBrain server URL', 'http://localhost:3333')
817
+ .action(async (opts) => {
818
+ console.log(`\n${icon.gear} ${color.bold('DeepBrain Status')} — ${color.dim(opts.url)}\n`);
819
+ try {
820
+ const res = await fetch(`${opts.url}/api/stats`);
821
+ if (!res.ok)
822
+ throw new Error(`HTTP ${res.status} ${res.statusText}`);
823
+ const stats = (await res.json());
824
+ const rows = [
825
+ ['Total Pages', String(stats.totalPages ?? stats.pages ?? '-')],
826
+ ['Total Chunks', String(stats.totalChunks ?? stats.chunks ?? '-')],
827
+ ['Memory Tiers', String(stats.memoryTiers ?? stats.tiers ?? '-')],
828
+ ['Index Size', stats.indexSize ?? '-'],
829
+ ['Last Updated', stats.lastUpdated ?? stats.updatedAt ?? '-'],
830
+ ];
831
+ const maxKey = Math.max(...rows.map(([k]) => k.length));
832
+ for (const [key, val] of rows) {
833
+ console.log(` ${color.cyan(key.padEnd(maxKey))} ${val}`);
834
+ }
835
+ console.log();
836
+ }
837
+ catch (err) {
838
+ const msg = err instanceof Error ? err.message : String(err);
839
+ if (msg.includes('ECONNREFUSED') || msg.includes('fetch failed')) {
840
+ console.log(` ${icon.warn} Cannot connect to DeepBrain at ${opts.url}`);
841
+ console.log(` ${color.dim('Is the server running? Start with: deepbrain serve')}\n`);
842
+ }
843
+ else {
844
+ console.error(` ${icon.error} ${msg}\n`);
845
+ }
846
+ }
847
+ });
848
+ // ── Logs command ─────────────────────────────────────────────
849
+ program
850
+ .command('logs')
851
+ .description('Show recent agent traces')
852
+ .option('-n, --limit <n>', 'Number of spans to show', '20')
853
+ .option('-f, --follow', 'Keep watching for new spans')
854
+ .action(async (opts) => {
855
+ const { TraceCollector } = await Promise.resolve().then(() => __importStar(require('./traces')));
856
+ const collector = new TraceCollector();
857
+ const limit = parseInt(opts.limit) || 20;
858
+ const printSpans = (spans) => {
859
+ const slice = spans.slice(-limit);
860
+ if (slice.length === 0) {
861
+ console.log(` ${icon.info} No traces yet. Interact with the agent to generate traces.`);
862
+ return;
863
+ }
864
+ for (const span of slice) {
865
+ const duration = span.endTime
866
+ ? `${span.endTime.getTime() - span.startTime.getTime()}ms`
867
+ : 'ongoing';
868
+ const statusIcon = span.status === 'ok' ? icon.success : span.status === 'error' ? icon.error : color.dim('○');
869
+ const time = span.startTime.toLocaleTimeString();
870
+ console.log(` ${statusIcon} ${color.dim(time)} ${color.bold(span.name)} ${color.dim(duration)}`);
871
+ }
872
+ };
873
+ console.log(`\n${icon.gear} ${color.bold('Agent Traces')}\n`);
874
+ const spans = collector.getBufferedSpans();
875
+ printSpans(spans);
876
+ if (opts.follow) {
877
+ console.log(`\n ${color.dim('Watching for new traces... (Ctrl+C to stop)')}\n`);
878
+ let lastCount = spans.length;
879
+ const interval = setInterval(() => {
880
+ const current = collector.getBufferedSpans();
881
+ if (current.length > lastCount) {
882
+ const newSpans = current.slice(lastCount);
883
+ printSpans(newSpans);
884
+ lastCount = current.length;
885
+ }
886
+ }, 1000);
887
+ process.on('SIGINT', () => { clearInterval(interval); process.exit(0); });
888
+ }
889
+ else {
890
+ console.log();
891
+ }
892
+ });
893
+ // ── Score command ────────────────────────────────────────────
894
+ program
895
+ .command('score')
896
+ .description('Show agent performance score')
897
+ .action(async () => {
898
+ console.log(`\n${icon.gear} ${color.bold('Agent Performance Score')}\n`);
899
+ try {
900
+ const engine = new analytics_engine_1.AnalyticsEngine('.');
901
+ const stats = engine.getStats();
902
+ if (!stats || stats.totalMessages === 0) {
903
+ console.log(` ${icon.info} No score data yet. Run the agent first.\n`);
904
+ return;
905
+ }
906
+ const errorRate = stats.totalMessages > 0 ? (stats.totalErrors / stats.totalMessages) : 0;
907
+ const rows = [
908
+ ['Total Messages', String(stats.totalMessages)],
909
+ ['Total LLM Calls', String(stats.totalLLMCalls)],
910
+ ['Total Tool Uses', String(stats.totalToolUses)],
911
+ ['Avg Response Time', `${stats.avgResponseTimeMs}ms`],
912
+ ['Error Rate', `${(errorRate * 100).toFixed(1)}%`],
913
+ ['Token Usage', `${stats.totalTokens.total} tokens (in: ${stats.totalTokens.input}, out: ${stats.totalTokens.output})`],
914
+ ];
915
+ const maxKey = Math.max(...rows.map(([k]) => k.length));
916
+ for (const [key, val] of rows) {
917
+ console.log(` ${color.cyan(key.padEnd(maxKey))} ${val}`);
918
+ }
919
+ console.log();
920
+ }
921
+ catch {
922
+ console.log(` ${icon.info} No score data yet. Run the agent first.\n`);
923
+ }
924
+ });
841
925
  program.parse();
842
926
  //# sourceMappingURL=cli.js.map
@@ -0,0 +1,56 @@
1
+ import { EventEmitter } from 'events';
2
+ export interface StreamChunk {
3
+ id: string;
4
+ type: 'text' | 'tool_call' | 'error' | 'done';
5
+ data: string;
6
+ timestamp: number;
7
+ metadata?: Record<string, unknown>;
8
+ }
9
+ export interface StreamOptions {
10
+ /** High-water mark for backpressure (default 64 chunks). */
11
+ highWaterMark?: number;
12
+ /** Heartbeat interval in ms to keep connection alive (default 15000). */
13
+ heartbeatInterval?: number;
14
+ }
15
+ export declare class StreamableResponse extends EventEmitter {
16
+ readonly id: string;
17
+ private chunks;
18
+ private ended;
19
+ private paused;
20
+ private buffer;
21
+ private highWaterMark;
22
+ constructor(id: string, options?: StreamOptions);
23
+ /** Push a chunk. Returns false if backpressure threshold reached. */
24
+ push(chunk: StreamChunk): boolean;
25
+ /** Resume after backpressure — flush buffered chunks. */
26
+ resume(): void;
27
+ end(): void;
28
+ getChunks(): StreamChunk[];
29
+ /** Collect all text chunks into a single string. */
30
+ getText(): string;
31
+ get isEnded(): boolean;
32
+ get isPaused(): boolean;
33
+ get length(): number;
34
+ }
35
+ export declare class StreamingManager {
36
+ private streams;
37
+ private counter;
38
+ /** Create a new stream. */
39
+ createStream(options?: StreamOptions): StreamableResponse;
40
+ /** Write a text chunk to a stream. */
41
+ writeChunk(streamId: string, data: string, metadata?: Record<string, unknown>): boolean;
42
+ /** End a stream. */
43
+ endStream(streamId: string): void;
44
+ /** Get an existing stream. */
45
+ getStream(streamId: string): StreamableResponse | undefined;
46
+ /** Format a chunk as an SSE event string. */
47
+ static formatSSE(chunk: StreamChunk): string;
48
+ /** Pipe a stream to an SSE-compatible HTTP response (Express-style). */
49
+ static pipeSSE(stream: StreamableResponse, res: {
50
+ write(data: string): boolean;
51
+ end(): void;
52
+ setHeader?(name: string, value: string): void;
53
+ }, options?: StreamOptions): void;
54
+ get activeCount(): number;
55
+ }
56
+ //# sourceMappingURL=streaming.d.ts.map
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StreamingManager = exports.StreamableResponse = void 0;
4
+ const events_1 = require("events");
5
+ // ─── StreamableResponse ──────────────────────────────────────
6
+ class StreamableResponse extends events_1.EventEmitter {
7
+ id;
8
+ chunks = [];
9
+ ended = false;
10
+ paused = false;
11
+ buffer = [];
12
+ highWaterMark;
13
+ constructor(id, options) {
14
+ super();
15
+ this.id = id;
16
+ this.highWaterMark = options?.highWaterMark ?? 64;
17
+ }
18
+ /** Push a chunk. Returns false if backpressure threshold reached. */
19
+ push(chunk) {
20
+ if (this.ended)
21
+ return false;
22
+ this.chunks.push(chunk);
23
+ if (this.paused) {
24
+ this.buffer.push(chunk);
25
+ return this.buffer.length < this.highWaterMark;
26
+ }
27
+ this.emit('chunk', chunk);
28
+ if (this.chunks.length >= this.highWaterMark) {
29
+ this.paused = true;
30
+ this.emit('backpressure');
31
+ return false;
32
+ }
33
+ return true;
34
+ }
35
+ /** Resume after backpressure — flush buffered chunks. */
36
+ resume() {
37
+ if (!this.paused)
38
+ return;
39
+ this.paused = false;
40
+ const buffered = this.buffer.splice(0);
41
+ for (const chunk of buffered) {
42
+ this.emit('chunk', chunk);
43
+ }
44
+ this.emit('drain');
45
+ }
46
+ end() {
47
+ if (this.ended)
48
+ return;
49
+ this.ended = true;
50
+ if (this.paused)
51
+ this.resume();
52
+ this.emit('end');
53
+ }
54
+ getChunks() {
55
+ return [...this.chunks];
56
+ }
57
+ /** Collect all text chunks into a single string. */
58
+ getText() {
59
+ return this.chunks
60
+ .filter((c) => c.type === 'text')
61
+ .map((c) => c.data)
62
+ .join('');
63
+ }
64
+ get isEnded() {
65
+ return this.ended;
66
+ }
67
+ get isPaused() {
68
+ return this.paused;
69
+ }
70
+ get length() {
71
+ return this.chunks.length;
72
+ }
73
+ }
74
+ exports.StreamableResponse = StreamableResponse;
75
+ // ─── StreamingManager ────────────────────────────────────────
76
+ class StreamingManager {
77
+ streams = new Map();
78
+ counter = 0;
79
+ /** Create a new stream. */
80
+ createStream(options) {
81
+ const id = `stream_${++this.counter}_${Date.now()}`;
82
+ const stream = new StreamableResponse(id, options);
83
+ this.streams.set(id, stream);
84
+ stream.on('end', () => {
85
+ // Keep ended streams for a bit for late consumers, then clean up
86
+ setTimeout(() => this.streams.delete(id), 30_000);
87
+ });
88
+ return stream;
89
+ }
90
+ /** Write a text chunk to a stream. */
91
+ writeChunk(streamId, data, metadata) {
92
+ const stream = this.streams.get(streamId);
93
+ if (!stream)
94
+ return false;
95
+ return stream.push({
96
+ id: `chunk_${stream.length}`,
97
+ type: 'text',
98
+ data,
99
+ timestamp: Date.now(),
100
+ metadata,
101
+ });
102
+ }
103
+ /** End a stream. */
104
+ endStream(streamId) {
105
+ const stream = this.streams.get(streamId);
106
+ if (!stream)
107
+ return;
108
+ stream.push({
109
+ id: `chunk_${stream.length}`,
110
+ type: 'done',
111
+ data: '',
112
+ timestamp: Date.now(),
113
+ });
114
+ stream.end();
115
+ }
116
+ /** Get an existing stream. */
117
+ getStream(streamId) {
118
+ return this.streams.get(streamId);
119
+ }
120
+ /** Format a chunk as an SSE event string. */
121
+ static formatSSE(chunk) {
122
+ const lines = [];
123
+ lines.push(`event: ${chunk.type}`);
124
+ lines.push(`id: ${chunk.id}`);
125
+ const payload = JSON.stringify({ data: chunk.data, metadata: chunk.metadata });
126
+ lines.push(`data: ${payload}`);
127
+ lines.push('');
128
+ return lines.join('\n') + '\n';
129
+ }
130
+ /** Pipe a stream to an SSE-compatible HTTP response (Express-style). */
131
+ static pipeSSE(stream, res, options) {
132
+ res.setHeader?.('Content-Type', 'text/event-stream');
133
+ res.setHeader?.('Cache-Control', 'no-cache');
134
+ res.setHeader?.('Connection', 'keep-alive');
135
+ const heartbeatMs = options?.heartbeatInterval ?? 15_000;
136
+ const heartbeat = setInterval(() => {
137
+ res.write(': heartbeat\n\n');
138
+ }, heartbeatMs);
139
+ stream.on('chunk', (chunk) => {
140
+ const ok = res.write(StreamingManager.formatSSE(chunk));
141
+ if (!ok && stream.isPaused === false) {
142
+ // Downstream can't keep up — will resume on drain from stream
143
+ }
144
+ });
145
+ stream.on('end', () => {
146
+ clearInterval(heartbeat);
147
+ res.end();
148
+ });
149
+ }
150
+ get activeCount() {
151
+ let count = 0;
152
+ for (const s of this.streams.values()) {
153
+ if (!s.isEnded)
154
+ count++;
155
+ }
156
+ return count;
157
+ }
158
+ }
159
+ exports.StreamingManager = StreamingManager;
160
+ //# sourceMappingURL=streaming.js.map
@@ -100,15 +100,6 @@ function generateAgentsMd(oad) {
100
100
  md += `Default memory settings.\n`;
101
101
  }
102
102
  md += `\n`;
103
- // DTV
104
- if (dtv) {
105
- md += `## Trust & Value\n\n`;
106
- md += `- Trust Level: ${dtv.trust?.level ?? 'sandbox'}\n`;
107
- if (dtv.value?.metrics?.length) {
108
- md += `- Metrics: ${dtv.value.metrics.join(', ')}\n`;
109
- }
110
- md += `\n`;
111
- }
112
103
  return md;
113
104
  }
114
105
  function generateUserMd(oad) {
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { AgentRuntime, truncateOutput } from './core/runtime';
3
3
  export { Logger } from './core/logger';
4
4
  export { loadOAD, validateOAD } from './core/config';
5
5
  export { OADSchema } from './schema/oad';
6
- export type { OADDocument, Metadata, Spec, DTVConfig, TrustLevelType } from './schema/oad';
6
+ export type { OADDocument, Metadata, Spec } from './schema/oad';
7
7
  export type { IAgent, IChannel, ISkill, Message, AgentContext, SkillResult, MemoryStore, AgentState } from './core/types';
8
8
  export { BaseChannel } from './channels';
9
9
  export { WebChannel } from './channels/web';
@@ -13,9 +13,6 @@ export { BaseSkill } from './skills/base';
13
13
  export { SkillRegistry } from './skills';
14
14
  export { InMemoryStore } from './memory';
15
15
  export { DeepBrainMemoryStore } from './memory/deepbrain';
16
- export { TrustManager } from './dtv/trust';
17
- export { ValueTracker } from './dtv/value';
18
- export { MRGConfigReader } from './dtv/data';
19
16
  export { createProvider, SUPPORTED_PROVIDERS } from './providers';
20
17
  export { Room } from './core/room';
21
18
  export type { RoomMessage } from './core/room';
@@ -45,8 +42,6 @@ export type { Locale } from './i18n';
45
42
  export { KnowledgeBase } from './core/knowledge';
46
43
  export { deployToHermes } from './deploy/hermes';
47
44
  export type { HermesDeployOptions, HermesDeployResult } from './deploy/hermes';
48
- export { publishAgent, installAgent } from './marketplace';
49
- export type { AgentManifest, PublishOptions, InstallOptions } from './marketplace';
50
45
  export { createAuthMiddleware, getActiveSessions } from './core/auth';
51
46
  export type { AuthConfig, AuthSession } from './core/auth';
52
47
  export { Orchestrator } from './core/orchestrator';
@@ -91,4 +86,10 @@ export { DiscordChannel } from './channels/discord';
91
86
  export type { DiscordChannelConfig } from './channels/discord';
92
87
  export { ProcessWatcher } from './core/watch';
93
88
  export type { WatchPattern, WatchMatch, WatchOptions } from './core/watch';
89
+ export { ToolGateway } from './tools/gateway';
90
+ export type { ToolGatewayConfig, GatewayToolName } from './tools/gateway';
91
+ export { StreamingManager, StreamableResponse } from './core/streaming';
92
+ export type { StreamChunk, StreamOptions } from './core/streaming';
93
+ export { TraceCollector, ConsoleExporter, DeepBrainExporter } from './traces';
94
+ export type { Span, SpanEvent, TraceExporter } from './traces';
94
95
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EmailChannel = exports.compose = exports.AgentPipeline = exports.Orchestrator = exports.getActiveSessions = exports.createAuthMiddleware = exports.installAgent = exports.publishAgent = exports.deployToHermes = exports.KnowledgeBase = exports.addMessages = exports.detectLocale = exports.getLocale = exports.setLocale = exports.t = exports.LazyLoader = exports.RequestBatcher = exports.ConnectionPool = exports.VersionManager = exports.WebhookChannel = exports.VoiceChannel = exports.HITLManager = exports.AgentRegistry = exports.WorkflowEngine = exports.Analytics = exports.Sandbox = exports.PluginManager = exports.createMCPTool = exports.MCPToolRegistry = exports.Room = exports.SUPPORTED_PROVIDERS = exports.createProvider = exports.MRGConfigReader = exports.ValueTracker = exports.TrustManager = exports.DeepBrainMemoryStore = exports.InMemoryStore = exports.SkillRegistry = exports.BaseSkill = exports.WebSocketChannel = exports.TelegramChannel = exports.WebChannel = exports.BaseChannel = exports.OADSchema = exports.validateOAD = exports.loadOAD = exports.Logger = exports.truncateOutput = exports.AgentRuntime = exports.BaseAgent = void 0;
4
- exports.ProcessWatcher = exports.DiscordChannel = exports.FeishuChannel = exports.createRateLimitPlugin = exports.createAnalyticsPlugin = exports.createLoggingPlugin = exports.inputValidation = exports.APIKeyManager = exports.corsMiddleware = exports.securityHeaders = exports.detectInjection = exports.sanitizeInput = exports.formatErrorForUser = exports.wrapError = exports.TimeoutError = exports.SecurityError = exports.RateLimitError = exports.PluginError = exports.ChannelError = exports.ConfigError = exports.ValidationError = exports.ProviderError = exports.OPCError = exports.createTeacherConfig = exports.createDataAnalystConfig = exports.getSupportedLocales = exports.LLMCache = exports.RateLimiter = exports.AnalyticsEngine = exports.formatReport = exports.loadTestCases = exports.runTests = exports.DocumentSkill = exports.SchedulerSkill = exports.WebhookTriggerSkill = exports.HttpSkill = exports.TextAnalysisTool = exports.JsonTransformTool = exports.DateTimeTool = exports.CalculatorTool = exports.WeChatChannel = exports.SlackChannel = void 0;
3
+ exports.JsonTransformTool = exports.DateTimeTool = exports.CalculatorTool = exports.WeChatChannel = exports.SlackChannel = exports.EmailChannel = exports.compose = exports.AgentPipeline = exports.Orchestrator = exports.getActiveSessions = exports.createAuthMiddleware = exports.deployToHermes = exports.KnowledgeBase = exports.addMessages = exports.detectLocale = exports.getLocale = exports.setLocale = exports.t = exports.LazyLoader = exports.RequestBatcher = exports.ConnectionPool = exports.VersionManager = exports.WebhookChannel = exports.VoiceChannel = exports.HITLManager = exports.AgentRegistry = exports.WorkflowEngine = exports.Analytics = exports.Sandbox = exports.PluginManager = exports.createMCPTool = exports.MCPToolRegistry = exports.Room = exports.SUPPORTED_PROVIDERS = exports.createProvider = exports.DeepBrainMemoryStore = exports.InMemoryStore = exports.SkillRegistry = exports.BaseSkill = exports.WebSocketChannel = exports.TelegramChannel = exports.WebChannel = exports.BaseChannel = exports.OADSchema = exports.validateOAD = exports.loadOAD = exports.Logger = exports.truncateOutput = exports.AgentRuntime = exports.BaseAgent = void 0;
4
+ exports.DeepBrainExporter = exports.ConsoleExporter = exports.TraceCollector = exports.StreamableResponse = exports.StreamingManager = exports.ToolGateway = exports.ProcessWatcher = exports.DiscordChannel = exports.FeishuChannel = exports.createRateLimitPlugin = exports.createAnalyticsPlugin = exports.createLoggingPlugin = exports.inputValidation = exports.APIKeyManager = exports.corsMiddleware = exports.securityHeaders = exports.detectInjection = exports.sanitizeInput = exports.formatErrorForUser = exports.wrapError = exports.TimeoutError = exports.SecurityError = exports.RateLimitError = exports.PluginError = exports.ChannelError = exports.ConfigError = exports.ValidationError = exports.ProviderError = exports.OPCError = exports.createTeacherConfig = exports.createDataAnalystConfig = exports.getSupportedLocales = exports.LLMCache = exports.RateLimiter = exports.AnalyticsEngine = exports.formatReport = exports.loadTestCases = exports.runTests = exports.DocumentSkill = exports.SchedulerSkill = exports.WebhookTriggerSkill = exports.HttpSkill = exports.TextAnalysisTool = void 0;
5
5
  // OPC Agent — Open Agent Framework
6
6
  var agent_1 = require("./core/agent");
7
7
  Object.defineProperty(exports, "BaseAgent", { enumerable: true, get: function () { return agent_1.BaseAgent; } });
@@ -31,12 +31,6 @@ var memory_1 = require("./memory");
31
31
  Object.defineProperty(exports, "InMemoryStore", { enumerable: true, get: function () { return memory_1.InMemoryStore; } });
32
32
  var deepbrain_1 = require("./memory/deepbrain");
33
33
  Object.defineProperty(exports, "DeepBrainMemoryStore", { enumerable: true, get: function () { return deepbrain_1.DeepBrainMemoryStore; } });
34
- var trust_1 = require("./dtv/trust");
35
- Object.defineProperty(exports, "TrustManager", { enumerable: true, get: function () { return trust_1.TrustManager; } });
36
- var value_1 = require("./dtv/value");
37
- Object.defineProperty(exports, "ValueTracker", { enumerable: true, get: function () { return value_1.ValueTracker; } });
38
- var data_1 = require("./dtv/data");
39
- Object.defineProperty(exports, "MRGConfigReader", { enumerable: true, get: function () { return data_1.MRGConfigReader; } });
40
34
  var providers_1 = require("./providers");
41
35
  Object.defineProperty(exports, "createProvider", { enumerable: true, get: function () { return providers_1.createProvider; } });
42
36
  Object.defineProperty(exports, "SUPPORTED_PROVIDERS", { enumerable: true, get: function () { return providers_1.SUPPORTED_PROVIDERS; } });
@@ -80,9 +74,6 @@ var knowledge_1 = require("./core/knowledge");
80
74
  Object.defineProperty(exports, "KnowledgeBase", { enumerable: true, get: function () { return knowledge_1.KnowledgeBase; } });
81
75
  var hermes_1 = require("./deploy/hermes");
82
76
  Object.defineProperty(exports, "deployToHermes", { enumerable: true, get: function () { return hermes_1.deployToHermes; } });
83
- var marketplace_1 = require("./marketplace");
84
- Object.defineProperty(exports, "publishAgent", { enumerable: true, get: function () { return marketplace_1.publishAgent; } });
85
- Object.defineProperty(exports, "installAgent", { enumerable: true, get: function () { return marketplace_1.installAgent; } });
86
77
  // v0.7.0 modules
87
78
  var auth_1 = require("./core/auth");
88
79
  Object.defineProperty(exports, "createAuthMiddleware", { enumerable: true, get: function () { return auth_1.createAuthMiddleware; } });
@@ -163,4 +154,15 @@ var discord_1 = require("./channels/discord");
163
154
  Object.defineProperty(exports, "DiscordChannel", { enumerable: true, get: function () { return discord_1.DiscordChannel; } });
164
155
  var watch_1 = require("./core/watch");
165
156
  Object.defineProperty(exports, "ProcessWatcher", { enumerable: true, get: function () { return watch_1.ProcessWatcher; } });
157
+ // v1.2.0 modules
158
+ var gateway_1 = require("./tools/gateway");
159
+ Object.defineProperty(exports, "ToolGateway", { enumerable: true, get: function () { return gateway_1.ToolGateway; } });
160
+ var streaming_1 = require("./core/streaming");
161
+ Object.defineProperty(exports, "StreamingManager", { enumerable: true, get: function () { return streaming_1.StreamingManager; } });
162
+ Object.defineProperty(exports, "StreamableResponse", { enumerable: true, get: function () { return streaming_1.StreamableResponse; } });
163
+ // v1.3.0 modules
164
+ var traces_1 = require("./traces");
165
+ Object.defineProperty(exports, "TraceCollector", { enumerable: true, get: function () { return traces_1.TraceCollector; } });
166
+ Object.defineProperty(exports, "ConsoleExporter", { enumerable: true, get: function () { return traces_1.ConsoleExporter; } });
167
+ Object.defineProperty(exports, "DeepBrainExporter", { enumerable: true, get: function () { return traces_1.DeepBrainExporter; } });
166
168
  //# sourceMappingURL=index.js.map
@@ -1266,6 +1266,5 @@ export type SkillRef = z.infer<typeof SkillRefSchema>;
1266
1266
  export type Channel = z.infer<typeof ChannelSchema>;
1267
1267
  export type Metadata = z.infer<typeof MetadataSchema>;
1268
1268
  export type Spec = z.infer<typeof SpecSchema>;
1269
- export type DTVConfig = z.infer<typeof DTVSchema>;
1270
- export type TrustLevelType = z.infer<typeof TrustLevel>;
1269
+ export type TrustLevelType = string;
1271
1270
  //# sourceMappingURL=oad.d.ts.map
@@ -28,14 +28,6 @@ export declare function createCodeReviewerConfig(): {
28
28
  shortTerm: boolean;
29
29
  longTerm: boolean;
30
30
  };
31
- dtv: {
32
- trust: {
33
- level: "sandbox";
34
- };
35
- value: {
36
- metrics: string[];
37
- };
38
- };
39
31
  };
40
32
  };
41
33
  //# sourceMappingURL=code-reviewer.d.ts.map
@@ -28,10 +28,6 @@ function createCodeReviewerConfig() {
28
28
  ],
29
29
  channels: [{ type: 'web', port: 3000 }],
30
30
  memory: { shortTerm: true, longTerm: false },
31
- dtv: {
32
- trust: { level: 'sandbox' },
33
- value: { metrics: ['reviews_completed', 'issues_found'] },
34
- },
35
31
  },
36
32
  };
37
33
  }
@@ -43,14 +43,6 @@ export declare function createCustomerServiceConfig(): {
43
43
  shortTerm: boolean;
44
44
  longTerm: boolean;
45
45
  };
46
- dtv: {
47
- trust: {
48
- level: "sandbox";
49
- };
50
- value: {
51
- metrics: string[];
52
- };
53
- };
54
46
  };
55
47
  };
56
48
  //# sourceMappingURL=customer-service.d.ts.map
@@ -65,10 +65,6 @@ function createCustomerServiceConfig() {
65
65
  ],
66
66
  channels: [{ type: 'web', port: 3000 }],
67
67
  memory: { shortTerm: true, longTerm: false },
68
- dtv: {
69
- trust: { level: 'sandbox' },
70
- value: { metrics: ['response_time', 'satisfaction_score'] },
71
- },
72
68
  },
73
69
  };
74
70
  }
@@ -40,14 +40,6 @@ export declare function createDataAnalystConfig(): {
40
40
  shortTerm: boolean;
41
41
  longTerm: boolean;
42
42
  };
43
- dtv: {
44
- trust: {
45
- level: "sandbox";
46
- };
47
- value: {
48
- metrics: string[];
49
- };
50
- };
51
43
  };
52
44
  };
53
45
  //# sourceMappingURL=data-analyst.d.ts.map
@@ -60,10 +60,6 @@ function createDataAnalystConfig() {
60
60
  ],
61
61
  channels: [{ type: 'web', port: 3000 }],
62
62
  memory: { shortTerm: true, longTerm: true },
63
- dtv: {
64
- trust: { level: 'sandbox' },
65
- value: { metrics: ['queries_processed', 'insights_generated'] },
66
- },
67
63
  },
68
64
  };
69
65
  }
@@ -31,14 +31,6 @@ export declare function createKnowledgeBaseConfig(): {
31
31
  collection: string;
32
32
  };
33
33
  };
34
- dtv: {
35
- trust: {
36
- level: "sandbox";
37
- };
38
- value: {
39
- metrics: string[];
40
- };
41
- };
42
34
  };
43
35
  };
44
36
  //# sourceMappingURL=knowledge-base.d.ts.map
@@ -25,10 +25,6 @@ function createKnowledgeBaseConfig() {
25
25
  ],
26
26
  channels: [{ type: 'web', port: 3000 }],
27
27
  memory: { shortTerm: true, longTerm: { provider: 'deepbrain', collection: 'company-knowledge' } },
28
- dtv: {
29
- trust: { level: 'sandbox' },
30
- value: { metrics: ['queries_answered', 'docs_indexed'] },
31
- },
32
28
  },
33
29
  };
34
30
  }
@@ -43,14 +43,6 @@ export declare function createSalesAssistantConfig(): {
43
43
  shortTerm: boolean;
44
44
  longTerm: boolean;
45
45
  };
46
- dtv: {
47
- trust: {
48
- level: "sandbox";
49
- };
50
- value: {
51
- metrics: string[];
52
- };
53
- };
54
46
  };
55
47
  };
56
48
  //# sourceMappingURL=sales-assistant.d.ts.map
@@ -69,10 +69,6 @@ function createSalesAssistantConfig() {
69
69
  ],
70
70
  channels: [{ type: 'web', port: 3000 }],
71
71
  memory: { shortTerm: true, longTerm: false },
72
- dtv: {
73
- trust: { level: 'sandbox' },
74
- value: { metrics: ['leads_captured', 'appointments_booked'] },
75
- },
76
72
  },
77
73
  };
78
74
  }
@@ -45,14 +45,6 @@ export declare function createTeacherConfig(): {
45
45
  shortTerm: boolean;
46
46
  longTerm: boolean;
47
47
  };
48
- dtv: {
49
- trust: {
50
- level: "sandbox";
51
- };
52
- value: {
53
- metrics: string[];
54
- };
55
- };
56
48
  };
57
49
  };
58
50
  //# sourceMappingURL=teacher.d.ts.map
@@ -68,10 +68,6 @@ function createTeacherConfig() {
68
68
  ],
69
69
  channels: [{ type: 'web', port: 3000 }],
70
70
  memory: { shortTerm: true, longTerm: true },
71
- dtv: {
72
- trust: { level: 'sandbox' },
73
- value: { metrics: ['lessons_created', 'quizzes_generated', 'concepts_explained'] },
74
- },
75
71
  },
76
72
  };
77
73
  }
@@ -0,0 +1,28 @@
1
+ import type { MCPTool, MCPToolDefinition, MCPToolResult } from './mcp';
2
+ export interface ToolGatewayConfig {
3
+ enabled: boolean;
4
+ endpoint: string;
5
+ apiKey: string;
6
+ enabledTools?: GatewayToolName[];
7
+ timeout?: number;
8
+ }
9
+ export type GatewayToolName = 'web-search' | 'image-gen' | 'tts' | 'browser';
10
+ export declare class ToolGateway {
11
+ private config;
12
+ private availableTools;
13
+ private connected;
14
+ constructor(config: ToolGatewayConfig);
15
+ /** Discover available tools from the gateway endpoint. */
16
+ connect(): Promise<void>;
17
+ /** Load default tool definitions (used as fallback). */
18
+ private loadDefaults;
19
+ /** Invoke a tool through the gateway. */
20
+ invokeTool(name: GatewayToolName, input: Record<string, unknown>): Promise<MCPToolResult>;
21
+ /** Get all gateway tools as MCPTool instances for registry integration. */
22
+ getTools(): MCPTool[];
23
+ /** Get tool definitions (without execute). */
24
+ listTools(): MCPToolDefinition[];
25
+ get isConnected(): boolean;
26
+ get toolCount(): number;
27
+ }
28
+ //# sourceMappingURL=gateway.d.ts.map
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ToolGateway = void 0;
4
+ // ─── Gateway Tool Wrapper ────────────────────────────────────
5
+ class GatewayTool {
6
+ gateway;
7
+ meta;
8
+ name;
9
+ description;
10
+ inputSchema;
11
+ constructor(gateway, meta) {
12
+ this.gateway = gateway;
13
+ this.meta = meta;
14
+ this.name = `gateway:${meta.name}`;
15
+ this.description = `[Gateway] ${meta.description}`;
16
+ this.inputSchema = meta.inputSchema;
17
+ }
18
+ async execute(input, _context) {
19
+ return this.gateway.invokeTool(this.meta.name, input);
20
+ }
21
+ }
22
+ // ─── Default Tool Definitions ────────────────────────────────
23
+ const DEFAULT_TOOL_DEFS = [
24
+ {
25
+ name: 'web-search',
26
+ description: 'Search the web and return results',
27
+ inputSchema: {
28
+ type: 'object',
29
+ properties: {
30
+ query: { type: 'string', description: 'Search query' },
31
+ count: { type: 'number', description: 'Number of results (1-10)' },
32
+ },
33
+ required: ['query'],
34
+ },
35
+ available: true,
36
+ },
37
+ {
38
+ name: 'image-gen',
39
+ description: 'Generate images from text prompts',
40
+ inputSchema: {
41
+ type: 'object',
42
+ properties: {
43
+ prompt: { type: 'string', description: 'Image generation prompt' },
44
+ size: { type: 'string', description: 'Image size (e.g. 1024x1024)' },
45
+ },
46
+ required: ['prompt'],
47
+ },
48
+ available: true,
49
+ },
50
+ {
51
+ name: 'tts',
52
+ description: 'Convert text to speech audio',
53
+ inputSchema: {
54
+ type: 'object',
55
+ properties: {
56
+ text: { type: 'string', description: 'Text to synthesize' },
57
+ voice: { type: 'string', description: 'Voice identifier' },
58
+ },
59
+ required: ['text'],
60
+ },
61
+ available: true,
62
+ },
63
+ {
64
+ name: 'browser',
65
+ description: 'Automated browser actions — navigate, screenshot, extract content',
66
+ inputSchema: {
67
+ type: 'object',
68
+ properties: {
69
+ action: { type: 'string', description: 'Action: navigate | screenshot | extract' },
70
+ url: { type: 'string', description: 'Target URL' },
71
+ selector: { type: 'string', description: 'CSS selector for extraction' },
72
+ },
73
+ required: ['action', 'url'],
74
+ },
75
+ available: true,
76
+ },
77
+ ];
78
+ // ─── ToolGateway ─────────────────────────────────────────────
79
+ class ToolGateway {
80
+ config;
81
+ availableTools = new Map();
82
+ connected = false;
83
+ constructor(config) {
84
+ this.config = {
85
+ timeout: 30_000,
86
+ ...config,
87
+ };
88
+ }
89
+ /** Discover available tools from the gateway endpoint. */
90
+ async connect() {
91
+ if (!this.config.enabled)
92
+ return;
93
+ try {
94
+ const res = await fetch(`${this.config.endpoint}/tools`, {
95
+ headers: { Authorization: `Bearer ${this.config.apiKey}` },
96
+ signal: AbortSignal.timeout(this.config.timeout),
97
+ });
98
+ if (!res.ok) {
99
+ throw new Error(`Gateway returned ${res.status}`);
100
+ }
101
+ const data = (await res.json());
102
+ const enabledSet = this.config.enabledTools
103
+ ? new Set(this.config.enabledTools)
104
+ : null;
105
+ for (const tool of data.tools) {
106
+ if (!enabledSet || enabledSet.has(tool.name)) {
107
+ this.availableTools.set(tool.name, tool);
108
+ }
109
+ }
110
+ this.connected = true;
111
+ }
112
+ catch {
113
+ // Auto-detect failed — fall back to default definitions
114
+ this.loadDefaults();
115
+ this.connected = false;
116
+ }
117
+ }
118
+ /** Load default tool definitions (used as fallback). */
119
+ loadDefaults() {
120
+ const enabledSet = this.config.enabledTools
121
+ ? new Set(this.config.enabledTools)
122
+ : null;
123
+ for (const def of DEFAULT_TOOL_DEFS) {
124
+ if (!enabledSet || enabledSet.has(def.name)) {
125
+ this.availableTools.set(def.name, def);
126
+ }
127
+ }
128
+ }
129
+ /** Invoke a tool through the gateway. */
130
+ async invokeTool(name, input) {
131
+ try {
132
+ const res = await fetch(`${this.config.endpoint}/tools/${name}/invoke`, {
133
+ method: 'POST',
134
+ headers: {
135
+ 'Content-Type': 'application/json',
136
+ Authorization: `Bearer ${this.config.apiKey}`,
137
+ },
138
+ body: JSON.stringify({ input }),
139
+ signal: AbortSignal.timeout(this.config.timeout),
140
+ });
141
+ if (!res.ok) {
142
+ return { content: `Gateway error: HTTP ${res.status}`, isError: true };
143
+ }
144
+ const data = (await res.json());
145
+ if (data.error) {
146
+ return { content: data.error, isError: true, metadata: data.metadata };
147
+ }
148
+ return { content: data.content, metadata: data.metadata };
149
+ }
150
+ catch (err) {
151
+ return {
152
+ content: `Gateway invocation failed: ${err instanceof Error ? err.message : String(err)}`,
153
+ isError: true,
154
+ };
155
+ }
156
+ }
157
+ /** Get all gateway tools as MCPTool instances for registry integration. */
158
+ getTools() {
159
+ return Array.from(this.availableTools.values()).map((meta) => new GatewayTool(this, meta));
160
+ }
161
+ /** Get tool definitions (without execute). */
162
+ listTools() {
163
+ return Array.from(this.availableTools.values()).map(({ name, description, inputSchema }) => ({
164
+ name: `gateway:${name}`,
165
+ description: `[Gateway] ${description}`,
166
+ inputSchema,
167
+ }));
168
+ }
169
+ get isConnected() {
170
+ return this.connected;
171
+ }
172
+ get toolCount() {
173
+ return this.availableTools.size;
174
+ }
175
+ }
176
+ exports.ToolGateway = ToolGateway;
177
+ //# sourceMappingURL=gateway.js.map
@@ -0,0 +1,49 @@
1
+ /**
2
+ * OPC Agent Traces — Structured logging for agent actions.
3
+ *
4
+ * Collects traces that can be fed to DeepBrain's learn() API.
5
+ * Inspired by OpenTelemetry spans.
6
+ */
7
+ export interface Span {
8
+ traceId: string;
9
+ spanId: string;
10
+ name: string;
11
+ startTime: Date;
12
+ endTime?: Date;
13
+ attributes: Record<string, string | number | boolean>;
14
+ events: SpanEvent[];
15
+ status: 'ok' | 'error' | 'unset';
16
+ }
17
+ export interface SpanEvent {
18
+ name: string;
19
+ timestamp: Date;
20
+ attributes?: Record<string, string | number | boolean>;
21
+ }
22
+ export interface TraceExporter {
23
+ export(spans: Span[]): Promise<void>;
24
+ }
25
+ /** In-memory buffer that holds spans until flushed */
26
+ export declare class TraceCollector {
27
+ private spans;
28
+ private exporters;
29
+ private maxBufferSize;
30
+ constructor(maxBufferSize?: number);
31
+ addExporter(exporter: TraceExporter): void;
32
+ startSpan(name: string, attributes?: Record<string, string | number | boolean>): Span;
33
+ endSpan(span: Span, status?: 'ok' | 'error'): void;
34
+ addEvent(span: Span, name: string, attributes?: Record<string, string | number | boolean>): void;
35
+ flush(): Promise<number>;
36
+ getBufferedSpans(): readonly Span[];
37
+ get bufferedCount(): number;
38
+ }
39
+ /** Console exporter for development */
40
+ export declare class ConsoleExporter implements TraceExporter {
41
+ export(spans: Span[]): Promise<void>;
42
+ }
43
+ /** DeepBrain exporter — sends traces to DeepBrain learn() */
44
+ export declare class DeepBrainExporter implements TraceExporter {
45
+ private learnEndpoint;
46
+ constructor(deepbrainUrl?: string);
47
+ export(spans: Span[]): Promise<void>;
48
+ }
49
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ /**
3
+ * OPC Agent Traces — Structured logging for agent actions.
4
+ *
5
+ * Collects traces that can be fed to DeepBrain's learn() API.
6
+ * Inspired by OpenTelemetry spans.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.DeepBrainExporter = exports.ConsoleExporter = exports.TraceCollector = void 0;
10
+ /** In-memory buffer that holds spans until flushed */
11
+ class TraceCollector {
12
+ spans = [];
13
+ exporters = [];
14
+ maxBufferSize;
15
+ constructor(maxBufferSize = 100) {
16
+ this.maxBufferSize = maxBufferSize;
17
+ }
18
+ addExporter(exporter) {
19
+ this.exporters.push(exporter);
20
+ }
21
+ startSpan(name, attributes = {}) {
22
+ const span = {
23
+ traceId: crypto.randomUUID(),
24
+ spanId: crypto.randomUUID().slice(0, 16),
25
+ name,
26
+ startTime: new Date(),
27
+ attributes,
28
+ events: [],
29
+ status: 'unset',
30
+ };
31
+ this.spans.push(span);
32
+ if (this.spans.length >= this.maxBufferSize) {
33
+ this.flush().catch(() => { }); // Best effort
34
+ }
35
+ return span;
36
+ }
37
+ endSpan(span, status = 'ok') {
38
+ span.endTime = new Date();
39
+ span.status = status;
40
+ }
41
+ addEvent(span, name, attributes) {
42
+ span.events.push({ name, timestamp: new Date(), attributes });
43
+ }
44
+ async flush() {
45
+ const toExport = [...this.spans];
46
+ this.spans = [];
47
+ for (const exporter of this.exporters) {
48
+ await exporter.export(toExport);
49
+ }
50
+ return toExport.length;
51
+ }
52
+ getBufferedSpans() {
53
+ return this.spans;
54
+ }
55
+ get bufferedCount() {
56
+ return this.spans.length;
57
+ }
58
+ }
59
+ exports.TraceCollector = TraceCollector;
60
+ /** Console exporter for development */
61
+ class ConsoleExporter {
62
+ async export(spans) {
63
+ for (const span of spans) {
64
+ const duration = span.endTime
65
+ ? `${span.endTime.getTime() - span.startTime.getTime()}ms`
66
+ : 'ongoing';
67
+ console.log(`[TRACE] ${span.name} (${duration}) [${span.status}]`);
68
+ }
69
+ }
70
+ }
71
+ exports.ConsoleExporter = ConsoleExporter;
72
+ /** DeepBrain exporter — sends traces to DeepBrain learn() */
73
+ class DeepBrainExporter {
74
+ learnEndpoint;
75
+ constructor(deepbrainUrl = 'http://localhost:3333') {
76
+ this.learnEndpoint = `${deepbrainUrl}/api/learn`;
77
+ }
78
+ async export(spans) {
79
+ for (const span of spans) {
80
+ try {
81
+ await fetch(this.learnEndpoint, {
82
+ method: 'POST',
83
+ headers: { 'Content-Type': 'application/json' },
84
+ body: JSON.stringify({
85
+ action: span.name,
86
+ result: span.status === 'ok' ? 'success' : 'error',
87
+ context: {
88
+ ...span.attributes,
89
+ duration: span.endTime ? span.endTime.getTime() - span.startTime.getTime() : null,
90
+ events: span.events.map(e => e.name),
91
+ },
92
+ }),
93
+ });
94
+ }
95
+ catch {
96
+ // Best effort — don't break agent if brain is down
97
+ }
98
+ }
99
+ }
100
+ }
101
+ exports.DeepBrainExporter = DeepBrainExporter;
102
+ //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "opc-agent",
3
- "version": "1.3.0",
4
- "description": "Open Agent Framework — Build, test, and run AI Agents for business workstations",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "bin": {
8
- "opc": "dist/cli.js"
9
- },
10
- "scripts": {
11
- "build": "tsc",
12
- "test": "vitest run",
13
- "dev": "tsc --watch",
14
- "lint": "tsc --noEmit",
15
- "docs:dev": "vitepress dev docs",
16
- "docs:build": "vitepress build docs",
17
- "docs:preview": "vitepress preview docs"
18
- },
19
- "keywords": [
20
- "agent",
21
- "ai",
22
- "llm",
23
- "framework",
24
- "typescript",
25
- "agent-framework"
26
- ],
27
- "author": "Deepleaper",
28
- "license": "Apache-2.0",
29
- "repository": {
30
- "type": "git",
31
- "url": "https://github.com/Deepleaper/opc-agent.git"
32
- },
33
- "dependencies": {
34
- "agentkits": "^0.1.0",
35
- "commander": "^12.0.0",
36
- "express": "^4.21.0",
37
- "js-yaml": "^4.1.0",
38
- "ws": "^8.20.0",
39
- "zod": "^3.23.0"
40
- },
41
- "devDependencies": {
42
- "@types/express": "^4.17.21",
43
- "@types/js-yaml": "^4.0.9",
44
- "@types/node": "^20.11.0",
45
- "@types/ws": "^8.18.1",
46
- "typescript": "^5.5.0",
47
- "vitest": "^2.0.0",
48
- "vitepress": "^1.5.0"
49
- }
50
- }
1
+ {
2
+ "name": "opc-agent",
3
+ "version": "1.3.1",
4
+ "description": "Open Agent Framework — Build, test, and run AI Agents for business workstations",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "bin": {
8
+ "opc": "dist/cli.js"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "test": "vitest run",
13
+ "dev": "tsc --watch",
14
+ "lint": "tsc --noEmit",
15
+ "docs:dev": "vitepress dev docs",
16
+ "docs:build": "vitepress build docs",
17
+ "docs:preview": "vitepress preview docs"
18
+ },
19
+ "keywords": [
20
+ "agent",
21
+ "ai",
22
+ "llm",
23
+ "framework",
24
+ "typescript",
25
+ "agent-framework"
26
+ ],
27
+ "author": "Deepleaper",
28
+ "license": "Apache-2.0",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/Deepleaper/opc-agent.git"
32
+ },
33
+ "dependencies": {
34
+ "agentkits": "^0.1.0",
35
+ "commander": "^12.0.0",
36
+ "express": "^4.21.0",
37
+ "js-yaml": "^4.1.0",
38
+ "ws": "^8.20.0",
39
+ "zod": "^3.23.0"
40
+ },
41
+ "devDependencies": {
42
+ "@types/express": "^4.17.21",
43
+ "@types/js-yaml": "^4.0.9",
44
+ "@types/node": "^20.11.0",
45
+ "@types/ws": "^8.18.1",
46
+ "typescript": "^5.5.0",
47
+ "vitest": "^2.0.0",
48
+ "vitepress": "^1.5.0"
49
+ }
50
+ }
package/src/cli.ts CHANGED
@@ -721,7 +721,7 @@ kbCmd.command('clear').action(() => {
721
721
  console.log(`${icon.success} Knowledge base cleared.`);
722
722
  });
723
723
 
724
- // 📦 Marketplace commands ───────────────────────────────────
724
+ // 📦 Package commands ───────────────────────────────────
725
725
 
726
726
  program
727
727
  .command('publish')
@@ -729,23 +729,8 @@ program
729
729
  .option('-f, --file <file>', 'OAD file', 'oad.yaml')
730
730
  .option('-o, --output <dir>', 'Output directory', '.')
731
731
  .option('--include-kb', 'Include knowledge base')
732
- .action(async (opts: { file: string; output: string; includeKb?: boolean }) => {
733
- try {
734
- console.log(`\n${icon.package} Packaging agent...\n`);
735
- const result = await publishAgent({
736
- oadPath: opts.file,
737
- outputDir: opts.output,
738
- includeKnowledge: opts.includeKb,
739
- });
740
- console.log(`${icon.success} Published: ${color.bold(result.archivePath)}`);
741
- console.log(` Name: ${result.manifest.name}`);
742
- console.log(` Version: ${result.manifest.version}`);
743
- console.log(` Files: ${result.manifest.files.length}`);
744
- console.log();
745
- } catch (err) {
746
- console.error(`${icon.error} Publish failed:`, err instanceof Error ? err.message : err);
747
- process.exit(1);
748
- }
732
+ .action(async () => {
733
+ console.log(`\n${icon.package} Agent packaging coming soon.\n`);
749
734
  });
750
735
 
751
736
  program
@@ -753,19 +738,8 @@ program
753
738
  .description('Install agent from package')
754
739
  .argument('<source>', 'Package file path or URL')
755
740
  .option('-d, --dir <dir>', 'Install directory')
756
- .action(async (source: string, opts: { dir?: string }) => {
757
- try {
758
- console.log(`\n${icon.package} Installing agent from ${color.bold(source)}...\n`);
759
- const result = await installAgent({ source, targetDir: opts.dir });
760
- console.log(`${icon.success} Installed: ${color.bold(result.manifest.name)} v${result.manifest.version}`);
761
- console.log(` Directory: ${result.dir}`);
762
- console.log(`\n${color.bold('Next steps:')}`);
763
- console.log(` cd ${result.dir}`);
764
- console.log(` opc run\n`);
765
- } catch (err) {
766
- console.error(`${icon.error} Install failed:`, err instanceof Error ? err.message : err);
767
- process.exit(1);
768
- }
741
+ .action(async () => {
742
+ console.log(`\n${icon.package} Agent install coming soon.\n`);
769
743
  });
770
744
 
771
745
  // 🔌 Plugin commands ────────────────────────────────────────
@@ -188,13 +188,3 @@ export function deployToOpenClaw(options: DeployOptions): DeployResult {
188
188
 
189
189
  return result;
190
190
  }
191
- :`, err);
192
- }
193
- } else {
194
- console.error(`Warning: OpenClaw config not found at ${configPath}`);
195
- console.error(`Run 'openclaw init' first, then re-run with --install`);
196
- }
197
- }
198
-
199
- return result;
200
- }
package/src/index.ts CHANGED
@@ -4,7 +4,7 @@ export { AgentRuntime, truncateOutput } from './core/runtime';
4
4
  export { Logger } from './core/logger';
5
5
  export { loadOAD, validateOAD } from './core/config';
6
6
  export { OADSchema } from './schema/oad';
7
- export type { OADDocument, Metadata, Spec, DTVConfig, TrustLevelType } from './schema/oad';
7
+ export type { OADDocument, Metadata, Spec } from './schema/oad';
8
8
  export type { IAgent, IChannel, ISkill, Message, AgentContext, SkillResult, MemoryStore, AgentState } from './core/types';
9
9
  export { BaseChannel } from './channels';
10
10
  export { WebChannel } from './channels/web';
@@ -14,9 +14,6 @@ export { BaseSkill } from './skills/base';
14
14
  export { SkillRegistry } from './skills';
15
15
  export { InMemoryStore } from './memory';
16
16
  export { DeepBrainMemoryStore } from './memory/deepbrain';
17
- export { TrustManager } from './dtv/trust';
18
- export { ValueTracker } from './dtv/value';
19
- export { MRGConfigReader } from './dtv/data';
20
17
  export { createProvider, SUPPORTED_PROVIDERS } from './providers';
21
18
 
22
19
  // v0.3.0 new modules
@@ -106,8 +103,6 @@ export { DiscordChannel } from './channels/discord';
106
103
  export type { DiscordChannelConfig } from './channels/discord';
107
104
  export { ProcessWatcher } from './core/watch';
108
105
  export type { WatchPattern, WatchMatch, WatchOptions } from './core/watch';
109
- export { ProcessWatcher } from './core/watch';
110
- export type { WatchPattern, WatchMatch, WatchOptions } from './core/watch';
111
106
 
112
107
  // v1.2.0 modules
113
108
  export { ToolGateway } from './tools/gateway';