@bluefly/openstandardagents 0.4.9 → 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 +35 -4
- package/README.md +77 -62
- 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/claude-code/adapter.js +2 -2
- package/dist/adapters/docker/generators.js +19 -19
- 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/generator.js +76 -76
- 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/adapters/openai-agents/adapter.js +2 -2
- 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/schema-driven/schema-loader.js +5 -5
- 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 +43 -14
- 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/export/langchain/langchain-exporter.js +2 -2
- package/dist/services/export/langchain/memory-generator.js +2 -2
- package/dist/services/export/testing/test-generator.js +1 -1
- 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/taxonomy-service.d.ts +3 -3
- 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/extensions/role-manifest.md +188 -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.4/extensions/mcp/README.md +1 -1
- package/dist/spec/v0.5/agent-builder-openapi.yaml +230 -0
- package/dist/spec/v0.5/agent.schema.json +34 -2
- 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/memory-hierarchy.yaml +120 -0
- package/dist/spec/v0.5/role.schema.json +268 -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 +54 -6
- package/dist/types/index.js +6 -2
- package/dist/types/personality.zod.d.ts +3 -3
- package/dist/types/role.d.ts +126 -0
- package/dist/types/role.js +38 -0
- 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/validator.js +1 -1
- package/dist/validation/version-compliance.js +1 -1
- package/examples/agents/01-customer-support-bot/agent.ossa.yaml +24 -31
- package/examples/agents/05-sales-assistant/agent.ossa.yaml +35 -23
- package/examples/agents/07-research-assistant/agent.ossa.yaml +27 -21
- package/examples/agents/10-meeting-assistant/agent.ossa.yaml +27 -35
- package/examples/agents/security-audit-agent.ossa.yaml +234 -0
- package/examples/agentscope/react-assistant/README.md +1 -1
- package/examples/agentscope/react-assistant/agent.ossa.yaml +37 -33
- package/examples/drupal/content-moderator.ossa.yaml +2 -2
- 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/drupal/drupal-contributor.ossa.yaml +247 -0
- package/examples/export/langchain/production-agent-with-memory/README.md +1 -1
- package/examples/export/langchain/production-agent-with-memory/agent.ossa.yaml +13 -23
- package/examples/export/langchain/production-agent-with-streaming/agent.ossa.yaml +1 -15
- package/examples/export/langchain/production-agent-with-tools/agent.ossa.yaml +28 -29
- 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/README.md +3 -3
- package/examples/getting-started/hello-world-complete.ossa.yaml +1 -1
- package/examples/gitlab-agents/gitlab-ci-agent.ossa.yaml +221 -0
- package/examples/hierarchical-agent.ossa.yaml +10 -53
- package/examples/kagent/ossa-kagent-anthropic.ossa.yaml +2 -25
- package/examples/kagent/ossa-kagent-mcp-tools.ossa.yaml +2 -30
- package/examples/kagent/ossa-kagent-multi-tool.ossa.yaml +2 -18
- package/examples/kagent/ossa-kagent-poc.ossa.yaml +2 -16
- package/examples/pipeline-agent.ossa.yaml +3 -3
- package/examples/platform-specific/claude-code-subagent.yaml +1 -1
- package/examples/platform-specific/cursor-coding-agent.yaml +1 -1
- package/examples/platform-specific/warp-terminal-agent.yaml +1 -1
- package/examples/production-ready/01-customer-support-bot/agent.ossa.yaml +24 -31
- package/examples/production-ready/05-sales-assistant/agent.ossa.yaml +35 -23
- package/examples/production-ready/07-research-assistant/agent.ossa.yaml +27 -19
- package/examples/production-ready/10-meeting-assistant/agent.ossa.yaml +27 -35
- package/examples/roles/drupal-developer.role.yaml +37 -0
- package/examples/roles/platform-operator.role.yaml +28 -0
- package/examples/roles/security-auditor.role.yaml +27 -0
- package/examples/swarm-agent.ossa.yaml +13 -51
- package/examples/team-agent.ossa.yaml +12 -61
- package/examples/team-lead-teammate.ossa.yaml +12 -17
- package/openapi/agent-cognition-sessions.yaml +580 -0
- package/openapi/agent-communication.yaml +260 -212
- package/openapi/agent-crud.yaml +237 -207
- package/openapi/agent-discovery.yaml +119 -81
- package/openapi/agent-identity.yaml +219 -187
- package/openapi/agent-taxonomy.yaml +95 -38
- package/openapi/agents-md-service.yaml +103 -30
- package/openapi/cli/openapi.yaml +147 -40
- package/openapi/core/ossa-core-api.openapi.yaml +327 -271
- package/openapi/core/ossa-registry-api.openapi.yaml +299 -236
- package/openapi/core/ossa-registry.openapi.yaml +299 -159
- package/openapi/core/unified-agent-gateway.openapi.yaml +234 -170
- package/openapi/daemon-api.openapi.yaml +323 -181
- package/openapi/dev-cli/openapi.yaml +137 -113
- package/openapi/github-sync.yaml +62 -19
- package/openapi/marketplace-plugin.openapi.yaml +539 -466
- package/openapi/ossa-api.openapi.yaml +354 -213
- package/openapi/ossa-cli-enhancements.openapi.yaml +109 -90
- package/openapi/ossa-cli.yaml +260 -184
- package/openapi/protocols/sse-streams.yaml +66 -74
- package/openapi/protocols/websocket-events.yaml +61 -54
- package/openapi/reference-implementations/aiflow-bridge-api.openapi.yaml +37 -20
- package/openapi/reference-implementations/compliance-agent-api.openapi.yaml +35 -23
- package/openapi/reference-implementations/crewai-agent-api.openapi.yaml +29 -18
- package/openapi/reference-implementations/critic-agent-api.openapi.yaml +45 -19
- package/openapi/reference-implementations/document-analyzer-api.openapi.yaml +30 -24
- package/openapi/reference-implementations/drupal-agent-api.openapi.yaml +101 -50
- package/openapi/reference-implementations/getting-started-hello-world-api.openapi.yaml +33 -22
- package/openapi/reference-implementations/gitlab-ml-recommender-api.openapi.yaml +20 -16
- package/openapi/reference-implementations/governor-agent-api.openapi.yaml +41 -23
- package/openapi/reference-implementations/helm-generator.openapi.yaml +88 -46
- package/openapi/reference-implementations/integrator-agent-api.openapi.yaml +30 -20
- package/openapi/reference-implementations/judge-agent-api.openapi.yaml +22 -16
- package/openapi/reference-implementations/k8s-troubleshooter-api.openapi.yaml +32 -18
- package/openapi/reference-implementations/langchain-agent-api.openapi.yaml +32 -21
- package/openapi/reference-implementations/monitor-agent-api.openapi.yaml +34 -21
- package/openapi/reference-implementations/orchestrator-agent-api.openapi.yaml +49 -27
- package/openapi/reference-implementations/quickstart-support-agent-api.openapi.yaml +27 -19
- package/openapi/reference-implementations/self-evolving-ecosystem.openapi.yaml +427 -293
- package/openapi/reference-implementations/worker-agent-api.openapi.yaml +34 -23
- package/openapi/reference-implementations/workflow-orchestrator-api.openapi.yaml +35 -21
- package/openapi/release-automation.openapi.yaml +48 -14
- package/openapi/schemas/common/agent.yaml +30 -29
- package/openapi/schemas/common/economics.yaml +98 -0
- package/openapi/schemas/common/errors.yaml +13 -3
- package/openapi/schemas/common/metadata.yaml +22 -7
- package/openapi/schemas/common/pagination.yaml +18 -6
- package/openapi/schemas/common/security.yaml +13 -5
- package/openapi/schemas/index.yaml +49 -42
- package/openapi/uadp-asyncapi.yaml +5 -3
- package/openapi/uadp-openapi.yaml +243 -165
- package/openapi/version-management.openapi.yaml +142 -135
- package/package.json +43 -14
- package/spec/extensions/cognition.schema.json +87 -0
- package/spec/extensions/role-manifest.md +188 -0
- package/spec/layer4-economics/duadp-examples.json +44 -0
- package/spec/v0.4/agent.schema.json +14 -0
- package/spec/v0.4/extensions/mcp/README.md +1 -1
- package/spec/v0.5/agent-builder-openapi.yaml +230 -0
- package/spec/v0.5/agent.schema.json +34 -2
- 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/memory-hierarchy.yaml +120 -0
- package/spec/v0.5/role.schema.json +268 -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 -557
- 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
|
@@ -438,18 +438,18 @@ set -e
|
|
|
438
438
|
echo "Starting ${agentName}..."
|
|
439
439
|
|
|
440
440
|
# Wait for dependencies
|
|
441
|
-
if [ -n "
|
|
441
|
+
if [ -n "$POSTGRES_HOST" ]; then
|
|
442
442
|
echo "Waiting for PostgreSQL..."
|
|
443
|
-
until nc -z "
|
|
443
|
+
until nc -z "$POSTGRES_HOST" "\${POSTGRES_PORT:-5432}"; do
|
|
444
444
|
echo "PostgreSQL is unavailable - sleeping"
|
|
445
445
|
sleep 1
|
|
446
446
|
done
|
|
447
447
|
echo "PostgreSQL is up"
|
|
448
448
|
fi
|
|
449
449
|
|
|
450
|
-
if [ -n "
|
|
450
|
+
if [ -n "$REDIS_HOST" ]; then
|
|
451
451
|
echo "Waiting for Redis..."
|
|
452
|
-
until nc -z "
|
|
452
|
+
until nc -z "$REDIS_HOST" "\${REDIS_PORT:-6379}"; do
|
|
453
453
|
echo "Redis is unavailable - sleeping"
|
|
454
454
|
sleep 1
|
|
455
455
|
done
|
|
@@ -464,7 +464,7 @@ fi
|
|
|
464
464
|
|
|
465
465
|
# Execute the main command
|
|
466
466
|
echo "Starting application..."
|
|
467
|
-
exec "
|
|
467
|
+
exec "$@"
|
|
468
468
|
`;
|
|
469
469
|
}
|
|
470
470
|
/**
|
|
@@ -484,13 +484,13 @@ if ! pgrep -f "node" > /dev/null; then
|
|
|
484
484
|
fi
|
|
485
485
|
|
|
486
486
|
# Check HTTP health endpoint
|
|
487
|
-
response
|
|
487
|
+
response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:${port}/health || echo "000")
|
|
488
488
|
|
|
489
|
-
if [ "
|
|
489
|
+
if [ "$response" = "200" ]; then
|
|
490
490
|
echo "Health check passed"
|
|
491
491
|
exit 0
|
|
492
492
|
else
|
|
493
|
-
echo "Health check failed with status:
|
|
493
|
+
echo "Health check failed with status: $response"
|
|
494
494
|
exit 1
|
|
495
495
|
fi
|
|
496
496
|
`;
|
|
@@ -523,7 +523,7 @@ docker build \\
|
|
|
523
523
|
|
|
524
524
|
echo "✓ Build complete"
|
|
525
525
|
echo " Image: \${IMAGE_NAME}:\${VERSION}"
|
|
526
|
-
echo " Size:
|
|
526
|
+
echo " Size: $(docker images \${IMAGE_NAME}:\${VERSION} --format "{{.Size}}")"
|
|
527
527
|
`;
|
|
528
528
|
}
|
|
529
529
|
/**
|
|
@@ -540,7 +540,7 @@ IMAGE_NAME="${agentName}"
|
|
|
540
540
|
VERSION=\${VERSION:-latest}
|
|
541
541
|
REGISTRY=\${REGISTRY:-docker.io}
|
|
542
542
|
|
|
543
|
-
if [ -z "
|
|
543
|
+
if [ -z "$REGISTRY" ]; then
|
|
544
544
|
echo "Error: REGISTRY environment variable is required"
|
|
545
545
|
exit 1
|
|
546
546
|
fi
|
|
@@ -709,9 +709,9 @@ http {
|
|
|
709
709
|
include /etc/nginx/mime.types;
|
|
710
710
|
default_type application/octet-stream;
|
|
711
711
|
|
|
712
|
-
log_format main '
|
|
713
|
-
'
|
|
714
|
-
'"
|
|
712
|
+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
713
|
+
'$status $body_bytes_sent "$http_referer" '
|
|
714
|
+
'"$http_user_agent" "$http_x_forwarded_for"';
|
|
715
715
|
|
|
716
716
|
access_log /var/log/nginx/access.log main;
|
|
717
717
|
|
|
@@ -728,7 +728,7 @@ http {
|
|
|
728
728
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
|
|
729
729
|
|
|
730
730
|
# Rate limiting
|
|
731
|
-
limit_req_zone
|
|
731
|
+
limit_req_zone $binary_remote_addr zone=api_limit:10m rate=10r/s;
|
|
732
732
|
|
|
733
733
|
upstream agent_backend {
|
|
734
734
|
least_conn;
|
|
@@ -756,12 +756,12 @@ http {
|
|
|
756
756
|
|
|
757
757
|
proxy_pass http://agent_backend;
|
|
758
758
|
proxy_http_version 1.1;
|
|
759
|
-
proxy_set_header Upgrade
|
|
759
|
+
proxy_set_header Upgrade $http_upgrade;
|
|
760
760
|
proxy_set_header Connection "upgrade";
|
|
761
|
-
proxy_set_header Host
|
|
762
|
-
proxy_set_header X-Real-IP
|
|
763
|
-
proxy_set_header X-Forwarded-For
|
|
764
|
-
proxy_set_header X-Forwarded-Proto
|
|
761
|
+
proxy_set_header Host $host;
|
|
762
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
763
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
764
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
765
765
|
|
|
766
766
|
# Timeouts
|
|
767
767
|
proxy_connect_timeout 60;
|
|
@@ -5,4 +5,6 @@
|
|
|
5
5
|
export { DockerfileGenerator, DockerComposeGenerator, DockerScriptsGenerator, DockerConfigGenerator, } from './generators.js';
|
|
6
6
|
export { DockerExporter } from './docker-exporter.js';
|
|
7
7
|
export type { DockerConfig, DockerExportOptions } from './types.js';
|
|
8
|
+
export { ossaToOpenclawStack, getOpenclawCatalog } from './openclaw-bridge.js';
|
|
9
|
+
export type { OpenclawBridgeOptions, OpenclawStackResult } from './openclaw-bridge.js';
|
|
8
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -4,4 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { DockerfileGenerator, DockerComposeGenerator, DockerScriptsGenerator, DockerConfigGenerator, } from './generators.js';
|
|
6
6
|
export { DockerExporter } from './docker-exporter.js';
|
|
7
|
+
// OpenClaw integration — delegates Docker stack generation to @better-openclaw/core
|
|
8
|
+
export { ossaToOpenclawStack, getOpenclawCatalog } from './openclaw-bridge.js';
|
|
7
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenClaw Bridge — OSSA manifest → Docker Compose via @better-openclaw/core
|
|
3
|
+
*
|
|
4
|
+
* Delegates ALL Docker stack generation to openclaw (201 services, 44 skill packs,
|
|
5
|
+
* 21 presets). Eliminates custom Dockerfile/compose generation.
|
|
6
|
+
*
|
|
7
|
+
* @better-openclaw/core handles: service resolution, port conflict detection,
|
|
8
|
+
* env files, health checks, Caddy/Traefik proxy, Grafana dashboards, scripts.
|
|
9
|
+
*/
|
|
10
|
+
import type { OssaAgent } from '../../types/index.js';
|
|
11
|
+
export interface OpenclawStackResult {
|
|
12
|
+
files: Array<{
|
|
13
|
+
path: string;
|
|
14
|
+
content: string;
|
|
15
|
+
type: 'yaml' | 'env' | 'shell' | 'markdown' | 'text';
|
|
16
|
+
}>;
|
|
17
|
+
warnings: string[];
|
|
18
|
+
metadata: {
|
|
19
|
+
duration: number;
|
|
20
|
+
preset: string;
|
|
21
|
+
serviceCount: number;
|
|
22
|
+
openclawVersion: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export interface OpenclawBridgeOptions {
|
|
26
|
+
preset?: string;
|
|
27
|
+
additionalServices?: string[];
|
|
28
|
+
skillPacks?: string[];
|
|
29
|
+
outputDir?: string;
|
|
30
|
+
proxy?: 'none' | 'caddy' | 'traefik';
|
|
31
|
+
gpu?: boolean;
|
|
32
|
+
platform?: 'linux/amd64' | 'linux/arm64';
|
|
33
|
+
deployment?: 'local' | 'vps' | 'homelab';
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Convert an OSSA manifest into a full Docker Compose stack using openclaw.
|
|
37
|
+
*/
|
|
38
|
+
export declare function ossaToOpenclawStack(manifest: OssaAgent, options?: OpenclawBridgeOptions): Promise<OpenclawStackResult>;
|
|
39
|
+
/**
|
|
40
|
+
* List available openclaw catalog for wizard/UI.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getOpenclawCatalog(): {
|
|
43
|
+
presets: {
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
}[];
|
|
47
|
+
services: {
|
|
48
|
+
id: string;
|
|
49
|
+
name: string;
|
|
50
|
+
}[];
|
|
51
|
+
skillPacks: {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
}[];
|
|
55
|
+
totalServices: number;
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=openclaw-bridge.d.ts.map
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// @ts-nocheck — openclaw's strict union types need exact enum literals; runtime works correctly
|
|
2
|
+
/**
|
|
3
|
+
* OpenClaw Bridge — OSSA manifest → Docker Compose via @better-openclaw/core
|
|
4
|
+
*
|
|
5
|
+
* Delegates ALL Docker stack generation to openclaw (201 services, 44 skill packs,
|
|
6
|
+
* 21 presets). Eliminates custom Dockerfile/compose generation.
|
|
7
|
+
*
|
|
8
|
+
* @better-openclaw/core handles: service resolution, port conflict detection,
|
|
9
|
+
* env files, health checks, Caddy/Traefik proxy, Grafana dashboards, scripts.
|
|
10
|
+
*/
|
|
11
|
+
import { compose, generate, resolve, getAllPresets, getAllServices, getAllSkillPacks, } from '@better-openclaw/core';
|
|
12
|
+
import * as yaml from 'yaml';
|
|
13
|
+
/**
|
|
14
|
+
* Infer the best openclaw preset from OSSA manifest content.
|
|
15
|
+
*/
|
|
16
|
+
function inferPreset(manifest) {
|
|
17
|
+
const role = manifest.spec?.role || '';
|
|
18
|
+
const instructions = manifest.spec?.instructions || '';
|
|
19
|
+
const combined = (role + ' ' + instructions).toLowerCase();
|
|
20
|
+
if (combined.includes('research'))
|
|
21
|
+
return 'researcher';
|
|
22
|
+
if (combined.includes('devops') || combined.includes('deploy') || combined.includes('ci/cd'))
|
|
23
|
+
return 'devops';
|
|
24
|
+
if (combined.includes('content') || combined.includes('write'))
|
|
25
|
+
return 'content-creator';
|
|
26
|
+
if (combined.includes('code') || combined.includes('develop'))
|
|
27
|
+
return 'coding-team';
|
|
28
|
+
if (combined.includes('rag') || combined.includes('knowledge'))
|
|
29
|
+
return 'rag-platform';
|
|
30
|
+
if (combined.includes('security') || combined.includes('audit'))
|
|
31
|
+
return 'zero-trust';
|
|
32
|
+
if (combined.includes('orchestrat'))
|
|
33
|
+
return 'ai-orchestrator';
|
|
34
|
+
return 'minimal';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Infer openclaw service IDs from OSSA manifest tools/capabilities.
|
|
38
|
+
*/
|
|
39
|
+
function inferServices(manifest) {
|
|
40
|
+
const services = [];
|
|
41
|
+
const tools = manifest.spec?.tools || [];
|
|
42
|
+
const toolNames = tools.map((t) => typeof t === 'string' ? t : typeof t === 'object' && t !== null ? t.name || '' : '').join(' ').toLowerCase();
|
|
43
|
+
const combined = (manifest.spec?.role || '') + ' ' + (manifest.spec?.instructions || '') + ' ' + toolNames;
|
|
44
|
+
const lc = combined.toLowerCase();
|
|
45
|
+
if (lc.includes('vector') || lc.includes('embed') || lc.includes('rag'))
|
|
46
|
+
services.push('qdrant');
|
|
47
|
+
if (lc.includes('workflow') || lc.includes('automat'))
|
|
48
|
+
services.push('n8n');
|
|
49
|
+
if (lc.includes('search') || lc.includes('crawl'))
|
|
50
|
+
services.push('searxng');
|
|
51
|
+
if (lc.includes('browser') || lc.includes('playwright'))
|
|
52
|
+
services.push('browserless');
|
|
53
|
+
if (lc.includes('llm') || lc.includes('model') || lc.includes('ollama'))
|
|
54
|
+
services.push('ollama');
|
|
55
|
+
if (lc.includes('monitor') || lc.includes('metric') || lc.includes('grafana'))
|
|
56
|
+
services.push('grafana', 'prometheus');
|
|
57
|
+
if (lc.includes('storage') || lc.includes('s3') || lc.includes('minio'))
|
|
58
|
+
services.push('minio');
|
|
59
|
+
if (lc.includes('redis') || lc.includes('cache'))
|
|
60
|
+
services.push('redis');
|
|
61
|
+
if (lc.includes('postgres') || lc.includes('database'))
|
|
62
|
+
services.push('postgresql');
|
|
63
|
+
return Array.from(new Set(services));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Convert an OSSA manifest into a full Docker Compose stack using openclaw.
|
|
67
|
+
*/
|
|
68
|
+
export async function ossaToOpenclawStack(manifest, options = {}) {
|
|
69
|
+
const startTime = Date.now();
|
|
70
|
+
const files = [];
|
|
71
|
+
const warnings = [];
|
|
72
|
+
const presetId = options.preset || inferPreset(manifest);
|
|
73
|
+
const inferredServices = inferServices(manifest);
|
|
74
|
+
const allServiceIds = Array.from(new Set(inferredServices.concat(options.additionalServices || [])));
|
|
75
|
+
const projectName = (manifest.metadata?.name || 'ossa-agent').replace(/[^a-z0-9-]/gi, '-').toLowerCase();
|
|
76
|
+
// Resolve services via openclaw — type casts needed due to strict union enums in openclaw
|
|
77
|
+
// @ts-expect-error openclaw's ResolverInput has strict union types for aiProviders/deployment
|
|
78
|
+
const resolved = resolve({
|
|
79
|
+
services: allServiceIds,
|
|
80
|
+
skillPacks: options.skillPacks || [],
|
|
81
|
+
proxy: options.proxy || 'caddy',
|
|
82
|
+
gpu: options.gpu || false,
|
|
83
|
+
platform: options.platform || 'linux/amd64',
|
|
84
|
+
deployment: 'local',
|
|
85
|
+
projectName,
|
|
86
|
+
aiProviders: [],
|
|
87
|
+
outputFormat: 'single-file',
|
|
88
|
+
imageTag: 'latest',
|
|
89
|
+
restartPolicy: 'unless-stopped',
|
|
90
|
+
includeHealthchecks: true,
|
|
91
|
+
includeResourceLimits: true,
|
|
92
|
+
domain: '',
|
|
93
|
+
});
|
|
94
|
+
// Generate docker-compose.yml via openclaw
|
|
95
|
+
const composeOpts = {
|
|
96
|
+
projectName,
|
|
97
|
+
proxy: options.proxy || 'caddy',
|
|
98
|
+
gpu: options.gpu || false,
|
|
99
|
+
platform: options.platform || 'linux/amd64',
|
|
100
|
+
deployment: 'local',
|
|
101
|
+
imageTag: 'latest',
|
|
102
|
+
restartPolicy: 'unless-stopped',
|
|
103
|
+
includeHealthchecks: true,
|
|
104
|
+
includeResourceLimits: true,
|
|
105
|
+
domain: '',
|
|
106
|
+
};
|
|
107
|
+
const composeResult = compose(resolved, composeOpts);
|
|
108
|
+
files.push({
|
|
109
|
+
path: 'docker-compose.yml',
|
|
110
|
+
content: typeof composeResult === 'string' ? composeResult : yaml.stringify(composeResult),
|
|
111
|
+
type: 'yaml',
|
|
112
|
+
});
|
|
113
|
+
// Generate supporting files (env, scripts, health checks, docs)
|
|
114
|
+
const genInput = {
|
|
115
|
+
projectName,
|
|
116
|
+
services: allServiceIds,
|
|
117
|
+
skillPacks: options.skillPacks || [],
|
|
118
|
+
proxy: options.proxy || 'caddy',
|
|
119
|
+
gpu: options.gpu || false,
|
|
120
|
+
platform: options.platform || 'linux/amd64',
|
|
121
|
+
deployment: 'local',
|
|
122
|
+
aiProviders: [],
|
|
123
|
+
outputFormat: 'single-file',
|
|
124
|
+
imageTag: 'latest',
|
|
125
|
+
restartPolicy: 'unless-stopped',
|
|
126
|
+
includeHealthchecks: true,
|
|
127
|
+
includeResourceLimits: true,
|
|
128
|
+
domain: '',
|
|
129
|
+
};
|
|
130
|
+
// generate() expects GenerationInput — cast through unknown for strict union compat
|
|
131
|
+
// @ts-expect-error openclaw's GenerationInput has strict union types
|
|
132
|
+
const generated = generate(genInput, genInput);
|
|
133
|
+
if (generated && typeof generated === 'object') {
|
|
134
|
+
for (const [filename, content] of Object.entries(generated)) {
|
|
135
|
+
if (typeof content === 'string' && content.trim()) {
|
|
136
|
+
const ext = filename.endsWith('.yml') || filename.endsWith('.yaml') ? 'yaml'
|
|
137
|
+
: filename.endsWith('.env') ? 'env'
|
|
138
|
+
: filename.endsWith('.sh') ? 'shell'
|
|
139
|
+
: filename.endsWith('.md') ? 'markdown'
|
|
140
|
+
: 'text';
|
|
141
|
+
files.push({ path: filename, content, type: ext });
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// Include the OSSA manifest
|
|
146
|
+
files.push({
|
|
147
|
+
path: 'agent.ossa.yaml',
|
|
148
|
+
content: yaml.stringify(manifest),
|
|
149
|
+
type: 'yaml',
|
|
150
|
+
});
|
|
151
|
+
return {
|
|
152
|
+
files,
|
|
153
|
+
warnings,
|
|
154
|
+
metadata: {
|
|
155
|
+
duration: Date.now() - startTime,
|
|
156
|
+
preset: presetId,
|
|
157
|
+
serviceCount: allServiceIds.length,
|
|
158
|
+
openclawVersion: '1.0.30',
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* List available openclaw catalog for wizard/UI.
|
|
164
|
+
*/
|
|
165
|
+
export function getOpenclawCatalog() {
|
|
166
|
+
return {
|
|
167
|
+
presets: getAllPresets().map(p => ({ id: p.id, name: p.name })),
|
|
168
|
+
services: getAllServices().map(s => ({ id: s.id, name: s.name })),
|
|
169
|
+
skillPacks: getAllSkillPacks().map(s => ({ id: s.id, name: s.name })),
|
|
170
|
+
totalServices: getAllServices().length,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=openclaw-bridge.js.map
|
|
@@ -1468,33 +1468,33 @@ class ${toolClassName}Tool extends ToolPluginBase implements ContainerFactoryPlu
|
|
|
1468
1468
|
/**
|
|
1469
1469
|
* Constructs a new ${toolClassName}Tool.
|
|
1470
1470
|
*
|
|
1471
|
-
* @param array
|
|
1471
|
+
* @param array $configuration
|
|
1472
1472
|
* Plugin configuration.
|
|
1473
|
-
* @param string
|
|
1473
|
+
* @param string $plugin_id
|
|
1474
1474
|
* The plugin ID.
|
|
1475
|
-
* @param mixed
|
|
1475
|
+
* @param mixed $plugin_definition
|
|
1476
1476
|
* The plugin definition.
|
|
1477
|
-
* @param \\Drupal\\${moduleName}\\Service\\AgentExecutorService
|
|
1477
|
+
* @param \\Drupal\\${moduleName}\\Service\\AgentExecutorService $agentService
|
|
1478
1478
|
* The agent executor service.
|
|
1479
1479
|
*/
|
|
1480
1480
|
public function __construct(
|
|
1481
|
-
array
|
|
1482
|
-
string
|
|
1483
|
-
mixed
|
|
1484
|
-
private readonly AgentExecutorService
|
|
1481
|
+
array $configuration,
|
|
1482
|
+
string $plugin_id,
|
|
1483
|
+
mixed $plugin_definition,
|
|
1484
|
+
private readonly AgentExecutorService $agentService,
|
|
1485
1485
|
) {
|
|
1486
|
-
parent::__construct(
|
|
1486
|
+
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
|
1487
1487
|
}
|
|
1488
1488
|
|
|
1489
1489
|
/**
|
|
1490
1490
|
* {@inheritdoc}
|
|
1491
1491
|
*/
|
|
1492
|
-
public static function create(ContainerInterface
|
|
1492
|
+
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition): static {
|
|
1493
1493
|
return new static(
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1494
|
+
$configuration,
|
|
1495
|
+
$plugin_id,
|
|
1496
|
+
$plugin_definition,
|
|
1497
|
+
$container->get('${moduleName}.agent_executor'),
|
|
1498
1498
|
);
|
|
1499
1499
|
}
|
|
1500
1500
|
|
|
@@ -1515,8 +1515,8 @@ class ${toolClassName}Tool extends ToolPluginBase implements ContainerFactoryPlu
|
|
|
1515
1515
|
/**
|
|
1516
1516
|
* {@inheritdoc}
|
|
1517
1517
|
*/
|
|
1518
|
-
public function execute(array
|
|
1519
|
-
return
|
|
1518
|
+
public function execute(array $input): array {
|
|
1519
|
+
return $this->agentService->executeTool('${this.escapePhpString(toolName)}', $input);
|
|
1520
1520
|
}
|
|
1521
1521
|
|
|
1522
1522
|
}
|
|
@@ -1786,43 +1786,43 @@ class ${actionClassName}Action extends ActionBase implements ContainerFactoryPlu
|
|
|
1786
1786
|
/**
|
|
1787
1787
|
* Constructs a new ${actionClassName}Action.
|
|
1788
1788
|
*
|
|
1789
|
-
* @param array
|
|
1789
|
+
* @param array $configuration
|
|
1790
1790
|
* Plugin configuration.
|
|
1791
|
-
* @param string
|
|
1791
|
+
* @param string $plugin_id
|
|
1792
1792
|
* The plugin ID.
|
|
1793
|
-
* @param mixed
|
|
1793
|
+
* @param mixed $plugin_definition
|
|
1794
1794
|
* The plugin definition.
|
|
1795
|
-
* @param \\Drupal\\${moduleName}\\Service\\AgentExecutorService
|
|
1795
|
+
* @param \\Drupal\\${moduleName}\\Service\\AgentExecutorService $agentService
|
|
1796
1796
|
* The agent executor service.
|
|
1797
1797
|
*/
|
|
1798
1798
|
public function __construct(
|
|
1799
|
-
array
|
|
1800
|
-
string
|
|
1801
|
-
mixed
|
|
1802
|
-
private readonly AgentExecutorService
|
|
1799
|
+
array $configuration,
|
|
1800
|
+
string $plugin_id,
|
|
1801
|
+
mixed $plugin_definition,
|
|
1802
|
+
private readonly AgentExecutorService $agentService,
|
|
1803
1803
|
) {
|
|
1804
|
-
parent::__construct(
|
|
1804
|
+
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
|
1805
1805
|
}
|
|
1806
1806
|
|
|
1807
1807
|
/**
|
|
1808
1808
|
* {@inheritdoc}
|
|
1809
1809
|
*/
|
|
1810
|
-
public static function create(ContainerInterface
|
|
1810
|
+
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition): static {
|
|
1811
1811
|
return new static(
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1812
|
+
$configuration,
|
|
1813
|
+
$plugin_id,
|
|
1814
|
+
$plugin_definition,
|
|
1815
|
+
$container->get('${moduleName}.agent_executor'),
|
|
1816
1816
|
);
|
|
1817
1817
|
}
|
|
1818
1818
|
|
|
1819
1819
|
/**
|
|
1820
1820
|
* {@inheritdoc}
|
|
1821
1821
|
*/
|
|
1822
|
-
public function execute(
|
|
1823
|
-
|
|
1824
|
-
'entity_id' =>
|
|
1825
|
-
'entity_type' =>
|
|
1822
|
+
public function execute($entity = NULL): void {
|
|
1823
|
+
$this->agentService->executeTool('${this.escapePhpString(toolName)}', [
|
|
1824
|
+
'entity_id' => $entity?->id(),
|
|
1825
|
+
'entity_type' => $entity?->getEntityTypeId(),
|
|
1826
1826
|
'operation' => '${operation}',
|
|
1827
1827
|
]);
|
|
1828
1828
|
}
|
|
@@ -1830,8 +1830,8 @@ class ${actionClassName}Action extends ActionBase implements ContainerFactoryPlu
|
|
|
1830
1830
|
/**
|
|
1831
1831
|
* {@inheritdoc}
|
|
1832
1832
|
*/
|
|
1833
|
-
public function access(
|
|
1834
|
-
return
|
|
1833
|
+
public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
|
|
1834
|
+
return $object->access('${accessOp}', $account, $return_as_object);
|
|
1835
1835
|
}
|
|
1836
1836
|
|
|
1837
1837
|
}
|
|
@@ -1901,33 +1901,33 @@ class AgentEnabledCondition extends ConditionPluginBase implements ContainerFact
|
|
|
1901
1901
|
/**
|
|
1902
1902
|
* Constructs a new AgentEnabledCondition.
|
|
1903
1903
|
*
|
|
1904
|
-
* @param array
|
|
1904
|
+
* @param array $configuration
|
|
1905
1905
|
* Plugin configuration.
|
|
1906
|
-
* @param string
|
|
1906
|
+
* @param string $plugin_id
|
|
1907
1907
|
* The plugin ID.
|
|
1908
|
-
* @param mixed
|
|
1908
|
+
* @param mixed $plugin_definition
|
|
1909
1909
|
* The plugin definition.
|
|
1910
|
-
* @param \\Drupal\\Core\\Config\\ConfigFactoryInterface
|
|
1910
|
+
* @param \\Drupal\\Core\\Config\\ConfigFactoryInterface $configFactory
|
|
1911
1911
|
* The config factory service.
|
|
1912
1912
|
*/
|
|
1913
1913
|
public function __construct(
|
|
1914
|
-
array
|
|
1915
|
-
string
|
|
1916
|
-
mixed
|
|
1917
|
-
private readonly ConfigFactoryInterface
|
|
1914
|
+
array $configuration,
|
|
1915
|
+
string $plugin_id,
|
|
1916
|
+
mixed $plugin_definition,
|
|
1917
|
+
private readonly ConfigFactoryInterface $configFactory,
|
|
1918
1918
|
) {
|
|
1919
|
-
parent::__construct(
|
|
1919
|
+
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
|
1920
1920
|
}
|
|
1921
1921
|
|
|
1922
1922
|
/**
|
|
1923
1923
|
* {@inheritdoc}
|
|
1924
1924
|
*/
|
|
1925
|
-
public static function create(ContainerInterface
|
|
1925
|
+
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition): static {
|
|
1926
1926
|
return new static(
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1927
|
+
$configuration,
|
|
1928
|
+
$plugin_id,
|
|
1929
|
+
$plugin_definition,
|
|
1930
|
+
$container->get('config.factory'),
|
|
1931
1931
|
);
|
|
1932
1932
|
}
|
|
1933
1933
|
|
|
@@ -1943,50 +1943,50 @@ class AgentEnabledCondition extends ConditionPluginBase implements ContainerFact
|
|
|
1943
1943
|
/**
|
|
1944
1944
|
* {@inheritdoc}
|
|
1945
1945
|
*/
|
|
1946
|
-
public function buildConfigurationForm(array
|
|
1947
|
-
|
|
1946
|
+
public function buildConfigurationForm(array $form, FormStateInterface $form_state): array {
|
|
1947
|
+
$form['agent_id'] = [
|
|
1948
1948
|
'#type' => 'textfield',
|
|
1949
|
-
'#title' =>
|
|
1950
|
-
'#default_value' =>
|
|
1951
|
-
'#description' =>
|
|
1949
|
+
'#title' => $this->t('Agent ID'),
|
|
1950
|
+
'#default_value' => $this->configuration['agent_id'],
|
|
1951
|
+
'#description' => $this->t('The OSSA agent identifier to check.'),
|
|
1952
1952
|
'#required' => TRUE,
|
|
1953
1953
|
];
|
|
1954
1954
|
|
|
1955
|
-
return parent::buildConfigurationForm(
|
|
1955
|
+
return parent::buildConfigurationForm($form, $form_state);
|
|
1956
1956
|
}
|
|
1957
1957
|
|
|
1958
1958
|
/**
|
|
1959
1959
|
* {@inheritdoc}
|
|
1960
1960
|
*/
|
|
1961
|
-
public function submitConfigurationForm(array
|
|
1962
|
-
|
|
1963
|
-
parent::submitConfigurationForm(
|
|
1961
|
+
public function submitConfigurationForm(array &$form, FormStateInterface $form_state): void {
|
|
1962
|
+
$this->configuration['agent_id'] = $form_state->getValue('agent_id');
|
|
1963
|
+
parent::submitConfigurationForm($form, $form_state);
|
|
1964
1964
|
}
|
|
1965
1965
|
|
|
1966
1966
|
/**
|
|
1967
1967
|
* {@inheritdoc}
|
|
1968
1968
|
*/
|
|
1969
1969
|
public function evaluate(): bool {
|
|
1970
|
-
|
|
1970
|
+
$config = $this->configFactory->get('${moduleName}.settings');
|
|
1971
1971
|
|
|
1972
1972
|
// Check if auto-execution is enabled (agent is active)
|
|
1973
|
-
|
|
1973
|
+
$enabled = (bool) $config->get('auto_execute_on_save');
|
|
1974
1974
|
|
|
1975
|
-
return
|
|
1975
|
+
return $this->isNegated() ? !$enabled : $enabled;
|
|
1976
1976
|
}
|
|
1977
1977
|
|
|
1978
1978
|
/**
|
|
1979
1979
|
* {@inheritdoc}
|
|
1980
1980
|
*/
|
|
1981
1981
|
public function summary(): TranslatableMarkup {
|
|
1982
|
-
if (
|
|
1982
|
+
if ($this->isNegated()) {
|
|
1983
1983
|
return new TranslatableMarkup('OSSA agent @agent is disabled', [
|
|
1984
|
-
'@agent' =>
|
|
1984
|
+
'@agent' => $this->configuration['agent_id'],
|
|
1985
1985
|
]);
|
|
1986
1986
|
}
|
|
1987
1987
|
|
|
1988
1988
|
return new TranslatableMarkup('OSSA agent @agent is enabled', [
|
|
1989
|
-
'@agent' =>
|
|
1989
|
+
'@agent' => $this->configuration['agent_id'],
|
|
1990
1990
|
]);
|
|
1991
1991
|
}
|
|
1992
1992
|
|
|
@@ -2011,27 +2011,27 @@ class AgentEnabledCondition extends ConditionPluginBase implements ContainerFact
|
|
|
2011
2011
|
// Build evaluation logic based on guardrail type
|
|
2012
2012
|
let evaluateBody;
|
|
2013
2013
|
if (guardType === 'input' && blockedPatterns.length > 0) {
|
|
2014
|
-
evaluateBody = `
|
|
2015
|
-
|
|
2014
|
+
evaluateBody = ` $content = $this->configuration['content'] ?? '';
|
|
2015
|
+
$blocked_patterns = ${patternsPhp};
|
|
2016
2016
|
|
|
2017
|
-
foreach (
|
|
2018
|
-
if (str_contains(
|
|
2019
|
-
return
|
|
2017
|
+
foreach ($blocked_patterns as $pattern) {
|
|
2018
|
+
if (str_contains($content, $pattern)) {
|
|
2019
|
+
return $this->isNegated() ? TRUE : FALSE;
|
|
2020
2020
|
}
|
|
2021
2021
|
}
|
|
2022
2022
|
|
|
2023
|
-
return
|
|
2023
|
+
return $this->isNegated() ? FALSE : TRUE;`;
|
|
2024
2024
|
}
|
|
2025
2025
|
else if (guardType === 'output' && maxLength) {
|
|
2026
|
-
evaluateBody = `
|
|
2027
|
-
|
|
2028
|
-
|
|
2026
|
+
evaluateBody = ` $content = $this->configuration['content'] ?? '';
|
|
2027
|
+
$max_length = ${maxLength};
|
|
2028
|
+
$within_limit = mb_strlen($content) <= $max_length;
|
|
2029
2029
|
|
|
2030
|
-
return
|
|
2030
|
+
return $this->isNegated() ? !$within_limit : $within_limit;`;
|
|
2031
2031
|
}
|
|
2032
2032
|
else {
|
|
2033
2033
|
evaluateBody = ` // Default: condition passes
|
|
2034
|
-
return
|
|
2034
|
+
return !$this->isNegated();`;
|
|
2035
2035
|
}
|
|
2036
2036
|
return `<?php
|
|
2037
2037
|
|
|
@@ -109,5 +109,6 @@ export default DrupalAdapter;
|
|
|
109
109
|
export { DrupalModuleGenerator, type DrupalModuleGeneratorOptions, } from './generator.js';
|
|
110
110
|
export { DrupalAdapter as DrupalRuntimeAdapter } from './adapter.js';
|
|
111
111
|
export { DrupalManifestExporter, type DrupalManifestExportOptions, } from './manifest-exporter.js';
|
|
112
|
+
export { renderTwigTemplate, generateAgentTemplate, generateConfigSchema, } from './twig-renderer.js';
|
|
112
113
|
export { sanitizeModuleName, toClassName, toLabel, validateDrupalCompatibility, buildValidationResult, buildComposerJson, generateBaseInfoYml, extractCapabilities, extractTools, mapOssaToolToDrupalTool, mapAllOssaToolsToDrupal, type DrupalModuleOptions, type DrupalToolDefinition, type DrupalComposerJson, type OssaToolEntry, } from './drupal-utils.js';
|
|
113
114
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -294,6 +294,8 @@ export { DrupalModuleGenerator, } from './generator.js';
|
|
|
294
294
|
export { DrupalAdapter as DrupalRuntimeAdapter } from './adapter.js';
|
|
295
295
|
// Export manifest exporter (minimal package - separation of duties)
|
|
296
296
|
export { DrupalManifestExporter, } from './manifest-exporter.js';
|
|
297
|
+
// Export Twig renderer (uses twig-drupal-filters for proper Drupal template generation)
|
|
298
|
+
export { renderTwigTemplate, generateAgentTemplate, generateConfigSchema, } from './twig-renderer.js';
|
|
297
299
|
// Export shared Drupal utilities
|
|
298
300
|
export { sanitizeModuleName, toClassName, toLabel, validateDrupalCompatibility, buildValidationResult, buildComposerJson, generateBaseInfoYml, extractCapabilities, extractTools, mapOssaToolToDrupalTool, mapAllOssaToolsToDrupal, } from './drupal-utils.js';
|
|
299
301
|
//# sourceMappingURL=index.js.map
|