@bluefly/openstandardagents 0.5.0 → 0.5.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.
- package/.version.json +3 -3
- package/CHANGELOG.md +43 -12
- package/README.md +31 -26
- package/bin/postinstall +0 -0
- package/dist/.version.json +3 -3
- package/dist/adapters/a2a/a2a-protocol.js +4 -2
- package/dist/adapters/a2a/a2a-tool.js +4 -2
- package/dist/adapters/a2a/mcp-integration.d.ts +2 -1
- package/dist/adapters/a2a/mcp-integration.js +6 -3
- package/dist/adapters/browser/browser-exporter.d.ts +26 -0
- package/dist/adapters/browser/browser-exporter.js +73 -0
- package/dist/adapters/browser/browser-runner.d.ts +23 -0
- package/dist/adapters/browser/browser-runner.js +46 -0
- package/dist/adapters/browser/index.d.ts +9 -0
- package/dist/adapters/browser/index.js +9 -0
- package/dist/adapters/docker/index.d.ts +2 -0
- package/dist/adapters/docker/index.js +2 -0
- package/dist/adapters/docker/openclaw-bridge.d.ts +57 -0
- package/dist/adapters/docker/openclaw-bridge.js +173 -0
- package/dist/adapters/drupal/index.d.ts +1 -0
- package/dist/adapters/drupal/index.js +2 -0
- package/dist/adapters/drupal/twig-renderer.d.ts +23 -0
- package/dist/adapters/drupal/twig-renderer.js +99 -0
- package/dist/adapters/gitlab/agent-generator.js +2 -1
- package/dist/api/index.js +2 -1
- package/dist/api/routes/mcp.router.js +3 -1
- package/dist/api/routes/wizard.router.js +3 -1
- package/dist/cli/commands/agent/discover-type.command.js +1 -1
- package/dist/cli/commands/agent-card.command.js +37 -10
- package/dist/cli/commands/agents-sync.command.d.ts +2 -2
- package/dist/cli/commands/agents-sync.command.js +27 -17
- package/dist/cli/commands/catalog/config.js +1 -1
- package/dist/cli/commands/catalog/validate.command.js +2 -2
- package/dist/cli/commands/config.command.js +2 -2
- package/dist/cli/commands/daemon.command.js +32 -8
- package/dist/cli/commands/discover.d.ts +1 -1
- package/dist/cli/commands/discover.js +16 -8
- package/dist/cli/commands/economics.command.d.ts +9 -0
- package/dist/cli/commands/economics.command.js +113 -0
- package/dist/cli/commands/export.command.js +6 -3
- package/dist/cli/commands/mcp.command.js +3 -1
- package/dist/cli/commands/memory.command.d.ts +18 -0
- package/dist/cli/commands/memory.command.js +168 -0
- package/dist/cli/commands/publish.command.js +7 -4
- package/dist/cli/commands/serve-builder-routes.js +1 -1
- package/dist/cli/commands/usie-skills.command.d.ts +24 -0
- package/dist/cli/commands/usie-skills.command.js +297 -0
- package/dist/cli/commands/validate.command.js +8 -1
- package/dist/cli/commands/verify.d.ts +3 -3
- package/dist/cli/commands/verify.js +12 -6
- package/dist/cli/commands/workspace.command.d.ts +1 -0
- package/dist/cli/commands/workspace.command.js +28 -4
- package/dist/cli/index.js +12 -0
- package/dist/cli/workspace-validate.d.ts +23 -0
- package/dist/cli/workspace-validate.js +117 -0
- package/dist/data/platform-matrix.js +1 -4
- package/dist/generated/types.d.ts +97 -97
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/mcp-server/index.js +658 -982
- package/dist/mesh/discovery-gkg.d.ts +26 -0
- package/dist/mesh/discovery-gkg.js +92 -0
- package/dist/messenger/Handler/AgentBatchHandler.js +3 -2
- package/dist/messenger/Handler/AgentExecutionHandler.js +6 -1
- package/dist/package.json +20 -4
- package/dist/sdks/shared/types.d.ts +1 -1
- package/dist/services/agent-card-generator.js +6 -2
- package/dist/services/daemon/audit-log.service.js +3 -1
- package/dist/services/daemon/execution.service.js +8 -4
- package/dist/services/daemon/fs-watcher.service.js +6 -7
- package/dist/services/daemon/pairing.service.js +2 -1
- package/dist/services/daemon/skill-aggregator.service.js +105 -21
- package/dist/services/daemon/sse-endpoints.js +1 -1
- package/dist/services/daemon/ws-server.js +10 -3
- package/dist/services/governance/cedar-provider.js +12 -8
- package/dist/services/governance/cedar-validator.service.js +1 -1
- package/dist/services/mcp/bridge.service.js +40 -9
- package/dist/services/openapi-extensions-validation.d.ts +20 -0
- package/dist/services/openapi-extensions-validation.js +193 -0
- package/dist/services/release-automation/merge-request.service.d.ts +4 -4
- package/dist/services/release-automation/release-buttons.js +3 -3
- package/dist/services/release-automation/schemas/release.schema.d.ts +3 -3
- package/dist/services/runtime/openai.adapter.d.ts +46 -13
- package/dist/services/runtime/openai.adapter.js +169 -131
- package/dist/services/skill-registry.service.d.ts +1 -1
- package/dist/services/skills-pipeline/skills-research.service.js +47 -7
- package/dist/services/trust/trust.service.js +6 -4
- package/dist/services/validation-zod.service.js +3 -22
- package/dist/services/validators/index.d.ts +1 -0
- package/dist/services/validators/index.js +1 -0
- package/dist/services/validators/registry.d.ts +21 -0
- package/dist/services/validators/registry.js +42 -0
- package/dist/skills/test-skill/package.json +1 -1
- package/dist/spec/extensions/cognition.schema.json +87 -0
- package/dist/spec/layer4-economics/duadp-examples.json +44 -0
- package/dist/spec/v0.4/agent.schema.json +14 -0
- package/dist/spec/v0.5/agent-builder-openapi.yaml +230 -0
- package/dist/spec/v0.5/agent.schema.json +32 -1
- package/dist/spec/v0.5/extensions/cognition/cognition.schema.json +78 -1
- package/dist/spec/v0.5/extensions/economics/context-pack.schema.json +91 -0
- package/dist/spec/v0.5/extensions/economics/execution-profile.schema.json +148 -0
- package/dist/spec/v0.5/extensions/economics/failure-semantics.schema.json +32 -0
- package/dist/spec/v0.5/extensions/economics/replay-packet.schema.json +120 -0
- package/dist/spec/v0.5/extensions/mcp/README.md +1 -1
- package/dist/spec/v0.5/memory-hierarchy.yaml +120 -0
- package/dist/spec/v1/agent-card.schema.json +254 -0
- package/dist/types/cognition.zod.d.ts +312 -0
- package/dist/types/cognition.zod.js +223 -0
- package/dist/types/identity.zod.d.ts +5 -5
- package/dist/types/index.d.ts +53 -7
- package/dist/types/index.js +4 -2
- package/dist/types/personality.zod.d.ts +3 -3
- package/dist/utils/http-client.d.ts +22 -0
- package/dist/utils/http-client.js +51 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/proxy-resolver.d.ts +36 -0
- package/dist/utils/proxy-resolver.js +59 -0
- package/dist/utils/user-agent.d.ts +11 -0
- package/dist/utils/user-agent.js +17 -0
- package/dist/validation/version-compliance.js +1 -1
- package/examples/agentscope/react-assistant/README.md +1 -1
- package/examples/agentscope/react-assistant/agent.ossa.yaml +1 -1
- package/examples/drupal/drupal-contributor-agent/.eslintrc.json +58 -0
- package/examples/drupal/drupal-contributor-agent/.prettierrc.json +10 -0
- package/examples/drupal/drupal-contributor-agent/package.json +55 -0
- package/examples/drupal/drupal-contributor-agent/src/core/index.ts +10 -0
- package/examples/drupal/drupal-contributor-agent/src/index.ts +17 -0
- package/examples/drupal/drupal-contributor-agent/src/types/index.ts +180 -0
- package/examples/drupal/drupal-contributor-agent/tsconfig.json +36 -0
- package/examples/getting-started/01-minimal-agent.ossa.yaml +1 -1
- package/examples/getting-started/02-agent-with-tools.ossa.yaml +1 -1
- package/examples/getting-started/03-agent-with-safety.ossa.yaml +1 -1
- package/examples/getting-started/04-agent-with-messaging.ossa.yaml +1 -1
- package/examples/getting-started/05-workflow-composition.ossa.yaml +1 -1
- package/examples/getting-started/hello-world-complete.ossa.yaml +1 -1
- package/examples/reference-implementations/python-client/examples/basic_usage.py +0 -0
- package/examples/reference-implementations/python-client/examples/publish_agent.py +0 -0
- package/openapi/agent-cognition-sessions.yaml +580 -0
- package/openapi/agent-crud.yaml +20 -20
- package/openapi/core/ossa-registry-api.openapi.yaml +1 -1
- package/openapi/ossa-cli-enhancements.openapi.yaml +1 -1
- package/openapi/release-automation.openapi.yaml +1 -1
- package/openapi/schemas/common/economics.yaml +98 -0
- package/openapi/uadp-asyncapi.yaml +1 -1
- package/openapi/uadp-openapi.yaml +2 -2
- package/package.json +114 -96
- package/spec/extensions/cognition.schema.json +87 -0
- package/spec/layer4-economics/duadp-examples.json +44 -0
- package/spec/v0.4/agent.schema.json +14 -0
- package/spec/v0.5/agent-builder-openapi.yaml +230 -0
- package/spec/v0.5/agent.schema.json +32 -1
- package/spec/v0.5/extensions/cognition/cognition.schema.json +78 -1
- package/spec/v0.5/extensions/economics/context-pack.schema.json +91 -0
- package/spec/v0.5/extensions/economics/execution-profile.schema.json +148 -0
- package/spec/v0.5/extensions/economics/failure-semantics.schema.json +32 -0
- package/spec/v0.5/extensions/economics/replay-packet.schema.json +120 -0
- package/spec/v0.5/extensions/mcp/README.md +1 -1
- package/spec/v0.5/memory-hierarchy.yaml +120 -0
- package/spec/v1/agent-card.schema.json +254 -0
- package/dist/adapters/a2a/__tests__/mcp-integration.spec.d.ts +0 -5
- package/dist/adapters/a2a/__tests__/mcp-integration.spec.js +0 -268
- package/dist/adapters/a2a/__tests__/mcp-transport.spec.d.ts +0 -5
- package/dist/adapters/a2a/__tests__/mcp-transport.spec.js +0 -203
- package/dist/mcp-server/__tests__/mcp-server.spec.d.ts +0 -8
- package/dist/mcp-server/__tests__/mcp-server.spec.js +0 -566
- package/dist/validation/__tests__/error-codes.test.d.ts +0 -5
- package/dist/validation/__tests__/error-codes.test.js +0 -252
- package/dist/version-management/core/version-manager.test.d.ts +0 -2
- package/dist/version-management/core/version-manager.test.js +0 -210
|
@@ -2,198 +2,236 @@
|
|
|
2
2
|
* OpenAI Runtime Adapter
|
|
3
3
|
* Runs OSSA agents using OpenAI's function calling API
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import * as crypto from 'crypto';
|
|
6
|
+
import { createOpenAI } from '@ai-sdk/openai';
|
|
7
|
+
import { ToolLoopAgent, stepCountIs } from 'ai';
|
|
8
|
+
import { z } from 'zod';
|
|
6
9
|
export class OpenAIAdapter {
|
|
7
|
-
client;
|
|
8
10
|
manifest;
|
|
9
11
|
tools = new Map();
|
|
10
12
|
messages = [];
|
|
13
|
+
apiKey;
|
|
11
14
|
constructor(manifest, apiKey) {
|
|
12
15
|
this.manifest = manifest;
|
|
13
|
-
this.
|
|
14
|
-
apiKey: apiKey || process.env.OPENAI_API_KEY,
|
|
15
|
-
});
|
|
16
|
+
this.apiKey = apiKey || process.env.OPENAI_API_KEY;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* Get the model to use from manifest
|
|
19
20
|
*/
|
|
20
|
-
|
|
21
|
-
// Check OpenAI extension first
|
|
21
|
+
getModelName() {
|
|
22
22
|
if (this.manifest.extensions?.openai_agents?.model) {
|
|
23
23
|
return this.manifest.extensions.openai_agents.model;
|
|
24
24
|
}
|
|
25
|
-
// Fall back to LLM config
|
|
26
25
|
if (this.manifest.spec.llm?.model) {
|
|
27
26
|
return this.manifest.spec.llm.model;
|
|
28
27
|
}
|
|
29
|
-
// Default
|
|
30
28
|
return 'gpt-4o-mini';
|
|
31
29
|
}
|
|
32
30
|
/**
|
|
33
31
|
* Get system prompt from manifest
|
|
34
32
|
*/
|
|
35
33
|
getSystemPrompt() {
|
|
36
|
-
// Check OpenAI extension first
|
|
37
34
|
if (this.manifest.extensions?.openai_agents?.instructions) {
|
|
38
35
|
return this.manifest.extensions.openai_agents.instructions;
|
|
39
36
|
}
|
|
40
|
-
// Fall back to role
|
|
41
37
|
return this.manifest.spec.role;
|
|
42
38
|
}
|
|
43
39
|
/**
|
|
44
|
-
*
|
|
40
|
+
* Register a tool handler
|
|
45
41
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// Check for tools_mapping in OpenAI extension
|
|
42
|
+
registerToolHandler(name, handler) {
|
|
43
|
+
// Basic tool mapping from manifest
|
|
49
44
|
const toolsMapping = this.manifest.extensions?.openai_agents?.tools_mapping;
|
|
50
45
|
if (toolsMapping) {
|
|
51
46
|
for (const mapping of toolsMapping) {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
properties: {},
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
openaiTools.push({
|
|
63
|
-
type: 'function',
|
|
64
|
-
function: {
|
|
65
|
-
name: toolDef.name,
|
|
66
|
-
description: toolDef.description,
|
|
67
|
-
parameters: toolDef.parameters,
|
|
68
|
-
},
|
|
69
|
-
});
|
|
47
|
+
const tName = mapping.openai_tool_name || mapping.ossa_capability;
|
|
48
|
+
if (tName === name) {
|
|
49
|
+
this.tools.set(name, {
|
|
50
|
+
name,
|
|
51
|
+
description: mapping.description || `Execute ${mapping.ossa_capability}`,
|
|
52
|
+
parameters: mapping.parameters || { type: 'object', properties: {} },
|
|
53
|
+
handler,
|
|
54
|
+
});
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
70
57
|
}
|
|
71
58
|
}
|
|
72
|
-
//
|
|
59
|
+
// Fallback for spec.tools
|
|
73
60
|
if (this.manifest.spec.tools) {
|
|
74
61
|
for (const tool of this.manifest.spec.tools) {
|
|
75
|
-
if (tool.name
|
|
76
|
-
|
|
77
|
-
name
|
|
62
|
+
if (tool.name === name) {
|
|
63
|
+
this.tools.set(name, {
|
|
64
|
+
name,
|
|
78
65
|
description: `Execute ${tool.name} (${tool.type})`,
|
|
79
|
-
parameters: {
|
|
80
|
-
|
|
81
|
-
properties: {},
|
|
82
|
-
required: [],
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
this.tools.set(tool.name, toolDef);
|
|
86
|
-
openaiTools.push({
|
|
87
|
-
type: 'function',
|
|
88
|
-
function: {
|
|
89
|
-
name: tool.name,
|
|
90
|
-
description: toolDef.description,
|
|
91
|
-
parameters: toolDef.parameters,
|
|
92
|
-
},
|
|
66
|
+
parameters: { type: 'object', properties: {} },
|
|
67
|
+
handler,
|
|
93
68
|
});
|
|
69
|
+
return;
|
|
94
70
|
}
|
|
95
71
|
}
|
|
96
72
|
}
|
|
97
|
-
return openaiTools;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Register a tool handler
|
|
101
|
-
*/
|
|
102
|
-
registerToolHandler(name, handler) {
|
|
103
|
-
const tool = this.tools.get(name);
|
|
104
|
-
if (tool) {
|
|
105
|
-
tool.handler = handler;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Execute a tool call
|
|
110
|
-
*/
|
|
111
|
-
async executeTool(name, args) {
|
|
112
|
-
const tool = this.tools.get(name);
|
|
113
|
-
if (!tool) {
|
|
114
|
-
return `Error: Tool '${name}' not found`;
|
|
115
|
-
}
|
|
116
|
-
if (tool.handler) {
|
|
117
|
-
try {
|
|
118
|
-
return await tool.handler(args);
|
|
119
|
-
}
|
|
120
|
-
catch (error) {
|
|
121
|
-
return `Error executing ${name}: ${error instanceof Error ? error.message : String(error)}`;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
// No handler registered - fail explicitly
|
|
125
|
-
throw new Error(`No handler registered for tool: ${name}`);
|
|
126
73
|
}
|
|
127
74
|
/**
|
|
128
75
|
* Initialize the conversation
|
|
129
76
|
*/
|
|
130
77
|
initialize() {
|
|
131
|
-
this.messages = [
|
|
132
|
-
{
|
|
133
|
-
role: 'system',
|
|
134
|
-
content: this.getSystemPrompt(),
|
|
135
|
-
},
|
|
136
|
-
];
|
|
78
|
+
this.messages = [];
|
|
137
79
|
}
|
|
138
80
|
/**
|
|
139
|
-
* Send a message and get a response
|
|
81
|
+
* Send a message and get a response using AI SDK ToolLoopAgent.
|
|
82
|
+
* Publishes StateClaims and ReplayPackets to ContractPlane.
|
|
140
83
|
*/
|
|
141
84
|
async chat(userMessage, options) {
|
|
142
|
-
|
|
85
|
+
const contractPlaneUrl = process.env.CONTRACTPLANE_URL || 'https://contractplane.blueflyagents.com';
|
|
86
|
+
const startTime = new Date().toISOString();
|
|
87
|
+
// 1. Resolve Context Packs (Economy Layer)
|
|
88
|
+
const contextPacks = await this.resolveContextPacks(contractPlaneUrl);
|
|
89
|
+
const enrichedSystemPrompt = this.getSystemPrompt() + "\n\nContext Packs:\n" + JSON.stringify(contextPacks);
|
|
143
90
|
this.messages.push({
|
|
144
91
|
role: 'user',
|
|
145
92
|
content: userMessage,
|
|
146
93
|
});
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
model: this.getModel(),
|
|
155
|
-
messages: this.messages,
|
|
156
|
-
tools: tools.length > 0 ? tools : undefined,
|
|
157
|
-
temperature: this.manifest.spec.llm?.temperature ?? 0.7,
|
|
158
|
-
max_tokens: this.manifest.spec.llm?.maxTokens,
|
|
159
|
-
});
|
|
160
|
-
const choice = response.choices[0];
|
|
161
|
-
const message = choice.message;
|
|
162
|
-
// Add assistant message to history
|
|
163
|
-
this.messages.push(message);
|
|
164
|
-
// Check if we need to call tools
|
|
165
|
-
if (message.tool_calls && message.tool_calls.length > 0) {
|
|
166
|
-
if (options?.verbose) {
|
|
167
|
-
console.log(`\n[Calling ${message.tool_calls.length} tool(s)...]`);
|
|
168
|
-
}
|
|
169
|
-
// Execute each tool call
|
|
170
|
-
for (const toolCall of message.tool_calls) {
|
|
171
|
-
// Type guard for function tool calls
|
|
172
|
-
if (toolCall.type !== 'function')
|
|
173
|
-
continue;
|
|
174
|
-
const funcCall = toolCall;
|
|
175
|
-
const args = JSON.parse(funcCall.function.arguments);
|
|
94
|
+
// Convert internal tools to AI SDK tools
|
|
95
|
+
const sdkTools = {};
|
|
96
|
+
for (const [name, def] of this.tools) {
|
|
97
|
+
sdkTools[name] = {
|
|
98
|
+
description: def.description,
|
|
99
|
+
parameters: z.any(),
|
|
100
|
+
execute: async (args) => {
|
|
176
101
|
if (options?.verbose) {
|
|
177
|
-
console.log(` → ${
|
|
102
|
+
console.log(` → ${name}(${JSON.stringify(args)})`);
|
|
178
103
|
}
|
|
179
|
-
const result = await
|
|
104
|
+
const result = await def.handler(args);
|
|
105
|
+
// Publish tool execution as a StateClaim (Evidence)
|
|
106
|
+
await this.publishStateClaim(contractPlaneUrl, {
|
|
107
|
+
subject: `task:${this.manifest.metadata.name}`,
|
|
108
|
+
claim_type: 'evidence.tool_execution',
|
|
109
|
+
payload: {
|
|
110
|
+
tool: name,
|
|
111
|
+
args,
|
|
112
|
+
result_summary: result.substring(0, 500)
|
|
113
|
+
}
|
|
114
|
+
});
|
|
180
115
|
if (options?.verbose) {
|
|
181
116
|
console.log(` ← ${result.substring(0, 100)}${result.length > 100 ? '...' : ''}`);
|
|
182
117
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
118
|
+
return result;
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
// 2. Execute with Economics (ExecutionProfile) via ToolLoopAgent
|
|
123
|
+
const openaiProvider = createOpenAI({
|
|
124
|
+
apiKey: this.apiKey,
|
|
125
|
+
});
|
|
126
|
+
const agent = new ToolLoopAgent({
|
|
127
|
+
model: openaiProvider(this.getModelName()),
|
|
128
|
+
instructions: enrichedSystemPrompt,
|
|
129
|
+
tools: sdkTools,
|
|
130
|
+
stopWhen: stepCountIs(options?.maxTurns || 10),
|
|
131
|
+
});
|
|
132
|
+
const result = await agent.generate({
|
|
133
|
+
prompt: userMessage,
|
|
134
|
+
});
|
|
135
|
+
// Sync result back to history
|
|
136
|
+
this.messages.push({
|
|
137
|
+
role: 'assistant',
|
|
138
|
+
content: result.text,
|
|
139
|
+
});
|
|
140
|
+
// 3. Publish final intent/judgment as a StateClaim
|
|
141
|
+
await this.publishStateClaim(contractPlaneUrl, {
|
|
142
|
+
subject: `conversation:${this.manifest.metadata.name}`,
|
|
143
|
+
claim_type: 'intent.response',
|
|
144
|
+
payload: {
|
|
145
|
+
text: result.text,
|
|
146
|
+
usage: result.usage,
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
// 4. Generate and Publish Replay Packet (Reproducibility & Escrow)
|
|
150
|
+
const reasoningTrace = JSON.stringify(this.messages);
|
|
151
|
+
const reasoningHash = crypto.createHash('sha256').update(reasoningTrace).digest('hex');
|
|
152
|
+
await this.publishReplayPacket(contractPlaneUrl, {
|
|
153
|
+
metadata: {
|
|
154
|
+
id: `replay:${Math.random().toString(36).substring(7)}`,
|
|
155
|
+
timestamp: startTime,
|
|
156
|
+
agent_id: this.manifest.metadata.name
|
|
157
|
+
},
|
|
158
|
+
spec: {
|
|
159
|
+
execution_profile: this.manifest.economics?.execution_profile || 'default-balanced',
|
|
160
|
+
model_class: this.manifest.economics?.token_class || 'balanced-work',
|
|
161
|
+
inputs: {
|
|
162
|
+
prompts: [enrichedSystemPrompt, userMessage],
|
|
163
|
+
context_packs: this.manifest.spec.tools?.filter(t => t.type === 'context_pack').map(t => t.name) || []
|
|
164
|
+
},
|
|
165
|
+
accounting: {
|
|
166
|
+
compute_tokens: result.usage.totalTokens,
|
|
167
|
+
context_tokens: 0 // Calculated by mesh
|
|
168
|
+
},
|
|
169
|
+
escrow: {
|
|
170
|
+
mode: 'structured-only',
|
|
171
|
+
reasoning_hash: reasoningHash,
|
|
172
|
+
policy_gate: 'audit_only'
|
|
173
|
+
},
|
|
174
|
+
output: {
|
|
175
|
+
text: result.text,
|
|
176
|
+
confidence: 1.0 // Simple heuristic for now
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
return result.text;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Resolves context packs via the State Plane.
|
|
184
|
+
*/
|
|
185
|
+
async resolveContextPacks(baseUrl) {
|
|
186
|
+
const packs = [];
|
|
187
|
+
const contextPackRefs = this.manifest.spec.tools?.filter(t => t.type === 'context_pack') || [];
|
|
188
|
+
for (const ref of contextPackRefs) {
|
|
189
|
+
try {
|
|
190
|
+
const response = await fetch(`${baseUrl}/api/v1/statemesh/context/${ref.name}`);
|
|
191
|
+
if (response.ok) {
|
|
192
|
+
packs.push(await response.json());
|
|
189
193
|
}
|
|
190
|
-
// Continue the loop to get the final response
|
|
191
|
-
continue;
|
|
192
194
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
+
catch (e) {
|
|
196
|
+
console.error(`Failed to resolve context pack: ${ref.name}`);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return packs;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Publish a Replay Packet to ContractPlane.
|
|
203
|
+
*/
|
|
204
|
+
async publishReplayPacket(baseUrl, packet) {
|
|
205
|
+
try {
|
|
206
|
+
await fetch(`${baseUrl}/api/v1/statemesh/replays`, {
|
|
207
|
+
method: 'POST',
|
|
208
|
+
headers: { 'Content-Type': 'application/json' },
|
|
209
|
+
body: JSON.stringify(packet)
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
catch (e) {
|
|
213
|
+
console.error('Failed to record Replay Packet');
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Publish a claim to the ContractPlane State Plane API
|
|
218
|
+
*/
|
|
219
|
+
async publishStateClaim(baseUrl, claim) {
|
|
220
|
+
try {
|
|
221
|
+
await fetch(`${baseUrl}/api/v1/statemesh/claims`, {
|
|
222
|
+
method: 'POST',
|
|
223
|
+
headers: { 'Content-Type': 'application/json' },
|
|
224
|
+
body: JSON.stringify({
|
|
225
|
+
...claim,
|
|
226
|
+
producer_id: `agent://${this.manifest.metadata.name}`,
|
|
227
|
+
confidence: 100,
|
|
228
|
+
trust_tier: this.manifest.security?.tier || 'unverified'
|
|
229
|
+
})
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
console.error(`Failed to publish StateClaim: ${error instanceof Error ? error.message : String(error)}`);
|
|
195
234
|
}
|
|
196
|
-
return 'Max turns reached without completion';
|
|
197
235
|
}
|
|
198
236
|
/**
|
|
199
237
|
* Get agent info
|
|
@@ -201,7 +239,7 @@ export class OpenAIAdapter {
|
|
|
201
239
|
getAgentInfo() {
|
|
202
240
|
return {
|
|
203
241
|
name: this.manifest.metadata.name,
|
|
204
|
-
model: this.
|
|
242
|
+
model: this.getModelName(),
|
|
205
243
|
tools: Array.from(this.tools.keys()),
|
|
206
244
|
};
|
|
207
245
|
}
|
|
@@ -16,9 +16,9 @@ declare const SkillMetadataSchema: z.ZodObject<{
|
|
|
16
16
|
description: z.ZodString;
|
|
17
17
|
priority: z.ZodDefault<z.ZodNumber>;
|
|
18
18
|
contexts: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
19
|
+
review: "review";
|
|
19
20
|
production: "production";
|
|
20
21
|
development: "development";
|
|
21
|
-
review: "review";
|
|
22
22
|
testing: "testing";
|
|
23
23
|
}>>>;
|
|
24
24
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -58,13 +58,53 @@ const DEFAULT_SOURCES = [
|
|
|
58
58
|
* Common English stop words to exclude from trigger extraction
|
|
59
59
|
*/
|
|
60
60
|
const STOP_WORDS = new Set([
|
|
61
|
-
'the',
|
|
62
|
-
'
|
|
63
|
-
'
|
|
64
|
-
'
|
|
65
|
-
'
|
|
66
|
-
'
|
|
67
|
-
'
|
|
61
|
+
'the',
|
|
62
|
+
'and',
|
|
63
|
+
'for',
|
|
64
|
+
'are',
|
|
65
|
+
'but',
|
|
66
|
+
'not',
|
|
67
|
+
'you',
|
|
68
|
+
'all',
|
|
69
|
+
'can',
|
|
70
|
+
'her',
|
|
71
|
+
'was',
|
|
72
|
+
'one',
|
|
73
|
+
'our',
|
|
74
|
+
'out',
|
|
75
|
+
'has',
|
|
76
|
+
'have',
|
|
77
|
+
'with',
|
|
78
|
+
'this',
|
|
79
|
+
'that',
|
|
80
|
+
'from',
|
|
81
|
+
'they',
|
|
82
|
+
'been',
|
|
83
|
+
'said',
|
|
84
|
+
'each',
|
|
85
|
+
'which',
|
|
86
|
+
'their',
|
|
87
|
+
'will',
|
|
88
|
+
'other',
|
|
89
|
+
'about',
|
|
90
|
+
'many',
|
|
91
|
+
'then',
|
|
92
|
+
'them',
|
|
93
|
+
'these',
|
|
94
|
+
'some',
|
|
95
|
+
'would',
|
|
96
|
+
'make',
|
|
97
|
+
'like',
|
|
98
|
+
'into',
|
|
99
|
+
'could',
|
|
100
|
+
'time',
|
|
101
|
+
'very',
|
|
102
|
+
'when',
|
|
103
|
+
'come',
|
|
104
|
+
'made',
|
|
105
|
+
'use',
|
|
106
|
+
'using',
|
|
107
|
+
'used',
|
|
68
108
|
]);
|
|
69
109
|
let SkillsResearchService = class SkillsResearchService {
|
|
70
110
|
indexPath;
|
|
@@ -157,7 +157,9 @@ export async function verifyAgentSignature(manifest, signature, agentId) {
|
|
|
157
157
|
...base,
|
|
158
158
|
verified,
|
|
159
159
|
tier: verified ? 'verified-signature' : 'signed',
|
|
160
|
-
reason: verified
|
|
160
|
+
reason: verified
|
|
161
|
+
? undefined
|
|
162
|
+
: 'Signature verification failed — payload mismatch or invalid key',
|
|
161
163
|
};
|
|
162
164
|
}
|
|
163
165
|
catch (err) {
|
|
@@ -190,7 +192,7 @@ export async function signAgentManifest(manifest, privateKeyHex, issuer) {
|
|
|
190
192
|
type: 'Ed25519',
|
|
191
193
|
value: signatureB64,
|
|
192
194
|
publicKey: publicKeyB64,
|
|
193
|
-
timestamp: new Date().toISOString()
|
|
195
|
+
timestamp: new Date().toISOString(),
|
|
194
196
|
};
|
|
195
197
|
if (issuer) {
|
|
196
198
|
signature.issuer = issuer;
|
|
@@ -201,8 +203,8 @@ export async function signAgentManifest(manifest, privateKeyHex, issuer) {
|
|
|
201
203
|
...manifest,
|
|
202
204
|
metadata: {
|
|
203
205
|
...metadata,
|
|
204
|
-
'x-signature': signature
|
|
205
|
-
}
|
|
206
|
+
'x-signature': signature,
|
|
207
|
+
},
|
|
206
208
|
};
|
|
207
209
|
}
|
|
208
210
|
// ─── Utilities ──────────────────────────────────────────────
|
|
@@ -22,16 +22,7 @@ import { z } from 'zod';
|
|
|
22
22
|
import { inject, injectable } from 'inversify';
|
|
23
23
|
import { SchemaRepository } from '../repositories/schema.repository.js';
|
|
24
24
|
import { MessagingValidator } from './validators/messaging.validator.js';
|
|
25
|
-
import {
|
|
26
|
-
import { OpenAIValidator } from './validators/openai.validator.js';
|
|
27
|
-
import { CrewAIValidator } from './validators/crewai.validator.js';
|
|
28
|
-
import { LangChainValidator } from './validators/langchain.validator.js';
|
|
29
|
-
import { AnthropicValidator } from './validators/anthropic.validator.js';
|
|
30
|
-
import { LangflowValidator } from './validators/langflow.validator.js';
|
|
31
|
-
import { AutoGenValidator } from './validators/autogen.validator.js';
|
|
32
|
-
import { VercelAIValidator } from './validators/vercel-ai.validator.js';
|
|
33
|
-
import { LlamaIndexValidator } from './validators/llamaindex.validator.js';
|
|
34
|
-
import { LangGraphValidator } from './validators/langgraph.validator.js';
|
|
25
|
+
import { createValidatorRegistry, } from './validators/registry.js';
|
|
35
26
|
/**
|
|
36
27
|
* Convert Zod error to Ajv ErrorObject format for compatibility
|
|
37
28
|
*/
|
|
@@ -85,18 +76,8 @@ let ValidationZodService = class ValidationZodService {
|
|
|
85
76
|
platformValidators;
|
|
86
77
|
constructor(schemaRepository) {
|
|
87
78
|
this.schemaRepository = schemaRepository;
|
|
88
|
-
//
|
|
89
|
-
this.platformValidators =
|
|
90
|
-
this.platformValidators.set('cursor', new CursorValidator());
|
|
91
|
-
this.platformValidators.set('openai_agents', new OpenAIValidator());
|
|
92
|
-
this.platformValidators.set('crewai', new CrewAIValidator());
|
|
93
|
-
this.platformValidators.set('langchain', new LangChainValidator());
|
|
94
|
-
this.platformValidators.set('anthropic', new AnthropicValidator());
|
|
95
|
-
this.platformValidators.set('langflow', new LangflowValidator());
|
|
96
|
-
this.platformValidators.set('autogen', new AutoGenValidator());
|
|
97
|
-
this.platformValidators.set('vercel_ai', new VercelAIValidator());
|
|
98
|
-
this.platformValidators.set('llamaindex', new LlamaIndexValidator());
|
|
99
|
-
this.platformValidators.set('langgraph', new LangGraphValidator());
|
|
79
|
+
// Single source of truth: all platform validators live in registry.ts
|
|
80
|
+
this.platformValidators = createValidatorRegistry();
|
|
100
81
|
}
|
|
101
82
|
/**
|
|
102
83
|
* Validate OSSA agent manifest using Zod
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Platform Validators Index
|
|
3
3
|
* Exports all platform-specific validators
|
|
4
4
|
*/
|
|
5
|
+
export { createValidatorRegistry, type PlatformValidator } from './registry.js';
|
|
5
6
|
export { CursorValidator } from './cursor.validator.js';
|
|
6
7
|
export { OpenAIValidator } from './openai.validator.js';
|
|
7
8
|
export { CrewAIValidator } from './crewai.validator.js';
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Platform Validators Index
|
|
4
4
|
* Exports all platform-specific validators
|
|
5
5
|
*/
|
|
6
|
+
export { createValidatorRegistry } from './registry.js';
|
|
6
7
|
export { CursorValidator } from './cursor.validator.js';
|
|
7
8
|
export { OpenAIValidator } from './openai.validator.js';
|
|
8
9
|
export { CrewAIValidator } from './crewai.validator.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validator Registry Factory
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for all platform validators — add new validators here only.
|
|
5
|
+
*
|
|
6
|
+
* DRY: eliminates duplicate Map initialization across ValidationService implementations.
|
|
7
|
+
* To add a new platform validator: import it here and add one entry to the Map.
|
|
8
|
+
*/
|
|
9
|
+
import type { OssaAgent, ValidationResult } from '../../types/index.js';
|
|
10
|
+
/** Shared interface for all platform validators registered in the registry. */
|
|
11
|
+
export interface PlatformValidator {
|
|
12
|
+
validate(manifest: OssaAgent): ValidationResult;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Create the canonical map of platform validators.
|
|
16
|
+
*
|
|
17
|
+
* Keys match the extension names used in OSSA agent manifests
|
|
18
|
+
* (i.e. the keys of `manifest.extensions`).
|
|
19
|
+
*/
|
|
20
|
+
export declare function createValidatorRegistry(): Map<string, PlatformValidator>;
|
|
21
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* Validator Registry Factory
|
|
4
|
+
*
|
|
5
|
+
* Single source of truth for all platform validators — add new validators here only.
|
|
6
|
+
*
|
|
7
|
+
* DRY: eliminates duplicate Map initialization across ValidationService implementations.
|
|
8
|
+
* To add a new platform validator: import it here and add one entry to the Map.
|
|
9
|
+
*/
|
|
10
|
+
import { CursorValidator } from './cursor.validator.js';
|
|
11
|
+
import { OpenAIValidator } from './openai.validator.js';
|
|
12
|
+
import { CrewAIValidator } from './crewai.validator.js';
|
|
13
|
+
import { LangChainValidator } from './langchain.validator.js';
|
|
14
|
+
import { AnthropicValidator } from './anthropic.validator.js';
|
|
15
|
+
import { LangflowValidator } from './langflow.validator.js';
|
|
16
|
+
import { AutoGenValidator } from './autogen.validator.js';
|
|
17
|
+
import { VercelAIValidator } from './vercel-ai.validator.js';
|
|
18
|
+
import { LlamaIndexValidator } from './llamaindex.validator.js';
|
|
19
|
+
import { LangGraphValidator } from './langgraph.validator.js';
|
|
20
|
+
import { KagentValidator } from './kagent.validator.js';
|
|
21
|
+
/**
|
|
22
|
+
* Create the canonical map of platform validators.
|
|
23
|
+
*
|
|
24
|
+
* Keys match the extension names used in OSSA agent manifests
|
|
25
|
+
* (i.e. the keys of `manifest.extensions`).
|
|
26
|
+
*/
|
|
27
|
+
export function createValidatorRegistry() {
|
|
28
|
+
return new Map([
|
|
29
|
+
['cursor', new CursorValidator()],
|
|
30
|
+
['openai_agents', new OpenAIValidator()],
|
|
31
|
+
['crewai', new CrewAIValidator()],
|
|
32
|
+
['langchain', new LangChainValidator()],
|
|
33
|
+
['anthropic', new AnthropicValidator()],
|
|
34
|
+
['langflow', new LangflowValidator()],
|
|
35
|
+
['autogen', new AutoGenValidator()],
|
|
36
|
+
['vercel_ai', new VercelAIValidator()],
|
|
37
|
+
['llamaindex', new LlamaIndexValidator()],
|
|
38
|
+
['langgraph', new LangGraphValidator()],
|
|
39
|
+
['kagent', new KagentValidator()],
|
|
40
|
+
]);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -31,6 +31,6 @@
|
|
|
31
31
|
],
|
|
32
32
|
"ossa": {
|
|
33
33
|
"type": "claude-skill",
|
|
34
|
-
"skillPath": "/var/folders/48/d86hncy50j93r_vzsv6knttr0000gn/T/ossa-export-test-
|
|
34
|
+
"skillPath": "/var/folders/48/d86hncy50j93r_vzsv6knttr0000gn/T/ossa-export-test-1774702067895/test-skill"
|
|
35
35
|
}
|
|
36
36
|
}
|