agentopology 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +450 -0
  3. package/dist/analyzer/__tests__/analyzer.test.d.ts +2 -0
  4. package/dist/analyzer/__tests__/analyzer.test.d.ts.map +1 -0
  5. package/dist/analyzer/__tests__/analyzer.test.js +258 -0
  6. package/dist/analyzer/__tests__/analyzer.test.js.map +1 -0
  7. package/dist/analyzer/index.d.ts +44 -0
  8. package/dist/analyzer/index.d.ts.map +1 -0
  9. package/dist/analyzer/index.js +308 -0
  10. package/dist/analyzer/index.js.map +1 -0
  11. package/dist/bindings/__tests__/bindings.test.d.ts +2 -0
  12. package/dist/bindings/__tests__/bindings.test.d.ts.map +1 -0
  13. package/dist/bindings/__tests__/bindings.test.js +2089 -0
  14. package/dist/bindings/__tests__/bindings.test.js.map +1 -0
  15. package/dist/bindings/claude-code.d.ts +12 -0
  16. package/dist/bindings/claude-code.d.ts.map +1 -0
  17. package/dist/bindings/claude-code.js +2063 -0
  18. package/dist/bindings/claude-code.js.map +1 -0
  19. package/dist/bindings/codex.d.ts +18 -0
  20. package/dist/bindings/codex.d.ts.map +1 -0
  21. package/dist/bindings/codex.js +1633 -0
  22. package/dist/bindings/codex.js.map +1 -0
  23. package/dist/bindings/copilot-cli.d.ts +20 -0
  24. package/dist/bindings/copilot-cli.d.ts.map +1 -0
  25. package/dist/bindings/copilot-cli.js +1515 -0
  26. package/dist/bindings/copilot-cli.js.map +1 -0
  27. package/dist/bindings/cursor.d.ts +17 -0
  28. package/dist/bindings/cursor.d.ts.map +1 -0
  29. package/dist/bindings/cursor.js +1715 -0
  30. package/dist/bindings/cursor.js.map +1 -0
  31. package/dist/bindings/gemini-cli.d.ts +18 -0
  32. package/dist/bindings/gemini-cli.d.ts.map +1 -0
  33. package/dist/bindings/gemini-cli.js +1327 -0
  34. package/dist/bindings/gemini-cli.js.map +1 -0
  35. package/dist/bindings/index.d.ts +20 -0
  36. package/dist/bindings/index.d.ts.map +1 -0
  37. package/dist/bindings/index.js +33 -0
  38. package/dist/bindings/index.js.map +1 -0
  39. package/dist/bindings/kiro.d.ts +17 -0
  40. package/dist/bindings/kiro.d.ts.map +1 -0
  41. package/dist/bindings/kiro.js +1624 -0
  42. package/dist/bindings/kiro.js.map +1 -0
  43. package/dist/bindings/openclaw.d.ts +18 -0
  44. package/dist/bindings/openclaw.d.ts.map +1 -0
  45. package/dist/bindings/openclaw.js +1578 -0
  46. package/dist/bindings/openclaw.js.map +1 -0
  47. package/dist/bindings/types.d.ts +33 -0
  48. package/dist/bindings/types.d.ts.map +1 -0
  49. package/dist/bindings/types.js +23 -0
  50. package/dist/bindings/types.js.map +1 -0
  51. package/dist/cli/index.d.ts +19 -0
  52. package/dist/cli/index.d.ts.map +1 -0
  53. package/dist/cli/index.js +679 -0
  54. package/dist/cli/index.js.map +1 -0
  55. package/dist/docs/__tests__/docs.test.d.ts +2 -0
  56. package/dist/docs/__tests__/docs.test.d.ts.map +1 -0
  57. package/dist/docs/__tests__/docs.test.js +438 -0
  58. package/dist/docs/__tests__/docs.test.js.map +1 -0
  59. package/dist/docs/content.d.ts +16 -0
  60. package/dist/docs/content.d.ts.map +1 -0
  61. package/dist/docs/content.js +3273 -0
  62. package/dist/docs/content.js.map +1 -0
  63. package/dist/docs/index.d.ts +17 -0
  64. package/dist/docs/index.d.ts.map +1 -0
  65. package/dist/docs/index.js +117 -0
  66. package/dist/docs/index.js.map +1 -0
  67. package/dist/exporters/__tests__/exporters.test.d.ts +2 -0
  68. package/dist/exporters/__tests__/exporters.test.d.ts.map +1 -0
  69. package/dist/exporters/__tests__/exporters.test.js +731 -0
  70. package/dist/exporters/__tests__/exporters.test.js.map +1 -0
  71. package/dist/exporters/index.d.ts +13 -0
  72. package/dist/exporters/index.d.ts.map +1 -0
  73. package/dist/exporters/index.js +18 -0
  74. package/dist/exporters/index.js.map +1 -0
  75. package/dist/exporters/json.d.ts +8 -0
  76. package/dist/exporters/json.d.ts.map +1 -0
  77. package/dist/exporters/json.js +25 -0
  78. package/dist/exporters/json.js.map +1 -0
  79. package/dist/exporters/markdown.d.ts +9 -0
  80. package/dist/exporters/markdown.d.ts.map +1 -0
  81. package/dist/exporters/markdown.js +686 -0
  82. package/dist/exporters/markdown.js.map +1 -0
  83. package/dist/exporters/mermaid.d.ts +11 -0
  84. package/dist/exporters/mermaid.d.ts.map +1 -0
  85. package/dist/exporters/mermaid.js +161 -0
  86. package/dist/exporters/mermaid.js.map +1 -0
  87. package/dist/exporters/types.d.ts +22 -0
  88. package/dist/exporters/types.d.ts.map +1 -0
  89. package/dist/exporters/types.js +10 -0
  90. package/dist/exporters/types.js.map +1 -0
  91. package/dist/import/__tests__/import.test.d.ts +2 -0
  92. package/dist/import/__tests__/import.test.d.ts.map +1 -0
  93. package/dist/import/__tests__/import.test.js +781 -0
  94. package/dist/import/__tests__/import.test.js.map +1 -0
  95. package/dist/import/claude-code.d.ts +38 -0
  96. package/dist/import/claude-code.d.ts.map +1 -0
  97. package/dist/import/claude-code.js +897 -0
  98. package/dist/import/claude-code.js.map +1 -0
  99. package/dist/import/index.d.ts +18 -0
  100. package/dist/import/index.d.ts.map +1 -0
  101. package/dist/import/index.js +28 -0
  102. package/dist/import/index.js.map +1 -0
  103. package/dist/import/serializer.d.ts +11 -0
  104. package/dist/import/serializer.d.ts.map +1 -0
  105. package/dist/import/serializer.js +960 -0
  106. package/dist/import/serializer.js.map +1 -0
  107. package/dist/index.d.ts +26 -0
  108. package/dist/index.d.ts.map +1 -0
  109. package/dist/index.js +21 -0
  110. package/dist/index.js.map +1 -0
  111. package/dist/parser/__tests__/parser.test.d.ts +2 -0
  112. package/dist/parser/__tests__/parser.test.d.ts.map +1 -0
  113. package/dist/parser/__tests__/parser.test.js +6514 -0
  114. package/dist/parser/__tests__/parser.test.js.map +1 -0
  115. package/dist/parser/ast.d.ts +708 -0
  116. package/dist/parser/ast.d.ts.map +1 -0
  117. package/dist/parser/ast.js +12 -0
  118. package/dist/parser/ast.js.map +1 -0
  119. package/dist/parser/index.d.ts +253 -0
  120. package/dist/parser/index.d.ts.map +1 -0
  121. package/dist/parser/index.js +1985 -0
  122. package/dist/parser/index.js.map +1 -0
  123. package/dist/parser/lexer.d.ts +100 -0
  124. package/dist/parser/lexer.d.ts.map +1 -0
  125. package/dist/parser/lexer.js +304 -0
  126. package/dist/parser/lexer.js.map +1 -0
  127. package/dist/parser/validator.d.ts +42 -0
  128. package/dist/parser/validator.d.ts.map +1 -0
  129. package/dist/parser/validator.js +2568 -0
  130. package/dist/parser/validator.js.map +1 -0
  131. package/dist/scaffold/__tests__/scaffold.test.d.ts +7 -0
  132. package/dist/scaffold/__tests__/scaffold.test.d.ts.map +1 -0
  133. package/dist/scaffold/__tests__/scaffold.test.js +295 -0
  134. package/dist/scaffold/__tests__/scaffold.test.js.map +1 -0
  135. package/dist/scaffold/incremental.d.ts +43 -0
  136. package/dist/scaffold/incremental.d.ts.map +1 -0
  137. package/dist/scaffold/incremental.js +185 -0
  138. package/dist/scaffold/incremental.js.map +1 -0
  139. package/dist/scaffold/index.d.ts +13 -0
  140. package/dist/scaffold/index.d.ts.map +1 -0
  141. package/dist/scaffold/index.js +13 -0
  142. package/dist/scaffold/index.js.map +1 -0
  143. package/dist/scaffold/manifest.d.ts +30 -0
  144. package/dist/scaffold/manifest.d.ts.map +1 -0
  145. package/dist/scaffold/manifest.js +71 -0
  146. package/dist/scaffold/manifest.js.map +1 -0
  147. package/dist/scaffold/merge.d.ts +52 -0
  148. package/dist/scaffold/merge.d.ts.map +1 -0
  149. package/dist/scaffold/merge.js +134 -0
  150. package/dist/scaffold/merge.js.map +1 -0
  151. package/dist/scaffold/types.d.ts +51 -0
  152. package/dist/scaffold/types.d.ts.map +1 -0
  153. package/dist/scaffold/types.js +10 -0
  154. package/dist/scaffold/types.js.map +1 -0
  155. package/dist/sync/index.d.ts +34 -0
  156. package/dist/sync/index.d.ts.map +1 -0
  157. package/dist/sync/index.js +392 -0
  158. package/dist/sync/index.js.map +1 -0
  159. package/dist/visualizer/index.d.ts +17 -0
  160. package/dist/visualizer/index.d.ts.map +1 -0
  161. package/dist/visualizer/index.js +1976 -0
  162. package/dist/visualizer/index.js.map +1 -0
  163. package/examples/code-review.at +167 -0
  164. package/examples/data-processing.at +296 -0
  165. package/examples/openclaw-assistant.at +142 -0
  166. package/examples/scheduled-monitor.at +193 -0
  167. package/examples/simple-pipeline.at +163 -0
  168. package/package.json +77 -0
  169. package/skill/SKILL.md +403 -0
  170. package/skill/scripts/emit.ts +853 -0
  171. package/skill/scripts/visualize.ts +89 -0
  172. package/spec/grammar.md +1466 -0
  173. package/spec/reserved-keywords.md +147 -0
  174. package/spec/validation.md +535 -0
@@ -0,0 +1,193 @@
1
+ # Scheduled Monitor — demonstrates schedule, interfaces, sandbox, and fallback-chain
2
+ # A monitoring topology that runs on cron, reports to Slack, and uses sandboxed agents.
3
+
4
+ topology scheduled-monitor : [pipeline, fan-out] {
5
+
6
+ meta {
7
+ version: "1.0"
8
+ description: "Automated monitoring pipeline with scheduled jobs, external interfaces, sandboxing, and model fallback"
9
+ domain: devops
10
+ }
11
+
12
+ orchestrator {
13
+ model: opus
14
+ handles: [monitor, gen-report, alert]
15
+ outputs {
16
+ severity: critical | warning | info
17
+ }
18
+ }
19
+
20
+ roles {
21
+ collector: "Gather metrics and health data from monitored systems"
22
+ analyzer: "Analyze collected data for anomalies and trends"
23
+ reporter: "Generate human-readable reports and summaries"
24
+ alerter: "Send alerts to external channels when thresholds are breached"
25
+ }
26
+
27
+ action monitor {
28
+ kind: inline
29
+ description: "Collect and analyze system health"
30
+ }
31
+
32
+ action gen-report {
33
+ kind: report
34
+ description: "Generate monitoring report"
35
+ }
36
+
37
+ action alert {
38
+ kind: external
39
+ source: "scripts/send-alert.sh"
40
+ description: "Dispatch alert to configured channels"
41
+ }
42
+
43
+ agent collector {
44
+ model: sonnet
45
+ phase: 1
46
+ role: collector
47
+ tools: [Read, Bash, WebFetch]
48
+ writes: ["workspace/metrics/"]
49
+ sandbox: docker
50
+ outputs {
51
+ status: healthy | degraded | critical
52
+ }
53
+ description: "Collects metrics from configured endpoints"
54
+ }
55
+
56
+ agent analyzer {
57
+ model: opus
58
+ phase: 2
59
+ role: analyzer
60
+ tools: [Read, Grep]
61
+ reads: ["workspace/metrics/"]
62
+ writes: ["workspace/analysis/"]
63
+ sandbox: network-only
64
+ fallback-chain: [sonnet, haiku]
65
+ outputs {
66
+ severity: critical | warning | info
67
+ }
68
+ description: "Analyzes collected metrics for anomalies"
69
+ }
70
+
71
+ agent reporter {
72
+ model: sonnet
73
+ phase: 3
74
+ role: reporter
75
+ tools: [Read, Write]
76
+ reads: ["workspace/analysis/"]
77
+ writes: ["workspace/reports/"]
78
+ sandbox: true
79
+ description: "Generates summary reports from analysis"
80
+ }
81
+
82
+ agent alerter {
83
+ model: haiku
84
+ phase: 3
85
+ role: alerter
86
+ tools: [Read, WebFetch]
87
+ reads: ["workspace/analysis/"]
88
+ writes: ["workspace/alerts/"]
89
+ description: "Sends alerts to configured interfaces"
90
+ }
91
+
92
+ flow {
93
+ collector -> [analyzer]
94
+ analyzer -> reporter [when analyzer.severity == info]
95
+ analyzer -> reporter [when analyzer.severity == warning]
96
+ analyzer -> [reporter, alerter] [when analyzer.severity == critical]
97
+ }
98
+
99
+ gates {
100
+ gate metric-validation {
101
+ after: collector
102
+ before: analyzer
103
+ run: "scripts/validate-metrics.sh"
104
+ checks: [format, completeness]
105
+ on-fail: bounce-back
106
+ }
107
+ }
108
+
109
+ memory {
110
+ workspace {
111
+ path: ".monitor/workspace/"
112
+ structure: [metrics, analysis, reports, alerts]
113
+ }
114
+ }
115
+
116
+ triggers {
117
+ command monitor {
118
+ pattern: "/monitor"
119
+ }
120
+ command report {
121
+ pattern: "/report <TICKET>"
122
+ argument: TICKET
123
+ }
124
+ }
125
+
126
+ # First-class schedule — replaces extensions.openclaw.cron-jobs
127
+ schedule {
128
+ job health-check {
129
+ cron: "*/15 * * * *"
130
+ agent: collector
131
+ }
132
+ job daily-report {
133
+ cron: "0 9 * * *"
134
+ agent: reporter
135
+ }
136
+ job weekly-deep-scan {
137
+ every: "monday 3:00"
138
+ agent: analyzer
139
+ enabled: true
140
+ }
141
+ }
142
+
143
+ # First-class interfaces — replaces extensions.openclaw.channels
144
+ interfaces {
145
+ slack {
146
+ type: webhook
147
+ webhook: "${SLACK_MONITORING_WEBHOOK}"
148
+ channel: "ops-alerts"
149
+ }
150
+ pagerduty {
151
+ type: http
152
+ webhook: "${PAGERDUTY_WEBHOOK_URL}"
153
+ auth: "${PAGERDUTY_API_KEY}"
154
+ }
155
+ dashboard {
156
+ type: http
157
+ port: 3000
158
+ }
159
+ }
160
+
161
+ settings {
162
+ allow: [Read, Write, Bash, WebFetch, Grep]
163
+ deny: [Edit]
164
+ # First-class sandbox — topology-wide default
165
+ sandbox: docker
166
+ # First-class fallback chain — topology-wide default
167
+ fallback-chain: [opus, sonnet, haiku]
168
+ }
169
+
170
+ providers {
171
+ anthropic {
172
+ api-key: "${ANTHROPIC_API_KEY}"
173
+ models: [opus, sonnet, haiku]
174
+ default: true
175
+ }
176
+ }
177
+
178
+ hooks {
179
+ hook alert-on-error {
180
+ on: Error
181
+ run: "scripts/alert-on-error.sh"
182
+ type: command
183
+ }
184
+ }
185
+
186
+ metering {
187
+ track: [tokens-in, tokens-out, cost, wall-time]
188
+ per: [agent, topology]
189
+ output: "metrics.jsonl"
190
+ format: jsonl
191
+ pricing: anthropic-current
192
+ }
193
+ }
@@ -0,0 +1,163 @@
1
+ # simple-pipeline.at — A basic 3-agent content pipeline
2
+ #
3
+ # Demonstrates: pipeline pattern, basic flow, gate, roles, triggers
4
+
5
+ topology simple-pipeline : [pipeline, human-gate] {
6
+
7
+ meta {
8
+ version: "1.0.0"
9
+ description: "Research, write, and review — a minimal content pipeline"
10
+ }
11
+
12
+ providers {
13
+ anthropic {
14
+ api-key: "${ANTHROPIC_API_KEY}"
15
+ models: [opus, sonnet, haiku]
16
+ default: true
17
+ }
18
+ }
19
+
20
+ orchestrator {
21
+ model: sonnet
22
+ generates: "commands/create.md"
23
+ handles: [intake, done]
24
+ outputs: {
25
+ topic-type: technical | creative
26
+ }
27
+ }
28
+
29
+ roles {
30
+ researcher: "Gather information, find sources, and compile research notes"
31
+ writer: "Draft content based on research, following style guidelines"
32
+ reviewer: "Review drafts for accuracy, clarity, and completeness"
33
+ }
34
+
35
+ # --- Actions ---
36
+
37
+ action intake {
38
+ kind: inline
39
+ description: "Parse user request — extract topic and requirements"
40
+ }
41
+
42
+ # --- Agents ---
43
+
44
+ agent researcher {
45
+ role: researcher
46
+ model: sonnet
47
+ permissions: supervised
48
+ phase: 1
49
+ tools: [Read, Grep, Glob, WebSearch]
50
+ writes: ["workspace/research.md"]
51
+
52
+ prompt {
53
+ You are a research specialist focused on gathering comprehensive information.
54
+
55
+ ## Guidelines
56
+ - Search broadly for relevant sources
57
+ - Compile findings into structured research notes
58
+ - Include citations and source URLs
59
+ - Prioritize recent and authoritative sources
60
+ }
61
+ }
62
+
63
+ agent writer {
64
+ role: writer
65
+ model: sonnet
66
+ permissions: autonomous
67
+ phase: 2
68
+ tools: [Read, Write, Glob]
69
+ reads: ["workspace/research.md"]
70
+ writes: ["workspace/draft.md"]
71
+ outputs: {
72
+ confidence: high | medium | low
73
+ }
74
+
75
+ prompt {
76
+ You are a content writer who transforms research into polished drafts.
77
+
78
+ ## Guidelines
79
+ - Follow the style guide and tone requirements
80
+ - Structure content with clear headings and sections
81
+ - Incorporate all key findings from the research
82
+ - Write for the target audience specified in the brief
83
+ }
84
+ }
85
+
86
+ agent reviewer {
87
+ role: reviewer
88
+ model: opus
89
+ permissions: supervised
90
+ phase: 3
91
+ tools: [Read, Grep, Glob]
92
+ reads: ["workspace/draft.md", "workspace/research.md"]
93
+ writes: ["workspace/review.md"]
94
+ outputs: {
95
+ verdict: approve | revise | reject
96
+ }
97
+
98
+ prompt {
99
+ You are a content reviewer ensuring quality and accuracy.
100
+
101
+ ## Guidelines
102
+ - Verify all claims against the research sources
103
+ - Check for clarity, grammar, and logical flow
104
+ - Assess completeness against the original requirements
105
+ - Provide actionable feedback for revisions if needed
106
+ }
107
+ }
108
+
109
+ # --- Flow ---
110
+
111
+ flow {
112
+ intake -> researcher
113
+ researcher -> writer
114
+ writer -> reviewer
115
+ reviewer -> writer [when reviewer.verdict == revise, max 2]
116
+ reviewer -> researcher [when reviewer.verdict == reject, max 1]
117
+ reviewer -> done [when reviewer.verdict == approve]
118
+ }
119
+
120
+ # --- Gates ---
121
+
122
+ gates {
123
+ gate quality-check {
124
+ after: writer
125
+ before: reviewer
126
+ run: "scripts/check-quality.sh"
127
+ checks: [grammar, formatting]
128
+ on-fail: bounce-back
129
+ }
130
+ }
131
+
132
+ # --- Action to finish ---
133
+
134
+ action done {
135
+ kind: report
136
+ description: "Deliver final content to the user"
137
+ }
138
+
139
+ # --- Memory ---
140
+
141
+ memory {
142
+ workspace {
143
+ path: "workspace/"
144
+ structure: [research, drafts, reviews]
145
+ }
146
+ }
147
+
148
+ # --- Triggers ---
149
+
150
+ triggers {
151
+ command create {
152
+ pattern: "/create <TOPIC>"
153
+ argument: TOPIC
154
+ }
155
+ }
156
+
157
+ # --- Settings ---
158
+
159
+ settings {
160
+ allow: ["Read", "Grep", "Glob", "WebSearch"]
161
+ deny: ["Bash(rm -rf *)"]
162
+ }
163
+ }
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "agentopology",
3
+ "version": "0.1.0",
4
+ "description": "The declarative language for multi-agent systems. Write once, scaffold for any platform.",
5
+ "author": "Nadav Naveh",
6
+ "license": "Apache-2.0",
7
+ "type": "module",
8
+ "main": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "bin": {
11
+ "agentopology": "dist/cli/index.js"
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "spec",
16
+ "examples",
17
+ "skill",
18
+ "README.md",
19
+ "LICENSE"
20
+ ],
21
+ "exports": {
22
+ ".": {
23
+ "import": "./dist/index.js",
24
+ "types": "./dist/index.d.ts"
25
+ },
26
+ "./parser": {
27
+ "import": "./dist/parser/index.js",
28
+ "types": "./dist/parser/index.d.ts"
29
+ },
30
+ "./bindings": {
31
+ "import": "./dist/bindings/index.js",
32
+ "types": "./dist/bindings/index.d.ts"
33
+ },
34
+ "./visualizer": {
35
+ "import": "./dist/visualizer/index.js",
36
+ "types": "./dist/visualizer/index.d.ts"
37
+ }
38
+ },
39
+ "scripts": {
40
+ "build": "tsc",
41
+ "test": "vitest run",
42
+ "prepublishOnly": "npm run build"
43
+ },
44
+ "keywords": [
45
+ "agents",
46
+ "multi-agent",
47
+ "topology",
48
+ "orchestration",
49
+ "ai",
50
+ "llm",
51
+ "claude",
52
+ "codex",
53
+ "gemini",
54
+ "declarative",
55
+ "scaffold"
56
+ ],
57
+ "repository": {
58
+ "type": "git",
59
+ "url": "git+https://github.com/agentopology/agentopology.git"
60
+ },
61
+ "homepage": "https://github.com/agentopology/agentopology",
62
+ "bugs": {
63
+ "url": "https://github.com/agentopology/agentopology/issues"
64
+ },
65
+ "engines": {
66
+ "node": ">=18"
67
+ },
68
+ "dependencies": {
69
+ "dagre": "^0.8.5"
70
+ },
71
+ "devDependencies": {
72
+ "ai": "^6.0.116",
73
+ "tsx": "^4.0.0",
74
+ "typescript": "^5.9.3",
75
+ "vitest": "^3.2.4"
76
+ }
77
+ }