Skip to content

Commit dbfdf1c

Browse files
saiintbrissonEdSDRPsicoThePatokings177
authored
Sync dev (#426)
* feat(page): landing page about section (WEB-376) (#419) * fix(hover-header): rename "Portal" to "Join" and update button classes for better z-index handling * fix(view-more): update content for clarity by replacing "meta-coordination" with "coordination" in descriptions * fix(pred-api): only return reply chain context * feat: services and apps split (#420) * feat: prediction-swarm app file organization (#422) * 🔥 removed llhama cpp dependency * format-fix * better scheduling * chore: delete prophet finder * chore: delete torus allocator * feat: services renames (#425) * fix: get paths from turbo --------- Co-authored-by: Ed. <ed.sdr@outlook.com> Co-authored-by: PsicoThePato <jmomcontato@gmail.com> Co-authored-by: PsicoThePato <40248917+PsicoThePato@users.noreply.github.com> Co-authored-by: kings177 <yanmendesp@gmail.com>
1 parent de52553 commit dbfdf1c

File tree

257 files changed

+1400
-7092
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

257 files changed

+1400
-7092
lines changed

.github/ci-config.json

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,18 @@
77
"pr_preview": true
88
},
99
"torus-wallet": {
10-
"deploys": [
11-
"torus-cache"
12-
],
10+
"deploys": ["torus-cache"],
1311
"pr_preview": true
1412
},
1513
"torus-allocator": {
16-
"deploys": [
17-
"torus-cache",
18-
"torus-worker"
19-
],
14+
"deploys": ["torus-cache", "torus-worker"],
2015
"pr_preview": true
2116
},
2217
"torus-bridge": {
2318
"pr_preview": true
2419
},
2520
"torus-governance": {
26-
"deploys": [
27-
"torus-cache",
28-
"torus-worker"
29-
],
21+
"deploys": ["torus-cache", "torus-worker"],
3022
"pr_preview": true
3123
},
3224
"torus-cache": {
@@ -40,29 +32,29 @@
4032
"preview_domain": "prophetfinder.com"
4133
},
4234
"prediction-swarm": {
43-
"deploys": [
44-
"torus-swarm-twitter",
45-
"torus-swarm-verifier",
46-
"swarm-filter"
47-
],
35+
"deploys": ["swarm-twitter", "swarm-verifier", "swarm-filter"],
4836
"pr_preview": true,
4937
"preview_domain": "predictionswarm.com"
5038
},
51-
"torus-swarm-twitter": {
39+
"swarm-twitter": {
5240
"pr_preview": false,
5341
"prod_only": true
5442
},
55-
"torus-swarm-verifier": {
43+
"swarm-verifier": {
5644
"pr_preview": false,
5745
"prod_only": true
5846
},
5947
"swarm-filter": {
6048
"pr_preview": false,
6149
"prod_only": true
6250
},
63-
"torus-swarm-services": {
51+
"swarm-services": {
52+
"pr_preview": false,
53+
"prod_only": false
54+
},
55+
"swarm-api": {
6456
"pr_preview": false,
6557
"prod_only": false
6658
}
6759
}
68-
}
60+
}

.github/workflows/app-deployment-template.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ on:
66
app_name:
77
required: true
88
type: string
9+
app_path:
10+
required: false
11+
description: "Path to app directory (apps or services)"
12+
type: string
13+
default: "apps"
914
skip_build:
1015
required: false
1116
description: "Skip Docker Build"
@@ -61,6 +66,7 @@ jobs:
6166
cache-to: type=gha,mode=max
6267
build-args: |
6368
APP_NAME=${{ inputs.app_name }}
69+
APP_PATH=${{ inputs.app_path }}
6470
TURBO_API=${{ vars.TURBO_API }}
6571
TURBO_TEAM=${{ vars.TURBO_TEAM }}
6672
TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}
@@ -137,13 +143,13 @@ jobs:
137143
- name: Deploy application (new tag)
138144
id: deploy-new
139145
if: needs.docker-build.result == 'success'
140-
working-directory: apps/${{ env.APP_NAME }}
146+
working-directory: ${{ inputs.app_path }}/${{ inputs.app_name }}
141147
run: |
142148
helmfile sync -e ${ENV_NAME} --set deployment.image.tag=${{ steps.commit.outputs.short }}
143149
144150
- name: Install helm diff plugin
145151
if: needs.docker-build.result == 'skipped'
146-
working-directory: apps/${{ env.APP_NAME }}
152+
working-directory: ${{ inputs.app_path }}/${{ inputs.app_name }}
147153
run: |
148154
if ! helm plugin list | grep -q '^diff'; then
149155
helm plugin install https://github.com/databus23/helm-diff
@@ -152,7 +158,7 @@ jobs:
152158
- name: Deploy application (apply diff only)
153159
id: deploy-diff
154160
if: needs.docker-build.result == 'skipped'
155-
working-directory: apps/${{ env.APP_NAME }}
161+
working-directory: ${{ inputs.app_path }}/${{ inputs.app_name }}
156162
run: |
157163
export RELEASE_NAME="$(helmfile -e ${ENV_NAME} list --output json | jq -r '.[].name')"
158164
export IMAGE_TAG="$(helm get values "${RELEASE_NAME}" -n "${NAMESPACE}" --output json | jq -r '.deployment.image.tag')"

.github/workflows/dry-run-build-template.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
app_name:
88
required: true
99
type: string
10+
app_path:
11+
required: false
12+
description: "Path to app directory (apps or services)"
13+
type: string
14+
default: "apps"
1015

1116
concurrency:
1217
group: ${{ github.workflow }}-${{ inputs.app_name }}-${{ github.ref }}
@@ -64,6 +69,7 @@ jobs:
6469
cache-to: type=gha,mode=max
6570
build-args: |
6671
APP_NAME=${{ inputs.app_name }}
72+
APP_PATH=${{ inputs.app_path }}
6773
TURBO_API=${{ vars.TURBO_API }}
6874
TURBO_TEAM=${{ vars.TURBO_TEAM }}
6975
TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}

.github/workflows/main.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
pr_preview_matrix: ${{ steps.parse.outputs.pr_preview_matrix }}
4747
all_apps: ${{ steps.parse.outputs.all_apps }}
4848
preview_domains: ${{ steps.parse.outputs.preview_domains }}
49+
package_paths: ${{ steps.parse.outputs.package_paths }}
4950
steps:
5051
- uses: actions/checkout@v4
5152
with:
@@ -62,7 +63,12 @@ jobs:
6263
- name: Get apps list
6364
id: apps
6465
run: |
65-
all_apps=$(ls -d apps/* | sed 's/apps\///' | jq -R -s -c 'split("\n")[:-1]')
66+
# List both apps and services directories
67+
apps_list=$(ls -d apps/* 2>/dev/null | sed 's/apps\///' || echo "")
68+
services_list=$(ls -d services/* 2>/dev/null | sed 's/services\///' || echo "")
69+
70+
# Combine both lists
71+
all_apps=$(echo -e "${apps_list}\n${services_list}" | grep -v '^$' | jq -R -s -c 'split("\n")[:-1]')
6672
echo "all_apps=$all_apps" >> $GITHUB_OUTPUT
6773
echo "All apps in workspace:"
6874
echo "$all_apps" | jq '.'
@@ -90,6 +96,27 @@ jobs:
9096
echo "Changed packages from turbo:"
9197
echo "$changed_packages" | jq '.'
9298
99+
# Extract package directories mapping (package -> directory parent folder)
100+
# e.g., {"torus-cache": "services", "torus-wallet": "apps"}
101+
package_paths=$(cat build.json | jq -c '
102+
[.tasks[] | {key: .package, value: (.directory | split("/")[0])}]
103+
| unique_by(.key)
104+
| from_entries
105+
')
106+
echo "package_paths=$package_paths" >> $GITHUB_OUTPUT
107+
echo "Package paths:"
108+
echo "$package_paths" | jq '.'
109+
110+
# Get paths for ALL packages
111+
all_package_paths=$(pnpm exec turbo run build --dry-run=json 2>/dev/null | jq -c '
112+
[.tasks[] | {key: .package, value: (.directory | split("/")[0])}]
113+
| unique_by(.key)
114+
| from_entries
115+
')
116+
echo "all_package_paths=$all_package_paths" >> $GITHUB_OUTPUT
117+
echo "All package paths:"
118+
echo "$all_package_paths" | jq '.'
119+
93120
- name: Filter changed apps
94121
id: changed
95122
run: |
@@ -165,13 +192,18 @@ jobs:
165192
166193
preview_domains=$(echo "$config" | jq -c '[.apps | to_entries[] | select(.value.preview_domain != null) | {key: .key, value: .value.preview_domain}] | from_entries')
167194
195+
# Use complete package paths from turbo
196+
package_paths='${{ steps.turbo.outputs.all_package_paths }}'
197+
168198
echo "deploy_matrix=$deploy_json" >> $GITHUB_OUTPUT
169199
echo "pr_preview_matrix=$pr_json" >> $GITHUB_OUTPUT
170200
echo "all_apps=$all_apps" >> $GITHUB_OUTPUT
171201
echo "preview_domains=$preview_domains" >> $GITHUB_OUTPUT
202+
echo "package_paths=$package_paths" >> $GITHUB_OUTPUT
172203
173204
echo "Apps to deploy: $deploy_json"
174205
echo "Apps with PR preview: $pr_json"
206+
echo "Package paths: $package_paths"
175207
176208
###################################
177209
###### REGULAR DEPLOYMENTS #######
@@ -191,6 +223,7 @@ jobs:
191223
secrets: inherit
192224
with:
193225
app_name: ${{ matrix.app }}
226+
app_path: ${{ fromJson(needs.find-deployments.outputs.package_paths)[matrix.app] }}
194227
skip_build: ${{ inputs.skip_build || false }}
195228

196229
###################################
@@ -212,6 +245,7 @@ jobs:
212245
secrets: inherit
213246
with:
214247
app_name: ${{ matrix.app }}
248+
app_path: ${{ fromJson(needs.find-deployments.outputs.package_paths)[matrix.app] }}
215249

216250
###################################
217251
########### PR PREVIEW ############
@@ -231,6 +265,7 @@ jobs:
231265
secrets: inherit
232266
with:
233267
app_name: ${{ matrix.app }}
268+
app_path: ${{ fromJson(needs.find-deployments.outputs.package_paths)[matrix.app] }}
234269

235270
pr-preview-cleanup:
236271
needs: find-deployments
@@ -245,6 +280,7 @@ jobs:
245280
secrets: inherit
246281
with:
247282
app_name: ${{ matrix.app }}
283+
app_path: ${{ fromJson(needs.find-deployments.outputs.package_paths)[matrix.app] }}
248284
cleanup: true
249285

250286
deployment-summary:

.github/workflows/pr-preview-template.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
app_name:
88
required: true
99
type: string
10+
app_path:
11+
required: false
12+
description: "Path to app directory (apps or services)"
13+
type: string
14+
default: "apps"
1015
cleanup:
1116
required: false
1217
type: boolean
@@ -58,6 +63,7 @@ jobs:
5863
cache-to: type=gha,mode=max
5964
build-args: |
6065
APP_NAME=${{ inputs.app_name }}
66+
APP_PATH=${{ inputs.app_path }}
6167
TURBO_API=${{ vars.TURBO_API }}
6268
TURBO_TEAM=${{ vars.TURBO_TEAM }}
6369
TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}
@@ -133,7 +139,7 @@ jobs:
133139
134140
- name: Deploy application
135141
id: deploy
136-
working-directory: apps/${{ inputs.app_name }}
142+
working-directory: ${{ inputs.app_path }}/${{ inputs.app_name }}
137143
run: |
138144
helmfile sync -e dev \
139145
--set deployment.image.tag=${{ steps.commit.outputs.short }}-pr \
@@ -206,7 +212,7 @@ jobs:
206212

207213
- name: Cleanup PR preview deployment
208214
id: cleanup
209-
working-directory: apps/${{ inputs.app_name }}
215+
working-directory: ${{ inputs.app_path }}/${{ inputs.app_name }}
210216
run: |
211217
# Capture exit code - helmfile destroy returns non-zero when nothing exists to delete
212218
set +e

CLAUDE.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,24 @@ applications, services, and shared packages for the Torus Network ecosystem.
1010

1111
### Architecture Components
1212

13-
- **Apps**: User-facing web applications
13+
- **Apps** (`apps/`): User-facing web applications
1414
- `torus-allocator`: Agent weight allocation interface
1515
- `torus-wallet`: Token management and staking interface
1616
- `torus-bridge`: Cross-chain token bridge
1717
- `torus-governance`: DAO voting and proposals
1818
- `torus-portal`: Permission management and constraint creation
1919
- `torus-page`: Landing page
20-
- **Services**: Backend services
20+
- `torus-prophet-finder`: Prophet finder application
21+
- `prediction-swarm`: Prediction swarm interface
22+
- **Services** (`services/`): Backend services
2123
- `torus-cache`: Caching layer for blockchain data
2224
- `torus-worker`: Background processing and automation
23-
- **Packages**: Shared libraries
25+
- `swarm-twitter`: Twitter integration for swarm
26+
- `swarm-verifier`: Swarm verification service
27+
- `swarm-services`: Swarm support services
28+
- `swarm-filter`: Swarm filtering service
29+
- `swarm-api`: Prediction swarm API
30+
- **Packages** (`packages/`): Shared libraries
2431
- `@torus-network/sdk`: Core Substrate/Polkadot.js integration
2532
- `@torus-ts/api`: tRPC API routes and database queries
2633
- `@torus-ts/db`: Drizzle ORM schema and database utilities
@@ -332,7 +339,7 @@ console.log("Success:", data);
332339

333340
#### Agent-Fetcher Worker
334341

335-
Location: `apps/torus-worker/src/workers/agent-fetcher.ts`
342+
Location: `services/torus-worker/src/workers/agent-fetcher.ts`
336343

337344
The agent-fetcher worker synchronizes blockchain data to the database:
338345

apps/prediction-swarm/src/app/(pages)/(expanded-pages)/feed/page.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import {
1515
TabsList,
1616
TabsTrigger,
1717
} from "@torus-ts/ui/components/tabs";
18-
import { FilterDialog } from "~/app/_components/filter-dialog";
19-
import { PageHeader } from "~/app/_components/page-header";
20-
import { FeedLegend } from "~/app/_components/user-profile/feed-legend";
21-
import { ProfileFeed } from "~/app/_components/user-profile/profile-feed";
18+
import { ContentFilterDialog } from "~/app/_components/content-filter-dialog/content-filter-dialog";
19+
import { ExpandedFeedItem } from "~/app/_components/expanded-feed/expanded-feed-item/expanded-feed-item";
20+
import { FeedLegend } from "~/app/_components/expanded-feed/expanded-feed-legend-tooltip";
21+
import { ExpandedViewPageHeader } from "~/app/_components/expanded-view-page-header";
2222
import { api } from "~/trpc/react";
2323
import { Eye, Globe, Star } from "lucide-react";
2424
import { useRouter, useSearchParams } from "next/navigation";
@@ -285,7 +285,7 @@ export default function FeedPage() {
285285
<div className="border-border pointer-events-none absolute inset-y-0 left-1/2 w-full max-w-screen-lg -translate-x-1/2 border-x" />
286286

287287
{/* Header section */}
288-
<PageHeader
288+
<ExpandedViewPageHeader
289289
title="Prediction Feed"
290290
description={
291291
view === "watched"
@@ -294,7 +294,7 @@ export default function FeedPage() {
294294
? "View your starred predictions"
295295
: "View predictions from all tracked users"
296296
}
297-
children={<FilterDialog />}
297+
children={<ContentFilterDialog />}
298298
/>
299299

300300
{/* Full-width horizontal border */}
@@ -370,7 +370,7 @@ export default function FeedPage() {
370370
{/* Ongoing Predictions */}
371371
<TabsContent value="ongoing">
372372
<CardContent>
373-
<ProfileFeed
373+
<ExpandedFeedItem
374374
predictions={ongoingPredictions ?? []}
375375
variant="feed"
376376
isLoading={ongoingLoading}
@@ -418,7 +418,7 @@ export default function FeedPage() {
418418
{/* True Predictions */}
419419
<TabsContent value="true">
420420
<CardContent>
421-
<ProfileFeed
421+
<ExpandedFeedItem
422422
predictions={truePredictions ?? []}
423423
variant="feed"
424424
isLoading={trueLoading}
@@ -465,7 +465,7 @@ export default function FeedPage() {
465465
{/* False Predictions */}
466466
<TabsContent value="false">
467467
<CardContent>
468-
<ProfileFeed
468+
<ExpandedFeedItem
469469
predictions={falsePredictions ?? []}
470470
variant="feed"
471471
isLoading={falseLoading}

apps/prediction-swarm/src/app/(pages)/(expanded-pages)/layout.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import Dither from "~/app/_components/dither";
2-
import { PageNavigation } from "~/app/_components/page-navigation";
1+
import { DitherBackgroundAnimation } from "~/app/_components/dither-background-animation";
2+
import { PageNavigation } from "~/app/_components/page-navigation/page-navigation";
33

44
export default function RootLayout({
55
children,
@@ -11,7 +11,7 @@ export default function RootLayout({
1111
<PageNavigation />
1212
{children}{" "}
1313
<div className="fixed inset-0 -z-10 opacity-30">
14-
<Dither
14+
<DitherBackgroundAnimation
1515
pixelSize={1}
1616
waveSpeed={0.01}
1717
waveFrequency={4}

0 commit comments

Comments
 (0)