@bluefly/openstandardagents 0.3.1 → 0.3.2
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/.devfile.yaml +87 -0
- package/.gitlab-ci-trigger +1 -0
- package/.wiki-config.json +24 -0
- package/CHANGELOG.md +212 -1
- package/README.md +31 -56
- package/dist/adapters/anthropic/runtime.js +2 -2
- package/dist/adapters/anthropic/runtime.js.map +1 -1
- package/dist/bot/architecture-validator-bot.d.ts +8 -0
- package/dist/bot/architecture-validator-bot.d.ts.map +1 -0
- package/dist/bot/architecture-validator-bot.js +15 -0
- package/dist/bot/architecture-validator-bot.js.map +1 -0
- package/dist/bot/ci-pipeline-bot.d.ts +7 -0
- package/dist/bot/ci-pipeline-bot.d.ts.map +1 -0
- package/dist/bot/ci-pipeline-bot.js +7 -0
- package/dist/bot/ci-pipeline-bot.js.map +1 -0
- package/dist/bot/compliance-bot.d.ts +56 -0
- package/dist/bot/compliance-bot.d.ts.map +1 -0
- package/dist/bot/compliance-bot.js +203 -0
- package/dist/bot/compliance-bot.js.map +1 -0
- package/dist/bot/dependency-updater-bot.d.ts +9 -0
- package/dist/bot/dependency-updater-bot.d.ts.map +1 -0
- package/dist/bot/dependency-updater-bot.js +9 -0
- package/dist/bot/dependency-updater-bot.js.map +1 -0
- package/dist/bot/security-scanner-bot.d.ts +11 -0
- package/dist/bot/security-scanner-bot.d.ts.map +1 -0
- package/dist/bot/security-scanner-bot.js +21 -0
- package/dist/bot/security-scanner-bot.js.map +1 -0
- package/dist/cli/commands/agent-card.command.d.ts +11 -0
- package/dist/cli/commands/agent-card.command.d.ts.map +1 -0
- package/dist/cli/commands/agent-card.command.js +285 -0
- package/dist/cli/commands/agent-card.command.js.map +1 -0
- package/dist/cli/commands/agents.command.d.ts +11 -0
- package/dist/cli/commands/agents.command.d.ts.map +1 -0
- package/dist/cli/commands/agents.command.js +326 -0
- package/dist/cli/commands/agents.command.js.map +1 -0
- package/dist/cli/commands/generate.command.d.ts +13 -2
- package/dist/cli/commands/generate.command.d.ts.map +1 -1
- package/dist/cli/commands/generate.command.js +204 -29
- package/dist/cli/commands/generate.command.js.map +1 -1
- package/dist/cli/commands/registry.command.d.ts +14 -0
- package/dist/cli/commands/registry.command.d.ts.map +1 -0
- package/dist/cli/commands/registry.command.js +428 -0
- package/dist/cli/commands/registry.command.js.map +1 -0
- package/dist/cli/commands/workspace.command.d.ts +14 -0
- package/dist/cli/commands/workspace.command.d.ts.map +1 -0
- package/dist/cli/commands/workspace.command.js +467 -0
- package/dist/cli/commands/workspace.command.js.map +1 -0
- package/dist/cli/index.js +9 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/di-container.d.ts.map +1 -1
- package/dist/di-container.js +20 -0
- package/dist/di-container.js.map +1 -1
- package/dist/services/codegen/codegen.service.d.ts +75 -0
- package/dist/services/codegen/codegen.service.d.ts.map +1 -0
- package/dist/services/codegen/codegen.service.js +136 -0
- package/dist/services/codegen/codegen.service.js.map +1 -0
- package/dist/services/codegen/generators/manifest.generator.d.ts +41 -0
- package/dist/services/codegen/generators/manifest.generator.d.ts.map +1 -0
- package/dist/services/codegen/generators/manifest.generator.js +178 -0
- package/dist/services/codegen/generators/manifest.generator.js.map +1 -0
- package/dist/services/codegen/generators/openapi.generator.d.ts +46 -0
- package/dist/services/codegen/generators/openapi.generator.d.ts.map +1 -0
- package/dist/services/codegen/generators/openapi.generator.js +157 -0
- package/dist/services/codegen/generators/openapi.generator.js.map +1 -0
- package/dist/services/codegen/generators/types.generator.d.ts +27 -0
- package/dist/services/codegen/generators/types.generator.d.ts.map +1 -0
- package/dist/services/codegen/generators/types.generator.js +97 -0
- package/dist/services/codegen/generators/types.generator.js.map +1 -0
- package/dist/services/codegen/generators/vscode.generator.d.ts +43 -0
- package/dist/services/codegen/generators/vscode.generator.d.ts.map +1 -0
- package/dist/services/codegen/generators/vscode.generator.js +163 -0
- package/dist/services/codegen/generators/vscode.generator.js.map +1 -0
- package/dist/services/codegen/generators/zod.generator.d.ts +31 -0
- package/dist/services/codegen/generators/zod.generator.d.ts.map +1 -0
- package/dist/services/codegen/generators/zod.generator.js +134 -0
- package/dist/services/codegen/generators/zod.generator.js.map +1 -0
- package/dist/services/codegen/index.d.ts +33 -0
- package/dist/services/codegen/index.d.ts.map +1 -0
- package/dist/services/codegen/index.js +36 -0
- package/dist/services/codegen/index.js.map +1 -0
- package/dist/spec/extensions/openapi/ossa-openapi-extensions.schema.json +804 -0
- package/dist/spec/v0.3.0/examples/drupal-content-writer.ossa.yaml +1 -1
- package/dist/spec/v0.3.0/examples/drupal-moderation-assistant.ossa.yaml +1 -1
- package/dist/spec/v0.3.0/examples/quick-wins/complete-agent-with-quick-wins.ossa.yaml +1 -1
- package/dist/spec/v0.3.0/runtime-bindings/anthropic.yaml +209 -0
- package/dist/spec/v0.3.1/examples/agent-with-identity.ossa.yaml +68 -0
- package/dist/spec/v0.3.1/examples/drupal-content-writer.ossa.yaml +1 -1
- package/dist/spec/v0.3.1/examples/drupal-moderation-assistant.ossa.yaml +1 -1
- package/dist/spec/v0.3.1/examples/multi-provider-identity.ossa.yaml +236 -0
- package/dist/spec/v0.3.1/examples/quick-wins/complete-agent-with-quick-wins.ossa.yaml +1 -1
- package/dist/spec/v0.3.1/extensions/agent-identity.yaml +594 -0
- package/dist/spec/v0.3.1/ossa-0.3.1.schema.json +300 -21
- package/dist/spec/v0.3.2/MIGRATION-v0.3.1-to-v0.3.2.md +293 -0
- package/dist/spec/v0.3.2/UNIFIED-SCHEMA.md +120 -0
- package/dist/spec/v0.3.2/access_tiers.yaml +375 -0
- package/dist/spec/v0.3.2/adapters/drupal.md +541 -0
- package/dist/spec/v0.3.2/adapters/symfony.md +659 -0
- package/dist/spec/v0.3.2/agent-test.schema.json +75 -0
- package/dist/spec/v0.3.2/examples/access-tiers/README.md +106 -0
- package/dist/spec/v0.3.2/examples/access-tiers/code-critic.ossa.yaml +119 -0
- package/dist/spec/v0.3.2/examples/access-tiers/compliance-governor.ossa.yaml +234 -0
- package/dist/spec/v0.3.2/examples/access-tiers/deployment-operator.ossa.yaml +201 -0
- package/dist/spec/v0.3.2/examples/access-tiers/doc-generator.ossa.yaml +117 -0
- package/dist/spec/v0.3.2/examples/access-tiers/security-scanner.ossa.yaml +133 -0
- package/dist/spec/v0.3.2/examples/agent-with-identity.ossa.yaml +68 -0
- package/dist/spec/v0.3.2/examples/drupal-content-writer.ossa.yaml +110 -0
- package/dist/spec/v0.3.2/examples/drupal-moderation-assistant.ossa.yaml +96 -0
- package/dist/spec/v0.3.2/examples/multi-provider-identity.ossa.yaml +236 -0
- package/dist/spec/v0.3.2/examples/quick-wins/complete-agent-with-quick-wins.ossa.yaml +144 -0
- package/dist/spec/v0.3.2/examples/tasks/data-transform.ossa.yaml +147 -0
- package/dist/spec/v0.3.2/examples/tasks/publish-content.ossa.yaml +125 -0
- package/dist/spec/v0.3.2/examples/workflows/content-publishing.ossa.yaml +190 -0
- package/dist/spec/v0.3.2/examples/workflows/deployment-pipeline.ossa.yaml +247 -0
- package/dist/spec/v0.3.2/extensions/agent-identity.yaml +594 -0
- package/dist/spec/v0.3.2/extensions/drupal.md +417 -0
- package/dist/spec/v0.3.2/infrastructure/service-ports.yaml +324 -0
- package/dist/spec/{v0.3.1/ossa-0.3.0.schema.json → v0.3.2/ossa-0.3.2.schema.json} +563 -34
- package/dist/spec/v0.3.2/protocols/delegation.yaml +239 -0
- package/dist/spec/v0.3.2/protocols/sse.md +494 -0
- package/dist/spec/v0.3.2/protocols/webrtc.md +600 -0
- package/dist/spec/v0.3.2/protocols/websocket.md +362 -0
- package/dist/spec/v0.3.2/runtime/RUNTIME.md +457 -0
- package/dist/spec/v0.3.2/runtime/memory-model.yaml +871 -0
- package/dist/spec/v0.3.2/runtime/runtime.yaml +926 -0
- package/dist/spec/v0.3.2/schemas/agent-unified.yaml +165 -0
- package/dist/spec/v0.3.2/schemas/capabilities.yaml +102 -0
- package/dist/spec/v0.3.2/schemas/functions.yaml +75 -0
- package/dist/spec/v0.3.2/schemas/messaging/channel.schema.json +245 -0
- package/dist/spec/v0.3.2/schemas/messaging/delivery-receipt.schema.json +192 -0
- package/dist/spec/v0.3.2/schemas/messaging/message.schema.json +205 -0
- package/dist/spec/v0.3.2/schemas/messaging/subscription.schema.json +214 -0
- package/dist/spec/v0.3.2/schemas/runtime.yaml +102 -0
- package/dist/spec/v0.3.2/schemas/taxonomy.yaml +533 -0
- package/dist/spec/v0.3.2/schemas/unified-llm.yaml +91 -0
- package/dist/spec/v0.3.2/taxonomy.yaml +363 -0
- package/dist/types/generated/ossa-0.3.2.types.d.ts +367 -0
- package/dist/types/generated/ossa-0.3.2.types.d.ts.map +1 -0
- package/dist/types/generated/ossa-0.3.2.types.js +10 -0
- package/dist/types/generated/ossa-0.3.2.types.js.map +1 -0
- package/dist/types/generated/ossa-0.3.2.zod.d.ts +36 -0
- package/dist/types/generated/ossa-0.3.2.zod.d.ts.map +1 -0
- package/dist/types/generated/ossa-0.3.2.zod.js +25 -0
- package/dist/types/generated/ossa-0.3.2.zod.js.map +1 -0
- package/examples/adapters/drupal-eca-mapping.yaml +1 -1
- package/examples/adapters/drupal-eca-task.yaml +1 -1
- package/examples/adapters/drupal-flowdrop-mapping.yaml +1 -1
- package/examples/adapters/drupal-maestro-mapping.yaml +1 -1
- package/examples/adapters/mistral-agent.yaml +1 -1
- package/examples/adapters/symfony-messenger-task.yaml +1 -1
- package/examples/adapters/symfony-messenger-workflow.yaml +1 -1
- package/examples/adk-integration/code-review-workflow.yml +1 -1
- package/examples/adk-integration/customer-support.yml +1 -1
- package/examples/adk-integration/data-pipeline.yml +1 -1
- package/examples/advanced/reasoning-agent.yaml +1 -1
- package/examples/advanced/workflows/hybrid-model-strategy.yaml +1 -1
- package/examples/agent-manifests/critics/critic-agent.yaml +1 -1
- package/examples/agent-manifests/governors/governor-agent.yaml +1 -1
- package/examples/agent-manifests/integrators/integrator-agent.yaml +1 -1
- package/examples/agent-manifests/judges/judge-agent.yaml +1 -1
- package/examples/agent-manifests/monitors/monitor-agent.yaml +1 -1
- package/examples/agent-manifests/orchestrators/orchestrator-agent.yaml +1 -1
- package/examples/agent-manifests/sample-compliant-agent.yaml +1 -1
- package/examples/agent-manifests/workers/worker-agent.yaml +1 -1
- package/examples/agents/architecture-healer-enterprise.yaml +1 -1
- package/examples/agents/dependency-healer-npm.yaml +1 -1
- package/examples/agents/spec-healer-openapi.yaml +1 -1
- package/examples/agents/wiki-healer-production.yaml +1 -1
- package/examples/agents-md/code-agent.ossa.json +36 -11
- package/examples/agents-md/monorepo-agent.ossa.yaml +1 -1
- package/examples/anthropic/claude-assistant.ossa.json +4 -4
- package/examples/autogen/multi-agent.ossa.json +2 -2
- package/examples/autonomous-evolution/self-evolving-agent.ossa.yaml +1 -1
- package/examples/claude-code/code-reviewer.ossa.yaml +1 -1
- package/examples/claude-code/ossa-validator.ossa.yaml +1 -1
- package/examples/common_npm/agent-router.ossa.yaml +1 -1
- package/examples/contracts/data-consumer.ossa.yaml +1 -1
- package/examples/contracts/data-producer-v2.ossa.yaml +1 -1
- package/examples/contracts/data-producer.ossa.yaml +1 -1
- package/examples/crewai/research-team.ossa.json +2 -2
- package/examples/cursor/code-review-agent.ossa.json +2 -2
- package/examples/drupal/ai_agents_ossa-module/.agents/example-agent/agent.ossa.yaml +1 -1
- package/examples/drupal/gitlab-ml-recommender.ossa.yaml +1 -1
- package/examples/extensions/agents-md-advanced.yml +1 -1
- package/examples/extensions/agents-md-basic.yml +1 -1
- package/examples/extensions/agents-md-sync.yml +1 -1
- package/examples/extensions/agents-md-v1.yml +1 -1
- package/examples/extensions/drupal-v1.yml +1 -1
- package/examples/extensions/encryption-multi-provider.yaml +4 -4
- package/examples/extensions/kagent-v1.yml +1 -1
- package/examples/extensions/knowledge-sources.yaml +1 -1
- package/examples/extensions/mcp-full-featured.yaml +1 -1
- package/examples/getting-started/01-minimal-agent.ossa.yaml +3 -3
- 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 +2 -2
- package/examples/getting-started/05-workflow-composition.ossa.yaml +1 -1
- package/examples/getting-started/hello-world-complete.ossa.yaml +1 -1
- package/examples/integration-patterns/agent-to-agent-orchestration.ossa.yaml +4 -4
- package/examples/kagent/compliance-validator.ossa.yaml +1 -1
- package/examples/kagent/cost-optimizer.ossa.yaml +1 -1
- package/examples/kagent/documentation-agent.ossa.yaml +1 -1
- package/examples/kagent/k8s-troubleshooter-v1.ossa.yaml +1 -1
- package/examples/kagent/k8s-troubleshooter.ossa.yaml +1 -1
- package/examples/kagent/security-scanner.ossa.yaml +1 -1
- package/examples/langchain/chain-agent.ossa.json +2 -2
- package/examples/langflow/workflow-agent.ossa.json +2 -2
- package/examples/langgraph/state-machine-agent.ossa.json +2 -2
- package/examples/llamaindex/rag-agent.ossa.json +2 -2
- package/examples/messaging/dependency-healer.ossa.yaml +1 -1
- package/examples/messaging/incident-responder.ossa.yaml +1 -1
- package/examples/messaging/routing-rules.ossa.yaml +3 -3
- package/examples/messaging/security-scanner.ossa.yaml +1 -1
- package/examples/migration-guides/from-langchain-to-ossa.yaml +4 -4
- package/examples/multi-agent/conditional-router.ossa.yaml +1 -1
- package/examples/multi-agent/parallel-execution.ossa.yaml +1 -1
- package/examples/multi-agent/sequential-pipeline.ossa.yaml +1 -1
- package/examples/observability/activity-stream-full.yaml +1 -1
- package/examples/openai/basic-agent.ossa.yaml +1 -1
- package/examples/openai/multi-tool-agent.ossa.json +2 -2
- package/examples/openai/swarm-agent.ossa.json +2 -2
- package/examples/production/document-analyzer-openai.yml +1 -1
- package/examples/quickstart/support-agent.ossa.yaml +1 -1
- package/examples/real-world/gitlab-cicd-optimizer.ossa.yaml +1 -1
- package/examples/real-world/rag-documentation-assistant.ossa.yaml +1 -1
- package/examples/runtime-adapters/bedrock-claude-example.ossa.yaml +1 -1
- package/examples/schema/reusable-components.yaml +1 -1
- package/examples/showcase/ci-pipeline.ossa.yaml +59 -0
- package/examples/showcase/code-assistant.ossa.yaml +118 -0
- package/examples/showcase/code-reviewer.ossa.yaml +61 -0
- package/examples/showcase/compliance-validator.ossa.yaml +62 -0
- package/examples/showcase/content-writer.ossa.yaml +67 -0
- package/examples/showcase/data-transformer.ossa.yaml +78 -0
- package/examples/showcase/doc-generator.ossa.yaml +68 -0
- package/examples/showcase/security-scanner.ossa.yaml +65 -0
- package/examples/showcase/test-generator.ossa.yaml +63 -0
- package/examples/showcase/workflow-orchestrator.ossa.yaml +129 -0
- package/examples/tasks/batch-email-sender.yaml +1 -1
- package/examples/tasks/data-transform.yaml +1 -1
- package/examples/tasks/publish-content.yaml +1 -1
- package/examples/templates/ossa-compliance.yaml +1 -1
- package/examples/unified/security-scanner.ossa.yaml +1 -1
- package/examples/vercel/edge-agent.ossa.json +2 -2
- package/examples/workflows/batch-email-campaign.yaml +1 -1
- package/examples/workflows/content-review-publish.yaml +1 -1
- package/examples/workflows/simple-etl.yaml +1 -1
- package/llms-ctx-full.txt +39 -0
- package/llms-ctx.txt +39 -0
- package/openapi/agent-communication.yaml +1 -1
- package/openapi/agent-crud.yaml +8 -8
- package/openapi/agent-discovery.yaml +2 -2
- package/openapi/agent-identity.yaml +8 -8
- package/openapi/cli-commands.openapi.yaml +231 -0
- package/openapi/core/ossa-core-api.openapi.yaml +1 -1
- package/openapi/core/ossa-registry-api.openapi.yaml +1 -1
- package/openapi/core/ossa-registry.openapi.yaml +1 -1
- package/openapi/core/unified-agent-gateway.openapi.yaml +1 -1
- package/openapi/github-sync.yaml +1 -1
- package/openapi/protocols/sse-streams.yaml +1 -1
- package/openapi/protocols/websocket-events.yaml +2 -2
- package/openapi/reference-implementations/aiflow-bridge-api.openapi.yaml +2 -2
- package/openapi/reference-implementations/compliance-agent-api.openapi.yaml +1 -1
- package/openapi/reference-implementations/crewai-agent-api.openapi.yaml +1 -1
- package/openapi/reference-implementations/critic-agent-api.openapi.yaml +2 -2
- package/openapi/reference-implementations/document-analyzer-api.openapi.yaml +2 -2
- package/openapi/reference-implementations/drupal-agent-api.openapi.yaml +1 -1
- package/openapi/reference-implementations/getting-started-hello-world-api.openapi.yaml +1 -1
- package/openapi/reference-implementations/gitlab-ml-recommender-api.openapi.yaml +2 -2
- package/openapi/reference-implementations/governor-agent-api.openapi.yaml +1 -1
- package/openapi/reference-implementations/helm-generator.openapi.yaml +1 -1
- package/openapi/reference-implementations/integrator-agent-api.openapi.yaml +1 -1
- package/openapi/reference-implementations/judge-agent-api.openapi.yaml +1 -1
- package/openapi/reference-implementations/k8s-troubleshooter-api.openapi.yaml +2 -2
- package/openapi/reference-implementations/langchain-agent-api.openapi.yaml +1 -1
- package/openapi/reference-implementations/monitor-agent-api.openapi.yaml +2 -2
- package/openapi/reference-implementations/orchestrator-agent-api.openapi.yaml +1 -1
- package/openapi/reference-implementations/quickstart-support-agent-api.openapi.yaml +2 -2
- package/openapi/reference-implementations/self-evolving-ecosystem.openapi.yaml +1 -1
- package/openapi/reference-implementations/worker-agent-api.openapi.yaml +2 -2
- package/openapi/reference-implementations/workflow-orchestrator-api.openapi.yaml +1 -1
- package/package.json +13 -3
- package/spec/extensions/openapi/ossa-openapi-extensions.schema.json +804 -0
- package/spec/v0.3.0/examples/drupal-content-writer.ossa.yaml +1 -1
- package/spec/v0.3.0/examples/drupal-moderation-assistant.ossa.yaml +1 -1
- package/spec/v0.3.0/examples/quick-wins/complete-agent-with-quick-wins.ossa.yaml +1 -1
- package/spec/v0.3.0/runtime-bindings/anthropic.yaml +209 -0
- package/spec/v0.3.1/examples/agent-with-identity.ossa.yaml +68 -0
- package/spec/v0.3.1/examples/drupal-content-writer.ossa.yaml +1 -1
- package/spec/v0.3.1/examples/drupal-moderation-assistant.ossa.yaml +1 -1
- package/spec/v0.3.1/examples/multi-provider-identity.ossa.yaml +236 -0
- package/spec/v0.3.1/examples/quick-wins/complete-agent-with-quick-wins.ossa.yaml +1 -1
- package/spec/v0.3.1/extensions/agent-identity.yaml +594 -0
- package/spec/v0.3.1/ossa-0.3.1.schema.json +300 -21
- package/spec/v0.3.2/MIGRATION-v0.3.1-to-v0.3.2.md +293 -0
- package/spec/v0.3.2/UNIFIED-SCHEMA.md +120 -0
- package/spec/v0.3.2/access_tiers.yaml +375 -0
- package/spec/v0.3.2/adapters/drupal.md +541 -0
- package/spec/v0.3.2/adapters/symfony.md +659 -0
- package/spec/v0.3.2/agent-test.schema.json +75 -0
- package/spec/v0.3.2/examples/access-tiers/README.md +106 -0
- package/spec/v0.3.2/examples/access-tiers/code-critic.ossa.yaml +119 -0
- package/spec/v0.3.2/examples/access-tiers/compliance-governor.ossa.yaml +234 -0
- package/spec/v0.3.2/examples/access-tiers/deployment-operator.ossa.yaml +201 -0
- package/spec/v0.3.2/examples/access-tiers/doc-generator.ossa.yaml +117 -0
- package/spec/v0.3.2/examples/access-tiers/security-scanner.ossa.yaml +133 -0
- package/spec/v0.3.2/examples/agent-with-identity.ossa.yaml +68 -0
- package/spec/v0.3.2/examples/drupal-content-writer.ossa.yaml +110 -0
- package/spec/v0.3.2/examples/drupal-moderation-assistant.ossa.yaml +96 -0
- package/spec/v0.3.2/examples/multi-provider-identity.ossa.yaml +236 -0
- package/spec/v0.3.2/examples/quick-wins/complete-agent-with-quick-wins.ossa.yaml +144 -0
- package/spec/v0.3.2/examples/tasks/data-transform.ossa.yaml +147 -0
- package/spec/v0.3.2/examples/tasks/publish-content.ossa.yaml +125 -0
- package/spec/v0.3.2/examples/workflows/content-publishing.ossa.yaml +190 -0
- package/spec/v0.3.2/examples/workflows/deployment-pipeline.ossa.yaml +247 -0
- package/spec/v0.3.2/extensions/agent-identity.yaml +594 -0
- package/spec/v0.3.2/extensions/drupal.md +417 -0
- package/spec/v0.3.2/infrastructure/service-ports.yaml +324 -0
- package/spec/{v0.3.1/ossa-0.3.0.schema.json → v0.3.2/ossa-0.3.2.schema.json} +563 -34
- package/spec/v0.3.2/protocols/delegation.yaml +239 -0
- package/spec/v0.3.2/protocols/sse.md +494 -0
- package/spec/v0.3.2/protocols/webrtc.md +600 -0
- package/spec/v0.3.2/protocols/websocket.md +362 -0
- package/spec/v0.3.2/runtime/RUNTIME.md +457 -0
- package/spec/v0.3.2/runtime/memory-model.yaml +871 -0
- package/spec/v0.3.2/runtime/runtime.yaml +926 -0
- package/spec/v0.3.2/schemas/agent-unified.yaml +165 -0
- package/spec/v0.3.2/schemas/capabilities.yaml +102 -0
- package/spec/v0.3.2/schemas/functions.yaml +75 -0
- package/spec/v0.3.2/schemas/messaging/channel.schema.json +245 -0
- package/spec/v0.3.2/schemas/messaging/delivery-receipt.schema.json +192 -0
- package/spec/v0.3.2/schemas/messaging/message.schema.json +205 -0
- package/spec/v0.3.2/schemas/messaging/subscription.schema.json +214 -0
- package/spec/v0.3.2/schemas/runtime.yaml +102 -0
- package/spec/v0.3.2/schemas/taxonomy.yaml +533 -0
- package/spec/v0.3.2/schemas/unified-llm.yaml +91 -0
- package/spec/v0.3.2/taxonomy.yaml +363 -0
- package/examples/common_npm/agent-router.v0.2.2.ossa.yaml +0 -60
- package/examples/drupal/gitlab-ml-recommender.v0.2.2.ossa.yaml +0 -68
- package/examples/kagent/k8s-troubleshooter-v1.v0.2.2.ossa.yaml +0 -106
|
@@ -0,0 +1,600 @@
|
|
|
1
|
+
# WebRTC Transport Protocol for Peer-to-Peer Agents
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
WebRTC (Web Real-Time Communication) enables direct peer-to-peer communication between OSSA agents, bypassing centralized servers after initial connection setup. This specification defines how agents use WebRTC for low-latency, high-throughput agent-to-agent communication.
|
|
6
|
+
|
|
7
|
+
## Architecture
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
Agent A ──────WebRTC P2P Data Channel────── Agent B
|
|
11
|
+
│ │
|
|
12
|
+
└─────────Signaling Server─────────────────┘
|
|
13
|
+
(Only for connection setup)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
WebRTC provides:
|
|
17
|
+
|
|
18
|
+
- **Peer-to-peer data channels** - Direct agent-to-agent communication
|
|
19
|
+
- **NAT traversal** - Works across firewalls and NAT
|
|
20
|
+
- **Built-in encryption** - DTLS encryption by default
|
|
21
|
+
- **Multiple channels** - Multiplexed streams over single connection
|
|
22
|
+
- **Ordered/Unordered delivery** - Configure per channel
|
|
23
|
+
|
|
24
|
+
## Connection Establishment
|
|
25
|
+
|
|
26
|
+
### 1. Signaling Phase
|
|
27
|
+
|
|
28
|
+
Agents exchange connection metadata via signaling server (WebSocket, HTTP, etc.):
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
// Agent A creates offer
|
|
32
|
+
const peerConnection = new RTCPeerConnection({
|
|
33
|
+
iceServers: [
|
|
34
|
+
{ urls: 'stun:stun.l.google.com:19302' },
|
|
35
|
+
{
|
|
36
|
+
urls: 'turn:turn.example.com:3478',
|
|
37
|
+
username: 'agent-a',
|
|
38
|
+
credential: 'secret'
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const offer = await peerConnection.createOffer();
|
|
44
|
+
await peerConnection.setLocalDescription(offer);
|
|
45
|
+
|
|
46
|
+
// Send offer to Agent B via signaling server
|
|
47
|
+
signaling.send({
|
|
48
|
+
type: 'offer',
|
|
49
|
+
from: 'agent://example.com/agent-a',
|
|
50
|
+
to: 'agent://example.com/agent-b',
|
|
51
|
+
sdp: offer.sdp
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Agent B receives offer and creates answer
|
|
55
|
+
peerConnection.setRemoteDescription(offer);
|
|
56
|
+
const answer = await peerConnection.createAnswer();
|
|
57
|
+
await peerConnection.setLocalDescription(answer);
|
|
58
|
+
|
|
59
|
+
// Send answer back to Agent A
|
|
60
|
+
signaling.send({
|
|
61
|
+
type: 'answer',
|
|
62
|
+
from: 'agent://example.com/agent-b',
|
|
63
|
+
to: 'agent://example.com/agent-a',
|
|
64
|
+
sdp: answer.sdp
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 2. ICE Candidate Exchange
|
|
69
|
+
|
|
70
|
+
Agents exchange network connectivity information:
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
peerConnection.onicecandidate = (event) => {
|
|
74
|
+
if (event.candidate) {
|
|
75
|
+
signaling.send({
|
|
76
|
+
type: 'ice-candidate',
|
|
77
|
+
from: agentId,
|
|
78
|
+
to: remoteAgentId,
|
|
79
|
+
candidate: event.candidate
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// Receive ICE candidates from remote agent
|
|
85
|
+
signaling.on('ice-candidate', async (data) => {
|
|
86
|
+
await peerConnection.addIceCandidate(data.candidate);
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 3. Data Channel Creation
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
// Agent A creates data channel
|
|
94
|
+
const dataChannel = peerConnection.createDataChannel('ossa-channel', {
|
|
95
|
+
ordered: true, // Ordered delivery
|
|
96
|
+
maxRetransmits: 3 // Retry failed messages
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
dataChannel.onopen = () => {
|
|
100
|
+
console.log('Data channel open');
|
|
101
|
+
// Channel ready for messaging
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// Agent B receives data channel
|
|
105
|
+
peerConnection.ondatachannel = (event) => {
|
|
106
|
+
const dataChannel = event.channel;
|
|
107
|
+
setupDataChannelHandlers(dataChannel);
|
|
108
|
+
};
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Message Format
|
|
112
|
+
|
|
113
|
+
### OSSA WebRTC Message
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
interface WebRTCMessage {
|
|
117
|
+
type: 'message' | 'capability_call' | 'capability_response' | 'status' | 'error';
|
|
118
|
+
id: string; // Unique message ID
|
|
119
|
+
timestamp: string; // ISO 8601 timestamp
|
|
120
|
+
payload: unknown; // Message-specific data
|
|
121
|
+
metadata: {
|
|
122
|
+
agentId: string; // Sender agent URI
|
|
123
|
+
channelId?: string; // Data channel identifier
|
|
124
|
+
correlationId?: string; // Request/response matching
|
|
125
|
+
priority?: 'low' | 'normal' | 'high' | 'critical';
|
|
126
|
+
ttl?: number; // Time-to-live in seconds
|
|
127
|
+
chunked?: { // For large messages
|
|
128
|
+
chunkIndex: number;
|
|
129
|
+
totalChunks: number;
|
|
130
|
+
messageId: string;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Sending Messages
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
const sendMessage = (channel: RTCDataChannel, message: WebRTCMessage) => {
|
|
140
|
+
if (channel.readyState !== 'open') {
|
|
141
|
+
throw new Error('Data channel not open');
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const data = JSON.stringify(message);
|
|
145
|
+
const maxSize = 16 * 1024; // 16KB chunks
|
|
146
|
+
|
|
147
|
+
if (data.length > maxSize) {
|
|
148
|
+
// Chunk large messages
|
|
149
|
+
sendChunkedMessage(channel, message);
|
|
150
|
+
} else {
|
|
151
|
+
channel.send(data);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Receiving Messages
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
dataChannel.onmessage = (event) => {
|
|
160
|
+
try {
|
|
161
|
+
const message: WebRTCMessage = JSON.parse(event.data);
|
|
162
|
+
|
|
163
|
+
if (message.metadata.chunked) {
|
|
164
|
+
handleChunkedMessage(message);
|
|
165
|
+
} else {
|
|
166
|
+
processMessage(message);
|
|
167
|
+
}
|
|
168
|
+
} catch (error) {
|
|
169
|
+
console.error('Failed to process message:', error);
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Channel Types
|
|
175
|
+
|
|
176
|
+
### 1. Reliable Ordered Channel
|
|
177
|
+
|
|
178
|
+
For critical messages requiring guaranteed delivery:
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
const reliableChannel = peerConnection.createDataChannel('reliable', {
|
|
182
|
+
ordered: true,
|
|
183
|
+
maxPacketLifeTime: undefined,
|
|
184
|
+
maxRetransmits: undefined // Infinite retries
|
|
185
|
+
});
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Use for: Capability calls, critical events, state synchronization
|
|
189
|
+
|
|
190
|
+
### 2. Unreliable Unordered Channel
|
|
191
|
+
|
|
192
|
+
For high-frequency, low-latency updates:
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
const unreliableChannel = peerConnection.createDataChannel('unreliable', {
|
|
196
|
+
ordered: false,
|
|
197
|
+
maxRetransmits: 0 // No retries
|
|
198
|
+
});
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Use for: Real-time telemetry, status updates, metrics
|
|
202
|
+
|
|
203
|
+
### 3. Partial Reliability Channel
|
|
204
|
+
|
|
205
|
+
For time-sensitive data with some retry:
|
|
206
|
+
|
|
207
|
+
```typescript
|
|
208
|
+
const partialChannel = peerConnection.createDataChannel('partial', {
|
|
209
|
+
ordered: true,
|
|
210
|
+
maxRetransmits: 3
|
|
211
|
+
});
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Use for: Events that can tolerate some loss, progress updates
|
|
215
|
+
|
|
216
|
+
## Multiplexing
|
|
217
|
+
|
|
218
|
+
Create multiple logical channels over single peer connection:
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
// Control channel - reliable
|
|
222
|
+
const controlChannel = pc.createDataChannel('control', {
|
|
223
|
+
ordered: true,
|
|
224
|
+
negotiated: true,
|
|
225
|
+
id: 0
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
// Data channel - unreliable
|
|
229
|
+
const dataChannel = pc.createDataChannel('data', {
|
|
230
|
+
ordered: false,
|
|
231
|
+
negotiated: true,
|
|
232
|
+
id: 1
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
// Events channel - partial reliability
|
|
236
|
+
const eventsChannel = pc.createDataChannel('events', {
|
|
237
|
+
ordered: true,
|
|
238
|
+
maxRetransmits: 3,
|
|
239
|
+
negotiated: true,
|
|
240
|
+
id: 2
|
|
241
|
+
});
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Message Chunking
|
|
245
|
+
|
|
246
|
+
Handle large messages (>16KB):
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
const sendChunkedMessage = (
|
|
250
|
+
channel: RTCDataChannel,
|
|
251
|
+
message: WebRTCMessage
|
|
252
|
+
) => {
|
|
253
|
+
const data = JSON.stringify(message);
|
|
254
|
+
const chunkSize = 16 * 1024;
|
|
255
|
+
const totalChunks = Math.ceil(data.length / chunkSize);
|
|
256
|
+
const messageId = uuid();
|
|
257
|
+
|
|
258
|
+
for (let i = 0; i < totalChunks; i++) {
|
|
259
|
+
const chunk = data.slice(i * chunkSize, (i + 1) * chunkSize);
|
|
260
|
+
const chunkMessage: WebRTCMessage = {
|
|
261
|
+
...message,
|
|
262
|
+
payload: chunk,
|
|
263
|
+
metadata: {
|
|
264
|
+
...message.metadata,
|
|
265
|
+
chunked: {
|
|
266
|
+
chunkIndex: i,
|
|
267
|
+
totalChunks,
|
|
268
|
+
messageId
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
channel.send(JSON.stringify(chunkMessage));
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
const handleChunkedMessage = (chunk: WebRTCMessage) => {
|
|
278
|
+
const { messageId, chunkIndex, totalChunks } = chunk.metadata.chunked!;
|
|
279
|
+
|
|
280
|
+
if (!chunks.has(messageId)) {
|
|
281
|
+
chunks.set(messageId, { parts: [], received: 0 });
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const message = chunks.get(messageId)!;
|
|
285
|
+
message.parts[chunkIndex] = chunk.payload;
|
|
286
|
+
message.received++;
|
|
287
|
+
|
|
288
|
+
if (message.received === totalChunks) {
|
|
289
|
+
const fullData = message.parts.join('');
|
|
290
|
+
const fullMessage = JSON.parse(fullData);
|
|
291
|
+
processMessage(fullMessage);
|
|
292
|
+
chunks.delete(messageId);
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
## Signaling Protocol
|
|
298
|
+
|
|
299
|
+
### Signaling Server API
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
interface SignalingMessage {
|
|
303
|
+
type: 'offer' | 'answer' | 'ice-candidate' | 'error';
|
|
304
|
+
from: string; // Sender agent URI
|
|
305
|
+
to: string; // Recipient agent URI
|
|
306
|
+
sessionId?: string; // WebRTC session ID
|
|
307
|
+
sdp?: string; // SDP offer/answer
|
|
308
|
+
candidate?: RTCIceCandidate;
|
|
309
|
+
error?: {
|
|
310
|
+
code: string;
|
|
311
|
+
message: string;
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// Signaling via WebSocket
|
|
316
|
+
signaling.on('message', async (msg: SignalingMessage) => {
|
|
317
|
+
switch (msg.type) {
|
|
318
|
+
case 'offer':
|
|
319
|
+
await handleOffer(msg.sdp);
|
|
320
|
+
break;
|
|
321
|
+
case 'answer':
|
|
322
|
+
await handleAnswer(msg.sdp);
|
|
323
|
+
break;
|
|
324
|
+
case 'ice-candidate':
|
|
325
|
+
await pc.addIceCandidate(msg.candidate);
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
## NAT Traversal
|
|
332
|
+
|
|
333
|
+
### STUN Servers
|
|
334
|
+
|
|
335
|
+
For discovering public IP addresses:
|
|
336
|
+
|
|
337
|
+
```typescript
|
|
338
|
+
{
|
|
339
|
+
iceServers: [
|
|
340
|
+
{ urls: 'stun:stun.l.google.com:19302' },
|
|
341
|
+
{ urls: 'stun:stun1.l.google.com:19302' }
|
|
342
|
+
]
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### TURN Servers
|
|
347
|
+
|
|
348
|
+
For relaying when direct P2P fails:
|
|
349
|
+
|
|
350
|
+
```typescript
|
|
351
|
+
{
|
|
352
|
+
iceServers: [
|
|
353
|
+
{
|
|
354
|
+
urls: 'turn:turn.example.com:3478',
|
|
355
|
+
username: 'agent-credentials',
|
|
356
|
+
credential: 'secret-token'
|
|
357
|
+
}
|
|
358
|
+
],
|
|
359
|
+
iceCandidatePoolSize: 10
|
|
360
|
+
}
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### ICE Strategy
|
|
364
|
+
|
|
365
|
+
```typescript
|
|
366
|
+
const config: RTCConfiguration = {
|
|
367
|
+
iceServers: [...],
|
|
368
|
+
iceTransportPolicy: 'all', // Try all candidates
|
|
369
|
+
bundlePolicy: 'max-bundle', // Bundle media/data
|
|
370
|
+
rtcpMuxPolicy: 'require' // Multiplex RTCP
|
|
371
|
+
};
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
## Connection Management
|
|
375
|
+
|
|
376
|
+
### Connection State Monitoring
|
|
377
|
+
|
|
378
|
+
```typescript
|
|
379
|
+
peerConnection.onconnectionstatechange = () => {
|
|
380
|
+
switch (peerConnection.connectionState) {
|
|
381
|
+
case 'connected':
|
|
382
|
+
console.log('Peer-to-peer connection established');
|
|
383
|
+
break;
|
|
384
|
+
case 'disconnected':
|
|
385
|
+
console.log('Connection lost, attempting reconnect...');
|
|
386
|
+
reconnect();
|
|
387
|
+
break;
|
|
388
|
+
case 'failed':
|
|
389
|
+
console.error('Connection failed');
|
|
390
|
+
cleanup();
|
|
391
|
+
break;
|
|
392
|
+
case 'closed':
|
|
393
|
+
console.log('Connection closed');
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### Reconnection Strategy
|
|
400
|
+
|
|
401
|
+
```typescript
|
|
402
|
+
const reconnect = async () => {
|
|
403
|
+
const maxAttempts = 5;
|
|
404
|
+
let attempt = 0;
|
|
405
|
+
|
|
406
|
+
while (attempt < maxAttempts) {
|
|
407
|
+
try {
|
|
408
|
+
await establishConnection();
|
|
409
|
+
return;
|
|
410
|
+
} catch (error) {
|
|
411
|
+
attempt++;
|
|
412
|
+
const delay = Math.min(1000 * Math.pow(2, attempt), 30000);
|
|
413
|
+
await sleep(delay);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
console.error('Failed to reconnect after', maxAttempts, 'attempts');
|
|
418
|
+
};
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### Keep-Alive
|
|
422
|
+
|
|
423
|
+
Send periodic heartbeats to maintain connection:
|
|
424
|
+
|
|
425
|
+
```typescript
|
|
426
|
+
const heartbeatInterval = setInterval(() => {
|
|
427
|
+
if (dataChannel.readyState === 'open') {
|
|
428
|
+
dataChannel.send(JSON.stringify({
|
|
429
|
+
type: 'heartbeat',
|
|
430
|
+
timestamp: new Date().toISOString()
|
|
431
|
+
}));
|
|
432
|
+
}
|
|
433
|
+
}, 30000);
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
## Security
|
|
437
|
+
|
|
438
|
+
### Encryption
|
|
439
|
+
|
|
440
|
+
- **DTLS** - Data channels encrypted by default (mandatory)
|
|
441
|
+
- **SRTP** - Media streams encrypted
|
|
442
|
+
- **No plaintext** - All data encrypted in transit
|
|
443
|
+
|
|
444
|
+
### Authentication
|
|
445
|
+
|
|
446
|
+
Authenticate agents before establishing P2P connection:
|
|
447
|
+
|
|
448
|
+
```typescript
|
|
449
|
+
// Include signed token in signaling
|
|
450
|
+
const offer = {
|
|
451
|
+
type: 'offer',
|
|
452
|
+
from: agentId,
|
|
453
|
+
to: remoteAgentId,
|
|
454
|
+
sdp: localDescription.sdp,
|
|
455
|
+
auth: {
|
|
456
|
+
token: await signJWT({ agentId, timestamp: Date.now() }),
|
|
457
|
+
publicKey: agentPublicKey
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
// Verify token on receiving end
|
|
462
|
+
const verifyOffer = async (offer) => {
|
|
463
|
+
const valid = await verifyJWT(offer.auth.token, offer.auth.publicKey);
|
|
464
|
+
if (!valid) {
|
|
465
|
+
throw new Error('Invalid authentication token');
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
### Permissions
|
|
471
|
+
|
|
472
|
+
Restrict P2P connections using allowlists:
|
|
473
|
+
|
|
474
|
+
```typescript
|
|
475
|
+
const allowedPeers = new Set([
|
|
476
|
+
'agent://example.com/agent-1',
|
|
477
|
+
'agent://example.com/agent-2'
|
|
478
|
+
]);
|
|
479
|
+
|
|
480
|
+
signaling.on('offer', (offer) => {
|
|
481
|
+
if (!allowedPeers.has(offer.from)) {
|
|
482
|
+
signaling.send({
|
|
483
|
+
type: 'error',
|
|
484
|
+
to: offer.from,
|
|
485
|
+
error: { code: 'UNAUTHORIZED', message: 'Peer not allowed' }
|
|
486
|
+
});
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
handleOffer(offer);
|
|
491
|
+
});
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
## Performance Optimization
|
|
495
|
+
|
|
496
|
+
### Buffer Management
|
|
497
|
+
|
|
498
|
+
```typescript
|
|
499
|
+
dataChannel.bufferedAmountLowThreshold = 65536; // 64KB
|
|
500
|
+
|
|
501
|
+
dataChannel.onbufferedamountlow = () => {
|
|
502
|
+
// Resume sending after backpressure
|
|
503
|
+
resumeSending();
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
const sendWithBackpressure = (data: string) => {
|
|
507
|
+
if (dataChannel.bufferedAmount > 1024 * 1024) {
|
|
508
|
+
// Buffer full, pause sending
|
|
509
|
+
return false;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
dataChannel.send(data);
|
|
513
|
+
return true;
|
|
514
|
+
};
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
### Binary Data
|
|
518
|
+
|
|
519
|
+
For maximum performance, use binary instead of JSON:
|
|
520
|
+
|
|
521
|
+
```typescript
|
|
522
|
+
// Send binary
|
|
523
|
+
const buffer = new ArrayBuffer(1024);
|
|
524
|
+
const view = new Uint8Array(buffer);
|
|
525
|
+
// ... populate buffer ...
|
|
526
|
+
dataChannel.binaryType = 'arraybuffer';
|
|
527
|
+
dataChannel.send(buffer);
|
|
528
|
+
|
|
529
|
+
// Receive binary
|
|
530
|
+
dataChannel.onmessage = (event) => {
|
|
531
|
+
if (event.data instanceof ArrayBuffer) {
|
|
532
|
+
const view = new Uint8Array(event.data);
|
|
533
|
+
processBinaryMessage(view);
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
## Use Cases
|
|
539
|
+
|
|
540
|
+
### 1. Agent Mesh Networking
|
|
541
|
+
|
|
542
|
+
Direct agent-to-agent communication in distributed system:
|
|
543
|
+
|
|
544
|
+
```typescript
|
|
545
|
+
// Each agent maintains P2P connections to neighbors
|
|
546
|
+
const neighbors = ['agent://a', 'agent://b', 'agent://c'];
|
|
547
|
+
const connections = new Map<string, RTCPeerConnection>();
|
|
548
|
+
|
|
549
|
+
neighbors.forEach(async (neighbor) => {
|
|
550
|
+
const pc = await createPeerConnection(neighbor);
|
|
551
|
+
connections.set(neighbor, pc);
|
|
552
|
+
});
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
### 2. Large Data Transfer
|
|
556
|
+
|
|
557
|
+
Transfer large datasets between agents without server:
|
|
558
|
+
|
|
559
|
+
```typescript
|
|
560
|
+
// Agent A sends large file to Agent B
|
|
561
|
+
const fileChannel = pc.createDataChannel('file-transfer', {
|
|
562
|
+
ordered: true
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
fileChannel.onopen = () => {
|
|
566
|
+
sendFile(fileChannel, largeDataset);
|
|
567
|
+
};
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
### 3. Real-time Collaboration
|
|
571
|
+
|
|
572
|
+
Low-latency state synchronization:
|
|
573
|
+
|
|
574
|
+
```typescript
|
|
575
|
+
const stateChannel = pc.createDataChannel('state-sync', {
|
|
576
|
+
ordered: false,
|
|
577
|
+
maxRetransmits: 0
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
// Send state updates immediately
|
|
581
|
+
stateChannel.send(JSON.stringify({
|
|
582
|
+
type: 'state_update',
|
|
583
|
+
payload: getCurrentState()
|
|
584
|
+
}));
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
## Compatibility
|
|
588
|
+
|
|
589
|
+
- WebRTC API support: Chrome, Firefox, Safari, Edge
|
|
590
|
+
- Node.js: Use `node-webrtc` or `werift` libraries
|
|
591
|
+
- Transport: UDP (preferred), TCP fallback
|
|
592
|
+
- Protocols: DTLS, SRTP, SCTP
|
|
593
|
+
- Codecs: Opus, VP8/VP9, H.264 (for future media support)
|
|
594
|
+
|
|
595
|
+
## References
|
|
596
|
+
|
|
597
|
+
- [WebRTC Specification](https://www.w3.org/TR/webrtc/)
|
|
598
|
+
- [RTCDataChannel API](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel)
|
|
599
|
+
- [WebRTC for Node.js](https://github.com/node-webrtc/node-webrtc)
|
|
600
|
+
- [OSSA Signaling Protocol](../signaling.md)
|