@squadrules/mcp 5.23.9 → 5.23.11
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/dist/.tsbuildinfo +1 -1
- package/dist/embed-docs/mem/adapter-migration.md +1 -1
- package/dist/embed-docs/mem/author-adapter.md +1 -1
- package/dist/embed-docs/mem/bulk-insert-adapters-via-cli.md +1 -1
- package/dist/embed-docs/mem/challenge-type-guide.md +1 -1
- package/dist/embed-docs/mem/critic-loop-guide.md +1 -1
- package/dist/embed-docs/mem/critic-loop.md +1 -1
- package/dist/embed-docs/mem/protocol-linking-guide.md +1 -1
- package/dist/embed-docs/mem/refine-search.md +1 -1
- package/dist/resources/embedded-mcp-resources.js +8 -8
- package/dist/resources/embedded-mcp-resources.js.map +1 -1
- package/dist/runtime-lock.json +71 -71
- package/dist/ui/assets/{AccountPage-CCCpJCly.js → AccountPage-DTqJKKJZ.js} +1 -1
- package/dist/ui/assets/{ErrorAlert-CpqG3xN8.js → ErrorAlert-DK5iZ4a9.js} +1 -1
- package/dist/ui/assets/{HomePage-DUe1teex.js → HomePage-CdlPPr0G.js} +1 -1
- package/dist/ui/assets/{NotFoundPage-SqExcDrY.js → NotFoundPage-D09wYSBK.js} +1 -1
- package/dist/ui/assets/{ProtocolDetailPage-D0MUL2RS.js → ProtocolDetailPage-CR4rQ8sl.js} +1 -1
- package/dist/ui/assets/{ProtocolEditPage-BuJz36eu.js → ProtocolEditPage-CTFhKP0e.js} +1 -1
- package/dist/ui/assets/{RunGuidedPage-X_E_E42Y.js → RunGuidedPage-DWeOJ9qM.js} +1 -1
- package/dist/ui/assets/{RunsPage-CGw60oRy.js → RunsPage-C4Ev7nDx.js} +1 -1
- package/dist/ui/assets/{SkillBundlePage-BbVG7AK1.js → SkillBundlePage-DOB-FblJ.js} +1 -1
- package/dist/ui/assets/{SpaceSelect-LrJMAMEk.js → SpaceSelect-z6megrEL.js} +1 -1
- package/dist/ui/assets/{SquadrulesPage-HJ-SjQ5u.js → SquadrulesPage-BXBmqPRT.js} +1 -1
- package/dist/ui/assets/{StepFlowGraph-509IoD3J.js → StepFlowGraph-BiHocaMm.js} +1 -1
- package/dist/ui/assets/{export-skill-zip-DRU_W5EX.js → export-skill-zip-DcdfIu6o.js} +1 -1
- package/dist/ui/assets/{index-CeH_rJvX.js → index-BXPJNOzR.js} +3 -3
- package/dist/ui/assets/vendor-DuiEbTOR.js +31 -0
- package/dist/ui/index.html +2 -2
- package/package.json +2 -2
- package/dist/ui/assets/vendor-DEls6f-c.js +0 -31
package/dist/runtime-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squadrules/mcp",
|
|
3
|
-
"version": "5.23.
|
|
3
|
+
"version": "5.23.11",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@squadrules/mcp",
|
|
9
|
-
"version": "5.23.
|
|
9
|
+
"version": "5.23.11",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@exodus/bytes": "^1.16.0",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@napi-rs/keyring": "^2.1.0",
|
|
19
19
|
"@prometheus-io/client": "^0.16.1",
|
|
20
20
|
"@qdrant/js-client-rest": "^1.19.0",
|
|
21
|
-
"@tanstack/react-query": "5.108.
|
|
21
|
+
"@tanstack/react-query": "5.108.4",
|
|
22
22
|
"@tiptap/core": "3.35.0",
|
|
23
23
|
"@tiptap/extension-bubble-menu": "3.35.0",
|
|
24
24
|
"@tiptap/extension-floating-menu": "3.35.0",
|
|
@@ -2526,9 +2526,9 @@
|
|
|
2526
2526
|
}
|
|
2527
2527
|
},
|
|
2528
2528
|
"node_modules/@lancedb/lancedb": {
|
|
2529
|
-
"version": "0.42.0-beta.
|
|
2530
|
-
"resolved": "https://registry.npmjs.org/@lancedb/lancedb/-/lancedb-0.42.0-beta.
|
|
2531
|
-
"integrity": "sha512-
|
|
2529
|
+
"version": "0.42.0-beta.29",
|
|
2530
|
+
"resolved": "https://registry.npmjs.org/@lancedb/lancedb/-/lancedb-0.42.0-beta.29.tgz",
|
|
2531
|
+
"integrity": "sha512-gM8oOUARUKcudOOeWxROJJkdhxXNkVuyRczdf+KKncdeyxoFn/db0OXslZB7nMQ3Ac4H20o0KBCrPOT84H2Tqg==",
|
|
2532
2532
|
"cpu": [
|
|
2533
2533
|
"x64",
|
|
2534
2534
|
"arm64"
|
|
@@ -2548,13 +2548,13 @@
|
|
|
2548
2548
|
},
|
|
2549
2549
|
"optionalDependencies": {
|
|
2550
2550
|
"@huggingface/transformers": "4.3.2",
|
|
2551
|
-
"@lancedb/lancedb-darwin-arm64": "0.42.0-beta.
|
|
2552
|
-
"@lancedb/lancedb-linux-arm64-gnu": "0.42.0-beta.
|
|
2553
|
-
"@lancedb/lancedb-linux-arm64-musl": "0.42.0-beta.
|
|
2554
|
-
"@lancedb/lancedb-linux-x64-gnu": "0.42.0-beta.
|
|
2555
|
-
"@lancedb/lancedb-linux-x64-musl": "0.42.0-beta.
|
|
2556
|
-
"@lancedb/lancedb-win32-arm64-msvc": "0.42.0-beta.
|
|
2557
|
-
"@lancedb/lancedb-win32-x64-msvc": "0.42.0-beta.
|
|
2551
|
+
"@lancedb/lancedb-darwin-arm64": "0.42.0-beta.29",
|
|
2552
|
+
"@lancedb/lancedb-linux-arm64-gnu": "0.42.0-beta.29",
|
|
2553
|
+
"@lancedb/lancedb-linux-arm64-musl": "0.42.0-beta.29",
|
|
2554
|
+
"@lancedb/lancedb-linux-x64-gnu": "0.42.0-beta.29",
|
|
2555
|
+
"@lancedb/lancedb-linux-x64-musl": "0.42.0-beta.29",
|
|
2556
|
+
"@lancedb/lancedb-win32-arm64-msvc": "0.42.0-beta.29",
|
|
2557
|
+
"@lancedb/lancedb-win32-x64-msvc": "0.42.0-beta.29",
|
|
2558
2558
|
"openai": "4.29.2"
|
|
2559
2559
|
},
|
|
2560
2560
|
"peerDependencies": {
|
|
@@ -2568,9 +2568,9 @@
|
|
|
2568
2568
|
}
|
|
2569
2569
|
},
|
|
2570
2570
|
"node_modules/@lancedb/lancedb-darwin-arm64": {
|
|
2571
|
-
"version": "0.42.0-beta.
|
|
2572
|
-
"resolved": "https://registry.npmjs.org/@lancedb/lancedb-darwin-arm64/-/lancedb-darwin-arm64-0.42.0-beta.
|
|
2573
|
-
"integrity": "sha512-
|
|
2571
|
+
"version": "0.42.0-beta.29",
|
|
2572
|
+
"resolved": "https://registry.npmjs.org/@lancedb/lancedb-darwin-arm64/-/lancedb-darwin-arm64-0.42.0-beta.29.tgz",
|
|
2573
|
+
"integrity": "sha512-ixb3MDDWkOAr9BXzQ5nytnSryMycbEVNib6AKZ+cyJ7XRn0EtPC3PknSepBXXV5baee0Hz72MF3I+hPPv1sJVw==",
|
|
2574
2574
|
"cpu": [
|
|
2575
2575
|
"arm64"
|
|
2576
2576
|
],
|
|
@@ -2584,9 +2584,9 @@
|
|
|
2584
2584
|
}
|
|
2585
2585
|
},
|
|
2586
2586
|
"node_modules/@lancedb/lancedb-linux-arm64-gnu": {
|
|
2587
|
-
"version": "0.42.0-beta.
|
|
2588
|
-
"resolved": "https://registry.npmjs.org/@lancedb/lancedb-linux-arm64-gnu/-/lancedb-linux-arm64-gnu-0.42.0-beta.
|
|
2589
|
-
"integrity": "sha512-
|
|
2587
|
+
"version": "0.42.0-beta.29",
|
|
2588
|
+
"resolved": "https://registry.npmjs.org/@lancedb/lancedb-linux-arm64-gnu/-/lancedb-linux-arm64-gnu-0.42.0-beta.29.tgz",
|
|
2589
|
+
"integrity": "sha512-llHocAMK7UWxl7VMgGCvZZKTBzu44vJM8n5uZptfJJgBgTaxjqDb0Po8IcQmxfb3Ovn1VFAnMomQw+RP3q4VUA==",
|
|
2590
2590
|
"cpu": [
|
|
2591
2591
|
"arm64"
|
|
2592
2592
|
],
|
|
@@ -2603,9 +2603,9 @@
|
|
|
2603
2603
|
}
|
|
2604
2604
|
},
|
|
2605
2605
|
"node_modules/@lancedb/lancedb-linux-arm64-musl": {
|
|
2606
|
-
"version": "0.42.0-beta.
|
|
2607
|
-
"resolved": "https://registry.npmjs.org/@lancedb/lancedb-linux-arm64-musl/-/lancedb-linux-arm64-musl-0.42.0-beta.
|
|
2608
|
-
"integrity": "sha512-
|
|
2606
|
+
"version": "0.42.0-beta.29",
|
|
2607
|
+
"resolved": "https://registry.npmjs.org/@lancedb/lancedb-linux-arm64-musl/-/lancedb-linux-arm64-musl-0.42.0-beta.29.tgz",
|
|
2608
|
+
"integrity": "sha512-A42Ed/dx7OHFODMD9xdnPeh++efFFijNS6akJnvqkBEJoCbOHuAsxQHxJsrtqkxsVkc8ilfsTW4wKuJFXrJZOw==",
|
|
2609
2609
|
"cpu": [
|
|
2610
2610
|
"arm64"
|
|
2611
2611
|
],
|
|
@@ -2622,9 +2622,9 @@
|
|
|
2622
2622
|
}
|
|
2623
2623
|
},
|
|
2624
2624
|
"node_modules/@lancedb/lancedb-linux-x64-gnu": {
|
|
2625
|
-
"version": "0.42.0-beta.
|
|
2626
|
-
"resolved": "https://registry.npmjs.org/@lancedb/lancedb-linux-x64-gnu/-/lancedb-linux-x64-gnu-0.42.0-beta.
|
|
2627
|
-
"integrity": "sha512-
|
|
2625
|
+
"version": "0.42.0-beta.29",
|
|
2626
|
+
"resolved": "https://registry.npmjs.org/@lancedb/lancedb-linux-x64-gnu/-/lancedb-linux-x64-gnu-0.42.0-beta.29.tgz",
|
|
2627
|
+
"integrity": "sha512-TOnXEMIpizvpgok1dwGBP0LORxJU9bos6yPh85vuFf2U3oMR+i51mHwZ7wOmnGmqoxA+2KO63nKzxZE4fTQzIQ==",
|
|
2628
2628
|
"cpu": [
|
|
2629
2629
|
"x64"
|
|
2630
2630
|
],
|
|
@@ -2641,9 +2641,9 @@
|
|
|
2641
2641
|
}
|
|
2642
2642
|
},
|
|
2643
2643
|
"node_modules/@lancedb/lancedb-linux-x64-musl": {
|
|
2644
|
-
"version": "0.42.0-beta.
|
|
2645
|
-
"resolved": "https://registry.npmjs.org/@lancedb/lancedb-linux-x64-musl/-/lancedb-linux-x64-musl-0.42.0-beta.
|
|
2646
|
-
"integrity": "sha512-
|
|
2644
|
+
"version": "0.42.0-beta.29",
|
|
2645
|
+
"resolved": "https://registry.npmjs.org/@lancedb/lancedb-linux-x64-musl/-/lancedb-linux-x64-musl-0.42.0-beta.29.tgz",
|
|
2646
|
+
"integrity": "sha512-u22cMwGJuE4yc1uhkx3aql96IdJkWNa5rulKxHr2DK4YeGc2OOSuLccEmb/uPZaczgtgfg5PRG0B4sbUfhcmIQ==",
|
|
2647
2647
|
"cpu": [
|
|
2648
2648
|
"x64"
|
|
2649
2649
|
],
|
|
@@ -2660,9 +2660,9 @@
|
|
|
2660
2660
|
}
|
|
2661
2661
|
},
|
|
2662
2662
|
"node_modules/@lancedb/lancedb-win32-arm64-msvc": {
|
|
2663
|
-
"version": "0.42.0-beta.
|
|
2664
|
-
"resolved": "https://registry.npmjs.org/@lancedb/lancedb-win32-arm64-msvc/-/lancedb-win32-arm64-msvc-0.42.0-beta.
|
|
2665
|
-
"integrity": "sha512-
|
|
2663
|
+
"version": "0.42.0-beta.29",
|
|
2664
|
+
"resolved": "https://registry.npmjs.org/@lancedb/lancedb-win32-arm64-msvc/-/lancedb-win32-arm64-msvc-0.42.0-beta.29.tgz",
|
|
2665
|
+
"integrity": "sha512-m8dE3SQK7gsHkGRKTrT1u5Cog2bR4fh6wmDNKJLp6ZFmJgx2sE+DcqoMRv/Xlbx88u23XGSbN4OgFeqNz1gJ+A==",
|
|
2666
2666
|
"cpu": [
|
|
2667
2667
|
"arm64"
|
|
2668
2668
|
],
|
|
@@ -2676,9 +2676,9 @@
|
|
|
2676
2676
|
}
|
|
2677
2677
|
},
|
|
2678
2678
|
"node_modules/@lancedb/lancedb-win32-x64-msvc": {
|
|
2679
|
-
"version": "0.42.0-beta.
|
|
2680
|
-
"resolved": "https://registry.npmjs.org/@lancedb/lancedb-win32-x64-msvc/-/lancedb-win32-x64-msvc-0.42.0-beta.
|
|
2681
|
-
"integrity": "sha512-
|
|
2679
|
+
"version": "0.42.0-beta.29",
|
|
2680
|
+
"resolved": "https://registry.npmjs.org/@lancedb/lancedb-win32-x64-msvc/-/lancedb-win32-x64-msvc-0.42.0-beta.29.tgz",
|
|
2681
|
+
"integrity": "sha512-GlPqmg/E0x0ew3nhpJchPQat+hdb0fTa2HxmfukGMj5xc28ebXFPH3KvoKD2lyBPoIJ66NzT4OhA/wLTHahapQ==",
|
|
2682
2682
|
"cpu": [
|
|
2683
2683
|
"x64"
|
|
2684
2684
|
],
|
|
@@ -4245,21 +4245,21 @@
|
|
|
4245
4245
|
}
|
|
4246
4246
|
},
|
|
4247
4247
|
"node_modules/@redis/bloom": {
|
|
4248
|
-
"version": "6.
|
|
4249
|
-
"resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-6.
|
|
4250
|
-
"integrity": "sha512-
|
|
4248
|
+
"version": "6.4.0",
|
|
4249
|
+
"resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-6.4.0.tgz",
|
|
4250
|
+
"integrity": "sha512-haBv1OKeJoKxoAxwKEHPDKdoZaLIuWAKNr4VFRF2C3Rjjn7Ese5fijEW6295rMBIyddZfuIOcvH1aZ/yKzy8vQ==",
|
|
4251
4251
|
"license": "MIT",
|
|
4252
4252
|
"engines": {
|
|
4253
4253
|
"node": ">= 20.0.0"
|
|
4254
4254
|
},
|
|
4255
4255
|
"peerDependencies": {
|
|
4256
|
-
"@redis/client": "^6.
|
|
4256
|
+
"@redis/client": "^6.4.0"
|
|
4257
4257
|
}
|
|
4258
4258
|
},
|
|
4259
4259
|
"node_modules/@redis/client": {
|
|
4260
|
-
"version": "6.
|
|
4261
|
-
"resolved": "https://registry.npmjs.org/@redis/client/-/client-6.
|
|
4262
|
-
"integrity": "sha512-
|
|
4260
|
+
"version": "6.4.0",
|
|
4261
|
+
"resolved": "https://registry.npmjs.org/@redis/client/-/client-6.4.0.tgz",
|
|
4262
|
+
"integrity": "sha512-XEFSX0W1BUVFwtWC41vk5P/U5CqvacBWypFbmYHdF1gJeIYWWmEzsM2R5mPb+65SdODFQk7xuuMPFP6s1t9nhw==",
|
|
4263
4263
|
"license": "MIT",
|
|
4264
4264
|
"engines": {
|
|
4265
4265
|
"node": ">= 20.0.0"
|
|
@@ -4278,39 +4278,39 @@
|
|
|
4278
4278
|
}
|
|
4279
4279
|
},
|
|
4280
4280
|
"node_modules/@redis/json": {
|
|
4281
|
-
"version": "6.
|
|
4282
|
-
"resolved": "https://registry.npmjs.org/@redis/json/-/json-6.
|
|
4283
|
-
"integrity": "sha512-
|
|
4281
|
+
"version": "6.4.0",
|
|
4282
|
+
"resolved": "https://registry.npmjs.org/@redis/json/-/json-6.4.0.tgz",
|
|
4283
|
+
"integrity": "sha512-Dtxn3c2u5H5r3MA6kMrFI6iSOo4BIwibwkep94BMBD5ba1Eik1UYIwInX9lZ10RdUT4+BD7ZS9lAoORBvXUEYg==",
|
|
4284
4284
|
"license": "MIT",
|
|
4285
4285
|
"engines": {
|
|
4286
4286
|
"node": ">= 20.0.0"
|
|
4287
4287
|
},
|
|
4288
4288
|
"peerDependencies": {
|
|
4289
|
-
"@redis/client": "^6.
|
|
4289
|
+
"@redis/client": "^6.4.0"
|
|
4290
4290
|
}
|
|
4291
4291
|
},
|
|
4292
4292
|
"node_modules/@redis/search": {
|
|
4293
|
-
"version": "6.
|
|
4294
|
-
"resolved": "https://registry.npmjs.org/@redis/search/-/search-6.
|
|
4295
|
-
"integrity": "sha512-
|
|
4293
|
+
"version": "6.4.0",
|
|
4294
|
+
"resolved": "https://registry.npmjs.org/@redis/search/-/search-6.4.0.tgz",
|
|
4295
|
+
"integrity": "sha512-B4L2OD5BMwbOYewQ9KGJfukLUkRQz1gc91TEOxz76KLeJsLbHB0XXa7sKMNoB3JURPWvhuY0PE04fHQVYZPZKg==",
|
|
4296
4296
|
"license": "MIT",
|
|
4297
4297
|
"engines": {
|
|
4298
4298
|
"node": ">= 20.0.0"
|
|
4299
4299
|
},
|
|
4300
4300
|
"peerDependencies": {
|
|
4301
|
-
"@redis/client": "^6.
|
|
4301
|
+
"@redis/client": "^6.4.0"
|
|
4302
4302
|
}
|
|
4303
4303
|
},
|
|
4304
4304
|
"node_modules/@redis/time-series": {
|
|
4305
|
-
"version": "6.
|
|
4306
|
-
"resolved": "https://registry.npmjs.org/@redis/time-series/-/time-series-6.
|
|
4307
|
-
"integrity": "sha512-
|
|
4305
|
+
"version": "6.4.0",
|
|
4306
|
+
"resolved": "https://registry.npmjs.org/@redis/time-series/-/time-series-6.4.0.tgz",
|
|
4307
|
+
"integrity": "sha512-5QpeIlX/r0h0//JfJ8h4/Il9i0SGHhnOkdcocOhFDp0pb8VgVCEkxeCkUx8IR3g3rlq+uiPIf4NCueveHS9Vbw==",
|
|
4308
4308
|
"license": "MIT",
|
|
4309
4309
|
"engines": {
|
|
4310
4310
|
"node": ">= 20.0.0"
|
|
4311
4311
|
},
|
|
4312
4312
|
"peerDependencies": {
|
|
4313
|
-
"@redis/client": "^6.
|
|
4313
|
+
"@redis/client": "^6.4.0"
|
|
4314
4314
|
}
|
|
4315
4315
|
},
|
|
4316
4316
|
"node_modules/@remix-run/route-pattern": {
|
|
@@ -5052,9 +5052,9 @@
|
|
|
5052
5052
|
}
|
|
5053
5053
|
},
|
|
5054
5054
|
"node_modules/@tanstack/query-core": {
|
|
5055
|
-
"version": "5.108.
|
|
5056
|
-
"resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.108.
|
|
5057
|
-
"integrity": "sha512-
|
|
5055
|
+
"version": "5.108.4",
|
|
5056
|
+
"resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.108.4.tgz",
|
|
5057
|
+
"integrity": "sha512-2Ks5dlLWz4eXJrthOyG0qW3SLt3xx0RrQmAmN0rnmogiaaOYuWiAe6HAm9KE2b2v8nig+vraNz8fsfZ6fF6zFg==",
|
|
5058
5058
|
"license": "MIT",
|
|
5059
5059
|
"funding": {
|
|
5060
5060
|
"type": "github",
|
|
@@ -5062,12 +5062,12 @@
|
|
|
5062
5062
|
}
|
|
5063
5063
|
},
|
|
5064
5064
|
"node_modules/@tanstack/react-query": {
|
|
5065
|
-
"version": "5.108.
|
|
5066
|
-
"resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.108.
|
|
5067
|
-
"integrity": "sha512-
|
|
5065
|
+
"version": "5.108.4",
|
|
5066
|
+
"resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.108.4.tgz",
|
|
5067
|
+
"integrity": "sha512-GlTa94kfEKTVsbzXe58rFA3GZ0ZE7N1aFtbZAfOS3XxMv8YNn4C+8rsz40LorHLazdm5PsqCroWaYAR+ZkMXMQ==",
|
|
5068
5068
|
"license": "MIT",
|
|
5069
5069
|
"dependencies": {
|
|
5070
|
-
"@tanstack/query-core": "5.108.
|
|
5070
|
+
"@tanstack/query-core": "5.108.4"
|
|
5071
5071
|
},
|
|
5072
5072
|
"funding": {
|
|
5073
5073
|
"type": "github",
|
|
@@ -11521,9 +11521,9 @@
|
|
|
11521
11521
|
}
|
|
11522
11522
|
},
|
|
11523
11523
|
"node_modules/i18next": {
|
|
11524
|
-
"version": "27.2.
|
|
11525
|
-
"resolved": "https://registry.npmjs.org/i18next/-/i18next-27.2.
|
|
11526
|
-
"integrity": "sha512-
|
|
11524
|
+
"version": "27.2.7",
|
|
11525
|
+
"resolved": "https://registry.npmjs.org/i18next/-/i18next-27.2.7.tgz",
|
|
11526
|
+
"integrity": "sha512-q3XlM8YSo6Nmomd+MQ4JPGJGvhgHwfCRXNeFrM8l0F4TuIuoJBqhCxQrdGDHNMjObRuw5O0ReuU968ZeMVlfnw==",
|
|
11527
11527
|
"funding": [
|
|
11528
11528
|
{
|
|
11529
11529
|
"type": "individual",
|
|
@@ -16653,16 +16653,16 @@
|
|
|
16653
16653
|
}
|
|
16654
16654
|
},
|
|
16655
16655
|
"node_modules/redis": {
|
|
16656
|
-
"version": "6.
|
|
16657
|
-
"resolved": "https://registry.npmjs.org/redis/-/redis-6.
|
|
16658
|
-
"integrity": "sha512-
|
|
16656
|
+
"version": "6.4.0",
|
|
16657
|
+
"resolved": "https://registry.npmjs.org/redis/-/redis-6.4.0.tgz",
|
|
16658
|
+
"integrity": "sha512-8Xk9zRovBNDzIO3xRi036QFgijIZKeIPjQJ5VhgxV8nxkxDP5GlE5se71G1I4TnUTojbCtmfKzXpioxlDhHJvg==",
|
|
16659
16659
|
"license": "MIT",
|
|
16660
16660
|
"dependencies": {
|
|
16661
|
-
"@redis/bloom": "6.
|
|
16662
|
-
"@redis/client": "6.
|
|
16663
|
-
"@redis/json": "6.
|
|
16664
|
-
"@redis/search": "6.
|
|
16665
|
-
"@redis/time-series": "6.
|
|
16661
|
+
"@redis/bloom": "6.4.0",
|
|
16662
|
+
"@redis/client": "6.4.0",
|
|
16663
|
+
"@redis/json": "6.4.0",
|
|
16664
|
+
"@redis/search": "6.4.0",
|
|
16665
|
+
"@redis/time-series": "6.4.0"
|
|
16666
16666
|
},
|
|
16667
16667
|
"engines": {
|
|
16668
16668
|
"node": ">= 20.0.0"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e,v as t}from"./vendor-
|
|
1
|
+
import{h as e,v as t}from"./vendor-DuiEbTOR.js";import{t as n}from"./api-BgTb-tmJ.js";import{n as r,r as i,t as a}from"./index-BXPJNOzR.js";import{t as o}from"./react-C1iE8mnY.js";async function s(){let e=await n(`/api/me`);if(!e.ok){let t=await e.json().catch(()=>({})),n=Error(t.message??e.statusText);throw n.statusCode=e.status,n}return e.json()}function c(){return e({queryKey:[`me`],queryFn:s,retry:!1})}var l=o(),u={light:`account.themeOptionLight`,dark:`account.themeOptionDark`};function d(e){if(e.name&&e.name.trim().length>0)return e.name;let t=[e.given_name,e.family_name].filter(e=>typeof e==`string`&&e.trim().length>0);return t.length>0?t.join(` `):e.preferred_username&&e.preferred_username.length>0?e.preferred_username:e.sub}function f(){let{t:e}=t(),{data:n,isLoading:o,isError:s}=c(),{preference:f,setPreference:p}=i();return o?(0,l.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`account.loading`)}):s||!n?(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-4`,children:e(`account.title`)}),(0,l.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`account.notSignedIn`)}),(0,l.jsx)(`a`,{href:`/auth/callback`,className:`mt-4 min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`account.signIn`)})]}):(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-6`,children:e(`account.title`)}),(0,l.jsx)(`p`,{className:`text-[var(--color-text-muted)] mb-6`,children:e(`account.intro`)}),(0,l.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-6`,children:[(0,l.jsxs)(`div`,{className:`mb-6 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,l.jsx)(`h2`,{className:`mb-1 text-base font-semibold text-[var(--color-text-heading)]`,children:e(`account.themeTitle`)}),(0,l.jsx)(`p`,{className:`mb-3 text-sm text-[var(--color-text-muted)]`,children:e(`account.themeDescription`)}),(0,l.jsx)(`label`,{htmlFor:`account-theme-preference`,className:`sr-only`,children:e(`account.themePreferenceLabel`)}),(0,l.jsxs)(`select`,{id:`account-theme-preference`,value:f,onChange:e=>{let t=e.target.value;r(t)&&p(t)},className:`min-h-[44px] w-full max-w-xs rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-3 py-2 text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:[(0,l.jsx)(`option`,{value:`system`,children:e(`account.themeOptionSystem`)}),a.map(t=>(0,l.jsx)(`option`,{value:t,children:e(u[t])},t))]})]}),(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.name`)}),(0,l.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:d(n)})]}),n.preferred_username&&n.preferred_username!==d(n)&&(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.username`)}),(0,l.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:n.preferred_username})]}),n.email&&(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.email`)}),(0,l.jsxs)(`span`,{className:`text-[var(--color-text-heading)]`,children:[n.email,n.email_verified===!0?` (${e(`account.emailVerified`)})`:``]})]}),(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.accountType`)}),(0,l.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:n.account_label})]}),(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.realm`)}),(0,l.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:n.realm})]}),n.identity_provider&&(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.identityProvider`)}),(0,l.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:n.identity_provider})]}),n.groups.length>0&&(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.groups`)}),(0,l.jsx)(`ul`,{className:`list-disc list-inside text-[var(--color-text-heading)] space-y-1`,children:n.groups.map(e=>(0,l.jsx)(`li`,{children:e},e))})]}),(0,l.jsx)(`div`,{className:`mt-6 flex gap-2 flex-wrap`,children:(0,l.jsx)(`a`,{href:`/auth/logout`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] bg-transparent no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`account.logOut`)})})]})]})}export{f as AccountPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,v as t}from"./vendor-
|
|
1
|
+
import{a as e,v as t}from"./vendor-DuiEbTOR.js";import{t as n}from"./react-C1iE8mnY.js";var r=n();function i({message:n,nextAction:i,onRetry:a,showGoBack:o=!0,supportLink:s}){let{t:c}=t();return(0,r.jsxs)(`div`,{className:`p-4 rounded-[var(--radius-md)] border border-[var(--color-error)] bg-[var(--color-error-bg)]`,role:`alert`,children:[(0,r.jsx)(`h2`,{className:`text-base font-semibold text-[var(--color-error)] mb-2`,children:c(`error.title`)}),(0,r.jsx)(`p`,{className:`text-[var(--color-text)]`,children:n}),i&&(0,r.jsx)(`p`,{className:`mt-4 pt-4 border-t border-[var(--color-border)] font-medium`,children:i}),(0,r.jsxs)(`div`,{className:`flex flex-wrap gap-2 mt-4`,children:[a&&(0,r.jsx)(`button`,{type:`button`,onClick:a,className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:c(`error.retry`)}),o&&(0,r.jsx)(e,{to:`/`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:c(`error.goBack`)}),s&&(0,r.jsx)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:c(`error.support`)})]})]})}export{i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,f as t,v as n}from"./vendor-
|
|
1
|
+
import{a as e,f as t,v as n}from"./vendor-DuiEbTOR.js";import{n as r,r as i}from"./SpaceSelect-z6megrEL.js";import{t as a}from"./SurfaceCard-DJ6PVBPM.js";import{t as o}from"./react-C1iE8mnY.js";var s=o();function c(){let{t:o}=n(),c=t(),{data:l,isLoading:u,isError:d}=i(),f=e=>{e.preventDefault();let t=e.currentTarget.querySelector(`input[name="q"]`)?.value?.trim()??``;c(t?`/squadrules?q=${encodeURIComponent(t)}`:`/squadrules`)},p=l?.spaces??[],m=u||d||p.length===0;return(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:o(`home.title`)}),(0,s.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-6`,children:o(`home.tagline`)}),(0,s.jsx)(a,{title:o(`home.findCardTitle`),subtitle:o(`home.findCardSubtitle`),className:`mb-6`,children:(0,s.jsxs)(`form`,{onSubmit:f,className:`grid gap-3 md:grid-cols-[1fr_auto] md:items-end`,"aria-label":o(`home.searchLabel`),children:[(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`label`,{htmlFor:`home-search-query`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:o(`home.searchLabel`)}),(0,s.jsx)(`input`,{id:`home-search-query`,name:`q`,type:`search`,autoComplete:`off`,placeholder:o(`home.searchPlaceholder`),"aria-describedby":`home-search-hint`,className:`w-full min-h-[44px] px-4 py-2 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),(0,s.jsx)(`p`,{id:`home-search-hint`,className:`text-sm text-[var(--color-text-muted)] mt-2`,children:o(`home.searchHint`)})]}),(0,s.jsxs)(`div`,{className:`flex flex-wrap gap-2 md:flex-col md:items-stretch`,children:[(0,s.jsx)(`button`,{type:`submit`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:o(`squadrules.search`)}),(0,s.jsx)(e,{to:`/squadrules`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:o(`home.goToBrowse`)})]})]})}),(0,s.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3 mb-6`,children:[(0,s.jsx)(a,{title:o(`home.cardBrowseTitle`),subtitle:o(`home.cardBrowseSubtitle`),children:(0,s.jsx)(e,{to:`/squadrules`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:o(`home.cardBrowseCta`)})}),(0,s.jsx)(a,{title:o(`home.cardCreateTitle`),subtitle:o(`home.cardCreateSubtitle`),children:(0,s.jsx)(e,{to:`/protocols/new`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:o(`home.cardCreateCta`)})}),(0,s.jsx)(a,{title:o(`home.cardRunsTitle`),subtitle:o(`home.cardRunsSubtitle`),children:(0,s.jsx)(e,{to:`/runs`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:o(`home.cardRunsCta`)})})]}),(0,s.jsxs)(`section`,{"aria-labelledby":`home-stats-heading`,children:[(0,s.jsx)(`h2`,{id:`home-stats-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:o(`home.spacesHeading`)}),(0,s.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,"aria-label":o(`home.statsLabel`),children:[m&&p.length===0?(0,s.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,s.jsx)(`span`,{className:`text-2xl font-semibold text-[var(--color-text-heading)]`,children:`—`}),(0,s.jsx)(`span`,{className:`block text-xs uppercase tracking-wide text-[var(--color-text-muted)] mt-1`,children:o(`home.stats.spacesLabel`)}),(0,s.jsx)(`span`,{className:`block text-sm text-[var(--color-text-muted)] mt-2`,children:o(`home.stats.protocolCount`,{count:0})})]}):null,p.map(e=>(0,s.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,s.jsx)(`div`,{className:`text-2xl font-semibold text-[var(--color-text-heading)]`,children:u?`—`:e.adapter_count}),(0,s.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2`,children:[(0,s.jsx)(`span`,{className:`text-xs uppercase tracking-wide text-[var(--color-text-muted)]`,children:e.name}),(0,s.jsx)(r,{type:e.type})]}),(0,s.jsx)(`div`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:u?`—`:o(`home.stats.protocolCount`,{count:e.adapter_count})})]},e.space_id))]})]})]})}export{c as HomePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{v as e}from"./vendor-
|
|
1
|
+
import{v as e}from"./vendor-DuiEbTOR.js";import{t}from"./ErrorAlert-DK5iZ4a9.js";import{t as n}from"./react-C1iE8mnY.js";var r=n();function i(){let{t:n}=e();return(0,r.jsxs)(`div`,{children:[(0,r.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-4`,children:n(`notFound.title`)}),(0,r.jsx)(t,{message:n(`notFound.message`),showGoBack:!0})]})}export{i as NotFoundPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{a as r,p as i,v as a}from"./vendor-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{a as r,p as i,v as a}from"./vendor-DuiEbTOR.js";import{a as o,n as s,r as c,s as l,t as u}from"./export-skill-zip-DcdfIu6o.js";import{n as d}from"./ChallengeCard-BJf8kp0k.js";import{n as f,t as p}from"./StepFlowGraph-BiHocaMm.js";import{t as m}from"./SurfaceCard-DJ6PVBPM.js";var h=e(t(),1),g=n();function _({value:e,label:t,className:n}){let{t:r}=a(),[i,o]=(0,h.useState)(!1),s=(0,h.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}catch{}},[e]);return(0,g.jsx)(`button`,{type:`button`,onClick:s,className:n,"aria-label":i?r(`run.copied`):t,title:t,children:r(i?`run.copied`:`run.copy`)})}function v(e){return e.body.replace(/\n```json\s*[\s\S]*?```\s*$/g,``).trim()}function y(){let{t:e}=a(),{uri:t}=i(),{data:n,isLoading:y,isError:b,error:x}=l(t?decodeURIComponent(t):void 0,!0),[S,C]=(0,h.useState)(!1),[w,T]=(0,h.useState)(null);if(y&&!n)return(0,g.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`protocol.loading`)});if(b||!n)return(0,g.jsxs)(`div`,{role:`alert`,className:`p-4 rounded-[var(--radius-md)] bg-[var(--color-error-bg)] text-[var(--color-error)]`,children:[x instanceof Error?x.message:e(`protocol.notFound`),(0,g.jsx)(r,{to:`/`,className:`block mt-2 text-[var(--color-primary)] underline hover:no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`notFound.goHome`)})]});let{title:E,steps:D,triggers:O,completion:k}=o(n.content),A=E.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-|-$/g,``)||`protocol`,j=()=>{let e=new Blob([n.content],{type:`text/markdown;charset=utf-8`}),t=URL.createObjectURL(e),r=document.createElement(`a`);r.href=t,r.download=`${A}.md`,r.click(),URL.revokeObjectURL(t)},M=async()=>{if(n?.uri){T(null),C(!0);try{let{blob:e,skill_bundle_manifest:t}=await u(n.uri),r=s(t,A);c(e,r)}catch(e){T(e instanceof Error?e.message:String(e))}finally{C(!1)}}},N=`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`;return(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:E}),(0,g.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,g.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)] m-0`,children:[(0,g.jsxs)(`span`,{className:`sr-only`,children:[e(`protocol.uri`),`: `]}),(0,g.jsx)(`code`,{className:`break-all rounded bg-[var(--color-surface-elevated)] px-2 py-0.5 text-xs`,children:n.uri}),(0,g.jsxs)(`span`,{className:`ml-2`,children:[`· `,e(`protocol.readOnly`)]}),n.space_name!=null&&n.space_name.length>0?(0,g.jsxs)(`span`,{className:`ml-2 block w-full sm:inline sm:w-auto`,children:[`· `,e(`protocol.spaceLabel`),`: `,n.space_name]}):null]}),(0,g.jsx)(_,{value:n.uri,label:e(`protocol.copyUri`),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,g.jsxs)(`div`,{className:`mb-6 flex flex-wrap gap-2`,children:[(0,g.jsx)(r,{to:`/protocols/${encodeURIComponent(n.uri)}/run`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.runGuided`)}),(0,g.jsx)(r,{to:`/protocols/${encodeURIComponent(n.uri)}/edit`,className:N,children:e(`protocol.edit`)}),(0,g.jsx)(r,{to:`/protocols/new`,className:N,children:e(`protocol.duplicate`)})]}),(0,g.jsxs)(`div`,{className:`mb-6 grid gap-4 xl:grid-cols-[1.6fr_1fr]`,children:[(0,g.jsx)(m,{title:e(`protocol.howToUse`),subtitle:e(`protocol.howToUseInProduct`),children:(0,g.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)] m-0`,children:[e(`protocol.howToUseCopy`),` `,(0,g.jsx)(`a`,{href:`https://github.com/SquadRules/mcp#readme`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[var(--color-primary)] underline hover:no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.docsLink`)})]})}),(0,g.jsx)(m,{title:e(`protocol.exportCardTitle`),subtitle:e(`protocol.exportCardSubtitle`),children:(0,g.jsxs)(`div`,{className:`w-full max-w-[22rem] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3`,children:[(0,g.jsx)(`div`,{className:`mb-2 text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocol.download`)}),(0,g.jsxs)(`button`,{type:`button`,onClick:j,className:`flex min-h-[44px] w-full items-center justify-between rounded-[var(--radius-md)] px-3 text-left text-sm text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)]`,children:[(0,g.jsx)(`span`,{children:e(`protocol.downloadAsMarkdown`)}),(0,g.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:`.md`})]}),(0,g.jsxs)(`button`,{type:`button`,onClick:()=>void M(),disabled:S,className:`mt-1 flex min-h-[44px] w-full items-center justify-between rounded-[var(--radius-md)] px-3 text-left text-sm text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] disabled:opacity-60`,children:[(0,g.jsx)(`span`,{children:e(`protocol.downloadAsSkill`)}),(0,g.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:`.zip`})]}),w?(0,g.jsx)(`p`,{className:`mt-2 text-xs text-[var(--color-error)] m-0`,role:`alert`,children:w}):null,(0,g.jsxs)(r,{to:`/protocols/${encodeURIComponent(n.uri)}/skill`,className:`mt-1 flex min-h-[44px] w-full items-center justify-between rounded-[var(--radius-md)] px-3 text-left text-sm text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)]`,children:[(0,g.jsx)(`span`,{children:e(`protocol.editAsSkill`)}),(0,g.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:`bundle`})]}),(0,g.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-[var(--color-text-muted)] m-0`,children:e(`protocol.exportFooter`)})]})})]}),(0,g.jsxs)(`section`,{className:`mb-6`,"aria-labelledby":`flow-heading`,children:[(0,g.jsx)(`h2`,{id:`flow-heading`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:e(`protocol.stepFlow`)}),(0,g.jsx)(p,{steps:D.map(e=>({label:e.label}))})]}),(0,g.jsxs)(`section`,{"aria-labelledby":`steps-heading`,className:`mb-6`,children:[(0,g.jsx)(`h2`,{id:`steps-heading`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:e(`protocol.steps`)}),(0,g.jsx)(`ul`,{className:`m-0 list-none divide-y divide-[var(--color-border)] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-0`,children:D.map((e,t)=>{let n=v(e);return(0,g.jsxs)(`li`,{className:`p-4`,children:[(0,g.jsxs)(`strong`,{className:`block text-[var(--color-text-heading)]`,children:[t+1,`. `,e.label]}),(0,g.jsx)(`div`,{className:`mt-1 text-sm text-[var(--color-text-muted)] break-words`,children:e.summary}),(0,g.jsx)(`div`,{className:`mt-3`,children:(0,g.jsx)(d,{type:e.type,payload:e.challengePayload})}),n?(0,g.jsx)(`div`,{className:`mt-3 border-t border-[var(--color-border)] pt-3`,children:(0,g.jsx)(f,{content:n})}):null]},t)})})]}),(O||k)&&(0,g.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[O?(0,g.jsx)(m,{title:e(`protocol.triggers`),children:(0,g.jsx)(`div`,{className:`max-w-none text-sm text-[var(--color-text)]`,children:(0,g.jsx)(f,{content:O})})}):null,k?(0,g.jsx)(m,{title:e(`protocol.completion`),children:(0,g.jsx)(`div`,{className:`max-w-none text-sm text-[var(--color-text)]`,children:(0,g.jsx)(f,{content:k})})}):null]})]})}export{y as ProtocolDetailPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{a as r,f as i,p as a,t as o,v as s}from"./vendor-DEls6f-c.js";import{a as c,i as l,n as u,o as d,r as f,s as p,t as m}from"./export-skill-zip-DRU_W5EX.js";import{t as h}from"./api-BgTb-tmJ.js";import{t as g}from"./RichTextEditor-B6msD7tF.js";import{r as _,t as v}from"./SpaceSelect-LrJMAMEk.js";import{t as y}from"./SurfaceCard-DJ6PVBPM.js";import{t as b}from"./ChallengeCard-BJf8kp0k.js";var x=e(t(),1),S=o().min(1,`Protocol content is required`).refine(e=>e.includes(`# `),`Protocol must have an H1 title`).refine(e=>/(^|\n)##\s+Activation Patterns\b/i.test(e),`Include an "Activation Patterns" section (H2)`).refine(e=>/(^|\n)##\s+Reward Signal\b/i.test(e),`Include a "Reward Signal" section (H2)`),C={label:`Step`,bodyMarkdown:`What the user or agent does in this step.`,type:`comment`,comment:{min_length:10}},w=[`shell`,`forward`,`user_input`,`comment`],T=/^squadrules:\/\/adapter\/[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,E=n();function D({t:e,fileInputRef:t,onUpload:n,isNew:i,decodedUri:a}){return(0,E.jsx)(y,{className:`mb-8`,title:e(`protocolEdit.importCardTitle`),subtitle:e(`protocolEdit.uploadHint`),children:(0,E.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,E.jsx)(`input`,{ref:t,type:`file`,accept:`.md,text/markdown`,onChange:n,className:`sr-only`,id:`protocol-upload`,"aria-label":e(`protocolEdit.upload`)}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>t.current?.click(),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocolEdit.upload`)}),!i&&a&&(0,E.jsx)(r,{to:`/protocols/${encodeURIComponent(a)}/skill`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.editAsSkill`)})]})})}function O({t:e,preview:t,skillFolderSlug:n,isNew:i,decodedUri:a}){let[o,s]=(0,x.useState)(!1),[c,l]=(0,x.useState)(null);return(0,E.jsxs)(`div`,{className:`space-y-4`,"aria-label":e(`protocolEdit.previewLabel`),children:[(0,E.jsxs)(y,{title:e(`protocolEdit.previewRenderedTitle`),subtitle:e(`protocolEdit.previewRenderedSubtitle`),children:[(0,E.jsx)(`div`,{className:`text-lg font-semibold text-[var(--color-text-heading)]`,children:t.title}),(0,E.jsx)(`div`,{className:`mt-3 space-y-3`,children:t.steps.length===0?(0,E.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.previewNoSteps`)}):t.steps.slice(0,20).map((t,n)=>(0,E.jsxs)(`div`,{className:`rounded-[var(--radius-sm)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3`,children:[(0,E.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.previewStepLine`,{n:n+1,label:t.label})}),(0,E.jsx)(`div`,{className:`mt-1 text-sm text-[var(--color-text-muted)]`,children:b[t.type]??t.type})]},`${t.label}:${n}`))}),(0,E.jsxs)(`div`,{className:`mt-4 border-t border-[var(--color-border)] pt-4 text-sm text-[var(--color-text-muted)]`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`strong`,{className:`text-[var(--color-text-heading)]`,children:[e(`protocol.triggers`),`:`]}),` `,t.triggers?e(`protocolEdit.present`):e(`protocolEdit.missing`)]}),(0,E.jsxs)(`div`,{className:`mt-1`,children:[(0,E.jsxs)(`strong`,{className:`text-[var(--color-text-heading)]`,children:[e(`protocol.completion`),`:`]}),` `,t.completion?e(`protocolEdit.present`):e(`protocolEdit.missing`)]})]})]}),!i&&a?(0,E.jsxs)(y,{title:e(`protocolEdit.skillShortcutTitle`),subtitle:e(`protocolEdit.skillShortcutSubtitle`),children:[(0,E.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3`,children:[(0,E.jsxs)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:[n,`-skill/`]}),(0,E.jsxs)(`div`,{className:`mt-2 font-mono text-sm text-[var(--color-text-muted)]`,children:[`Skill.md`,(0,E.jsx)(`br`,{}),`references/`,(0,E.jsx)(`br`,{}),`\xA0\xA0SQUADRULES.md`]})]}),(0,E.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,E.jsx)(r,{to:`/protocols/${encodeURIComponent(a)}/skill`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.editAsSkill`)}),(0,E.jsx)(`button`,{type:`button`,disabled:o,onClick:()=>{(async()=>{if(a){l(null),s(!0);try{let{blob:e,skill_bundle_manifest:t}=await m(a),r=u(t,n);f(e,r)}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}}})()},className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] bg-[var(--color-primary)] px-4 py-2 text-sm font-medium text-white hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 disabled:opacity-60`,children:e(`protocol.downloadAsSkill`)}),c?(0,E.jsx)(`p`,{className:`mt-2 m-0 text-xs text-[var(--color-error)]`,role:`alert`,children:c}):null]})]}):null]})}function k({t:e,isNew:t,spaces:n,spacesLoading:r,targetSpace:i,setTargetSpace:a,forkSourceUri:o,setForkSourceUri:s,moveSpace:c,setMoveSpace:l}){return(0,E.jsx)(`section`,{className:`mb-8 space-y-5 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5`,children:t?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{htmlFor:`protocol-target-space`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.targetSpaceLabel`)}),(0,E.jsx)(v,{id:`protocol-target-space`,spaces:n,value:i,onChange:a,disabled:r}),(0,E.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.targetSpaceHint`)})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{htmlFor:`protocol-fork-source`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.forkSourceLabel`)}),(0,E.jsx)(`input`,{id:`protocol-fork-source`,type:`text`,value:o,onChange:e=>s(e.target.value),placeholder:e(`protocolEdit.forkSourcePlaceholder`),autoComplete:`off`,className:`min-h-[44px] w-full max-w-2xl rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),(0,E.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.forkSourceHint`)})]})]}):(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{htmlFor:`protocol-move-space`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.moveSpaceLabel`)}),(0,E.jsx)(v,{id:`protocol-move-space`,spaces:n,value:c,onChange:l,disabled:r}),(0,E.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.moveSpaceHint`)})]})})}var A=[`bash`,`sh`,`python3`,`python`,`node`],j=`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,M=`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`;function N({t:e,step:t,index:n,stepsLength:r,uploadKey:i,challengeTypeLabel:a,setStep:o,removeStep:s}){return(0,E.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5 space-y-5`,children:[(0,E.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{className:`text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.stepHeading`,{n:n+1})}),(0,E.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.stepEditorHint`)})]}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>s(n),disabled:r<=1,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 disabled:opacity-50`,children:e(`protocolEdit.removeStep`)})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.stepLabel`)}),(0,E.jsx)(`input`,{type:`text`,value:t.label,onChange:e=>o(n,{label:e.target.value}),className:j})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{className:`mb-2 font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.challengeType`)}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:w.map(e=>(0,E.jsx)(`button`,{type:`button`,"aria-pressed":t.type===e,onClick:()=>o(n,{type:e,shell:e===`shell`?{cmd:t.shell?.cmd??``,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:t.shell?.interpreter,workdir:t.shell?.workdir,flags:t.shell?.flags??[],args:t.shell?.args??[]}:void 0,forward:e===`forward`?{target:t.forward?.target??``}:void 0,user_input:e===`user_input`?{prompt:t.user_input?.prompt??``}:void 0,comment:e===`comment`?{min_length:t.comment?.min_length??10}:void 0}),className:`min-h-[44px] rounded-[var(--radius-md)] px-4 text-sm font-medium ${t.type===e?`bg-[var(--color-primary)] text-white`:`border border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text)]`}`,children:a[e]},e))})]}),(0,E.jsx)(`div`,{children:(0,E.jsx)(g,{label:e(`protocolEdit.stepContent`),value:t.bodyMarkdown,onChange:e=>o(n,{bodyMarkdown:e}),contentKey:i})}),(0,E.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,E.jsx)(`div`,{className:`mb-3 text-sm font-medium text-[var(--color-text-heading)]`,children:`Challenge fields`}),(0,E.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[t.type===`shell`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellCmd`)}),(0,E.jsx)(`input`,{type:`text`,value:t.shell?.cmd??``,onChange:e=>o(n,{shell:{cmd:e.target.value,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:t.shell?.interpreter,workdir:t.shell?.workdir,flags:t.shell?.flags??[],args:t.shell?.args??[]}}),className:M})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellTimeout`)}),(0,E.jsx)(`input`,{type:`number`,min:1,value:t.shell?.timeout_seconds??30,onChange:e=>o(n,{shell:{cmd:t.shell?.cmd??``,timeout_seconds:Math.max(1,Number(e.target.value)||30),interpreter:t.shell?.interpreter,workdir:t.shell?.workdir,flags:t.shell?.flags??[],args:t.shell?.args??[]}}),className:M})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellInterpreter`)}),(0,E.jsxs)(`select`,{required:!0,value:t.shell?.interpreter??``,onChange:e=>o(n,{shell:{cmd:t.shell?.cmd??``,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:e.target.value||void 0,workdir:t.shell?.workdir,flags:t.shell?.flags??[],args:t.shell?.args??[]}}),className:M,children:[(0,E.jsx)(`option`,{value:``,children:e(`protocolEdit.shellInterpreterPlaceholder`)}),A.map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))]}),(0,E.jsx)(`p`,{className:`mt-2 text-xs text-[var(--color-text-muted)]`,children:e(`protocolEdit.shellInterpreterHint`)})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellWorkdir`)}),(0,E.jsx)(`input`,{type:`text`,value:t.shell?.workdir??``,onChange:e=>o(n,{shell:{cmd:t.shell?.cmd??``,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:t.shell?.interpreter,workdir:e.target.value||void 0,flags:t.shell?.flags??[],args:t.shell?.args??[]}}),className:M})]}),(0,E.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellFlags`)}),(0,E.jsx)(`textarea`,{rows:3,value:(t.shell?.flags??[]).join(`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{a as r,f as i,p as a,t as o,v as s}from"./vendor-DuiEbTOR.js";import{a as c,i as l,n as u,o as d,r as f,s as p,t as m}from"./export-skill-zip-DcdfIu6o.js";import{t as h}from"./api-BgTb-tmJ.js";import{t as g}from"./RichTextEditor-B6msD7tF.js";import{r as _,t as v}from"./SpaceSelect-z6megrEL.js";import{t as y}from"./SurfaceCard-DJ6PVBPM.js";import{t as b}from"./ChallengeCard-BJf8kp0k.js";var x=e(t(),1),S=o().min(1,`Protocol content is required`).refine(e=>e.includes(`# `),`Protocol must have an H1 title`).refine(e=>/(^|\n)##\s+Activation Patterns\b/i.test(e),`Include an "Activation Patterns" section (H2)`).refine(e=>/(^|\n)##\s+Reward Signal\b/i.test(e),`Include a "Reward Signal" section (H2)`),C={label:`Step`,bodyMarkdown:`What the user or agent does in this step.`,type:`comment`,comment:{min_length:10}},w=[`shell`,`forward`,`user_input`,`comment`],T=/^squadrules:\/\/adapter\/[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,E=n();function D({t:e,fileInputRef:t,onUpload:n,isNew:i,decodedUri:a}){return(0,E.jsx)(y,{className:`mb-8`,title:e(`protocolEdit.importCardTitle`),subtitle:e(`protocolEdit.uploadHint`),children:(0,E.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,E.jsx)(`input`,{ref:t,type:`file`,accept:`.md,text/markdown`,onChange:n,className:`sr-only`,id:`protocol-upload`,"aria-label":e(`protocolEdit.upload`)}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>t.current?.click(),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocolEdit.upload`)}),!i&&a&&(0,E.jsx)(r,{to:`/protocols/${encodeURIComponent(a)}/skill`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.editAsSkill`)})]})})}function O({t:e,preview:t,skillFolderSlug:n,isNew:i,decodedUri:a}){let[o,s]=(0,x.useState)(!1),[c,l]=(0,x.useState)(null);return(0,E.jsxs)(`div`,{className:`space-y-4`,"aria-label":e(`protocolEdit.previewLabel`),children:[(0,E.jsxs)(y,{title:e(`protocolEdit.previewRenderedTitle`),subtitle:e(`protocolEdit.previewRenderedSubtitle`),children:[(0,E.jsx)(`div`,{className:`text-lg font-semibold text-[var(--color-text-heading)]`,children:t.title}),(0,E.jsx)(`div`,{className:`mt-3 space-y-3`,children:t.steps.length===0?(0,E.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.previewNoSteps`)}):t.steps.slice(0,20).map((t,n)=>(0,E.jsxs)(`div`,{className:`rounded-[var(--radius-sm)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3`,children:[(0,E.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.previewStepLine`,{n:n+1,label:t.label})}),(0,E.jsx)(`div`,{className:`mt-1 text-sm text-[var(--color-text-muted)]`,children:b[t.type]??t.type})]},`${t.label}:${n}`))}),(0,E.jsxs)(`div`,{className:`mt-4 border-t border-[var(--color-border)] pt-4 text-sm text-[var(--color-text-muted)]`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`strong`,{className:`text-[var(--color-text-heading)]`,children:[e(`protocol.triggers`),`:`]}),` `,t.triggers?e(`protocolEdit.present`):e(`protocolEdit.missing`)]}),(0,E.jsxs)(`div`,{className:`mt-1`,children:[(0,E.jsxs)(`strong`,{className:`text-[var(--color-text-heading)]`,children:[e(`protocol.completion`),`:`]}),` `,t.completion?e(`protocolEdit.present`):e(`protocolEdit.missing`)]})]})]}),!i&&a?(0,E.jsxs)(y,{title:e(`protocolEdit.skillShortcutTitle`),subtitle:e(`protocolEdit.skillShortcutSubtitle`),children:[(0,E.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3`,children:[(0,E.jsxs)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:[n,`-skill/`]}),(0,E.jsxs)(`div`,{className:`mt-2 font-mono text-sm text-[var(--color-text-muted)]`,children:[`Skill.md`,(0,E.jsx)(`br`,{}),`references/`,(0,E.jsx)(`br`,{}),`\xA0\xA0SQUADRULES.md`]})]}),(0,E.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,E.jsx)(r,{to:`/protocols/${encodeURIComponent(a)}/skill`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.editAsSkill`)}),(0,E.jsx)(`button`,{type:`button`,disabled:o,onClick:()=>{(async()=>{if(a){l(null),s(!0);try{let{blob:e,skill_bundle_manifest:t}=await m(a),r=u(t,n);f(e,r)}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}}})()},className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] bg-[var(--color-primary)] px-4 py-2 text-sm font-medium text-white hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 disabled:opacity-60`,children:e(`protocol.downloadAsSkill`)}),c?(0,E.jsx)(`p`,{className:`mt-2 m-0 text-xs text-[var(--color-error)]`,role:`alert`,children:c}):null]})]}):null]})}function k({t:e,isNew:t,spaces:n,spacesLoading:r,targetSpace:i,setTargetSpace:a,forkSourceUri:o,setForkSourceUri:s,moveSpace:c,setMoveSpace:l}){return(0,E.jsx)(`section`,{className:`mb-8 space-y-5 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5`,children:t?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{htmlFor:`protocol-target-space`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.targetSpaceLabel`)}),(0,E.jsx)(v,{id:`protocol-target-space`,spaces:n,value:i,onChange:a,disabled:r}),(0,E.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.targetSpaceHint`)})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{htmlFor:`protocol-fork-source`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.forkSourceLabel`)}),(0,E.jsx)(`input`,{id:`protocol-fork-source`,type:`text`,value:o,onChange:e=>s(e.target.value),placeholder:e(`protocolEdit.forkSourcePlaceholder`),autoComplete:`off`,className:`min-h-[44px] w-full max-w-2xl rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),(0,E.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.forkSourceHint`)})]})]}):(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{htmlFor:`protocol-move-space`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.moveSpaceLabel`)}),(0,E.jsx)(v,{id:`protocol-move-space`,spaces:n,value:c,onChange:l,disabled:r}),(0,E.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.moveSpaceHint`)})]})})}var A=[`bash`,`sh`,`python3`,`python`,`node`],j=`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,M=`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`;function N({t:e,step:t,index:n,stepsLength:r,uploadKey:i,challengeTypeLabel:a,setStep:o,removeStep:s}){return(0,E.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5 space-y-5`,children:[(0,E.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{className:`text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.stepHeading`,{n:n+1})}),(0,E.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.stepEditorHint`)})]}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>s(n),disabled:r<=1,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 disabled:opacity-50`,children:e(`protocolEdit.removeStep`)})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.stepLabel`)}),(0,E.jsx)(`input`,{type:`text`,value:t.label,onChange:e=>o(n,{label:e.target.value}),className:j})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{className:`mb-2 font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.challengeType`)}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:w.map(e=>(0,E.jsx)(`button`,{type:`button`,"aria-pressed":t.type===e,onClick:()=>o(n,{type:e,shell:e===`shell`?{cmd:t.shell?.cmd??``,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:t.shell?.interpreter,workdir:t.shell?.workdir,flags:t.shell?.flags??[],args:t.shell?.args??[]}:void 0,forward:e===`forward`?{target:t.forward?.target??``}:void 0,user_input:e===`user_input`?{prompt:t.user_input?.prompt??``}:void 0,comment:e===`comment`?{min_length:t.comment?.min_length??10}:void 0}),className:`min-h-[44px] rounded-[var(--radius-md)] px-4 text-sm font-medium ${t.type===e?`bg-[var(--color-primary)] text-white`:`border border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text)]`}`,children:a[e]},e))})]}),(0,E.jsx)(`div`,{children:(0,E.jsx)(g,{label:e(`protocolEdit.stepContent`),value:t.bodyMarkdown,onChange:e=>o(n,{bodyMarkdown:e}),contentKey:i})}),(0,E.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,E.jsx)(`div`,{className:`mb-3 text-sm font-medium text-[var(--color-text-heading)]`,children:`Challenge fields`}),(0,E.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[t.type===`shell`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellCmd`)}),(0,E.jsx)(`input`,{type:`text`,value:t.shell?.cmd??``,onChange:e=>o(n,{shell:{cmd:e.target.value,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:t.shell?.interpreter,workdir:t.shell?.workdir,flags:t.shell?.flags??[],args:t.shell?.args??[]}}),className:M})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellTimeout`)}),(0,E.jsx)(`input`,{type:`number`,min:1,value:t.shell?.timeout_seconds??30,onChange:e=>o(n,{shell:{cmd:t.shell?.cmd??``,timeout_seconds:Math.max(1,Number(e.target.value)||30),interpreter:t.shell?.interpreter,workdir:t.shell?.workdir,flags:t.shell?.flags??[],args:t.shell?.args??[]}}),className:M})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellInterpreter`)}),(0,E.jsxs)(`select`,{required:!0,value:t.shell?.interpreter??``,onChange:e=>o(n,{shell:{cmd:t.shell?.cmd??``,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:e.target.value||void 0,workdir:t.shell?.workdir,flags:t.shell?.flags??[],args:t.shell?.args??[]}}),className:M,children:[(0,E.jsx)(`option`,{value:``,children:e(`protocolEdit.shellInterpreterPlaceholder`)}),A.map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))]}),(0,E.jsx)(`p`,{className:`mt-2 text-xs text-[var(--color-text-muted)]`,children:e(`protocolEdit.shellInterpreterHint`)})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellWorkdir`)}),(0,E.jsx)(`input`,{type:`text`,value:t.shell?.workdir??``,onChange:e=>o(n,{shell:{cmd:t.shell?.cmd??``,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:t.shell?.interpreter,workdir:e.target.value||void 0,flags:t.shell?.flags??[],args:t.shell?.args??[]}}),className:M})]}),(0,E.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellFlags`)}),(0,E.jsx)(`textarea`,{rows:3,value:(t.shell?.flags??[]).join(`
|
|
2
2
|
`),onChange:e=>o(n,{shell:{cmd:t.shell?.cmd??``,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:t.shell?.interpreter,workdir:t.shell?.workdir,flags:e.target.value.split(`
|
|
3
3
|
`).map(e=>e.trim()).filter(Boolean),args:t.shell?.args??[]}}),className:`w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,E.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellArgs`)}),(0,E.jsx)(`textarea`,{rows:3,value:(t.shell?.args??[]).join(`
|
|
4
4
|
`),onChange:e=>o(n,{shell:{cmd:t.shell?.cmd??``,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:t.shell?.interpreter,workdir:t.shell?.workdir,flags:t.shell?.flags??[],args:e.target.value.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{a as r,m as i,p as a,s as o,v as s}from"./vendor-DEls6f-c.js";import{n as c}from"./ChallengeCard-BJf8kp0k.js";import{n as l,t as u}from"./StepFlowGraph-509IoD3J.js";import{t as d}from"./SurfaceCard-DJ6PVBPM.js";import{t as f}from"./ErrorAlert-CpqG3xN8.js";import{t as p}from"./api-BgTb-tmJ.js";import{n as m,t as h}from"./useRunSession-Cg4iouK8.js";var g=e(t(),1),_=n();function v({contract:e,disabled:t,onSubmit:n}){let{t:r}=s(),i=e.type,[a,o]=(0,g.useState)(0),[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)(``),f=e.forward?.target??``,[p,m]=(0,g.useState)(!0),h=e.user_input?.prompt??``,[v,y]=(0,g.useState)(``),b=e.comment?.min_length??10,[x,S]=(0,g.useState)(``),[C,w]=(0,g.useState)(null);(0,g.useEffect)(()=>{w(null),o(0),l(``),d(``),m(!0),y(``),S(``)},[i,f,h,b]);let T=(0,g.useMemo)(()=>i===`shell`?Number.isFinite(a):i===`forward`?f.trim().length>0:i===`user_input`?v.trim().length>0:i===`comment`&&x.trim().length>=b,[i,a,f,v,x,b]);return(0,_.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),w(null),T)try{if(i===`shell`){n({type:i,shell:{exit_code:a,...c.trim()?{stdout:c}:{},...u.trim()?{stderr:u}:{}}});return}if(i===`forward`){n({type:i,forward:{target:f,success:p}});return}if(i===`user_input`){n({type:i,user_input:{confirmation:v.trim(),timestamp:new Date().toISOString()}});return}if(i===`comment`){n({type:i,comment:{text:x.trim()}});return}}catch(e){w(e instanceof Error?e.message:String(e))}},"aria-label":r(`run.solutionFormLabel`),children:[C&&(0,_.jsx)(`div`,{className:`mb-4 p-4 rounded-[var(--radius-md)] bg-[var(--color-error-bg)] text-[var(--color-error)]`,role:`alert`,children:C}),i===`shell`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-shell-exit-code`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.exitCode`)}),(0,_.jsx)(`input`,{id:`run-shell-exit-code`,type:`number`,inputMode:`numeric`,value:a,onChange:e=>o(Number(e.target.value)),className:`w-full min-h-[44px] px-4 py-2 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,disabled:t,required:!0})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-shell-stdout`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.stdout`)}),(0,_.jsx)(`textarea`,{id:`run-shell-stdout`,value:c,onChange:e=>l(e.target.value),className:`w-full min-h-[8rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-shell-stderr`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.stderr`)}),(0,_.jsx)(`textarea`,{id:`run-shell-stderr`,value:u,onChange:e=>d(e.target.value),className:`w-full min-h-[6rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t})]})]}),i===`forward`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,_.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:r(`run.forward.target`)}),(0,_.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)] break-all`,children:f||r(`run.forward.targetMissing`)})]}),(0,_.jsxs)(`label`,{className:`inline-flex items-center gap-2 min-h-[44px]`,children:[(0,_.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked),disabled:t,className:`h-4 w-4`}),(0,_.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:r(`run.forward.success`)})]})]}),i===`user_input`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,_.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:r(`run.userInput.prompt`)}),(0,_.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:h||r(`run.userInput.promptMissing`)})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-user-confirmation`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.userInput.confirmation`)}),(0,_.jsx)(`textarea`,{id:`run-user-confirmation`,value:v,onChange:e=>y(e.target.value),className:`w-full min-h-[6rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] resize-y`,disabled:t,required:!0})]})]}),i===`comment`&&(0,_.jsxs)(`div`,{className:`space-y-2`,children:[(0,_.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[r(`run.comment.minLength`,{count:b}),` · `,r(`run.comment.count`,{count:x.length})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-comment-text`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.comment.text`)}),(0,_.jsx)(`textarea`,{id:`run-comment-text`,value:x,onChange:e=>S(e.target.value),className:`w-full min-h-[10rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] resize-y`,disabled:t,required:!0,"aria-invalid":x.trim().length>0&&x.trim().length<b})]})]}),(0,_.jsx)(`button`,{type:`submit`,disabled:t||!T,className:`mt-4 min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:r(`run.submitStep`)})]})}function y(e){let t=e.type;if(t===`shell`){let t=e.shell?.cmd;return{type:`shell`,...t?{payload:{cmd:t}}:{}}}if(t===`forward`){let t=e.forward?.target;return{type:`forward`,...t?{payload:{target:t}}:{}}}if(t===`user_input`){let t=e.user_input?.prompt;return{type:`user_input`,...t?{payload:{prompt:t}}:{}}}if(t===`comment`){let t=e.comment?.min_length;return{type:`comment`,...t==null?{}:{payload:{min_length:t}}}}return{type:t}}function b(e,t){let n=e.history.length,r=e.status===`running`,i=!!e.current_layer,a=e.status===`ready_to_reward`||e.status===`completed`||e.status===`error`,o=a?Math.max(n,1):Math.max(n+(r&&i?1:0),+!!r)||1;return{flowSteps:Array.from({length:o},(e,n)=>({label:t(n+1)})),currentFlowIndex:r&&i?n:void 0,displayCurrent:r&&i?n+1:a?o:Math.max(n,1),displayTotal:o}}function x({run:e,rewardOutcome:t,setRewardOutcome:n,rewardFeedback:r,setRewardFeedback:i,copyStatus:a,onCopy:o,onSubmitStep:d,onReward:f,isForwardStepPending:p,isForwardStartPending:m,isRewardPending:h}){let{t:g}=s(),{flowSteps:x,currentFlowIndex:S,displayCurrent:C,displayTotal:w}=b(e,e=>g(`run.flowStepN`,{n:e})),T=y(e.contract);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`section`,{className:`mb-6`,"aria-labelledby":`run-flow-heading`,children:[(0,_.jsx)(`h2`,{id:`run-flow-heading`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.progressHeading`)}),(0,_.jsx)(u,{steps:x,currentIndex:S})]}),(0,_.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2 text-sm text-[var(--color-text-muted)]`,role:`status`,children:[(0,_.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)]`,children:g(`run.stepProgress`,{current:C,total:w})}),(0,_.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,_.jsx)(`span`,{children:g(`run.sessionBadge`)})]}),e.last_message&&(0,_.jsxs)(`div`,{className:`mb-4 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,role:`status`,"aria-live":`polite`,children:[(0,_.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:g(`run.serverMessage`)}),(0,_.jsx)(`div`,{className:`text-[var(--color-text)]`,children:e.last_message})]}),(0,_.jsxs)(`section`,{"aria-labelledby":`run-current-step`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-current-step`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.currentStepHeading`)}),(0,_.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:e.current_layer?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`mb-2 text-sm text-[var(--color-text-muted)]`,children:[g(`run.layerUri`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.current_layer.uri})]}),e.current_layer.content?(0,_.jsx)(`div`,{className:`prose prose-sm max-w-none text-[var(--color-text)]`,children:(0,_.jsx)(l,{content:e.current_layer.content})}):(0,_.jsx)(`p`,{className:`m-0 text-sm text-[var(--color-text-muted)]`,children:g(`run.noLayerContent`)})]}):(0,_.jsx)(`p`,{className:`m-0 text-sm text-[var(--color-text-muted)]`,children:g(`run.noLayerContent`)})})]}),(0,_.jsxs)(`section`,{"aria-labelledby":`run-challenge`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-challenge`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.challengeHeading`)}),(0,_.jsx)(c,{type:T.type,payload:T.payload}),e.contract.type===`shell`&&e.contract.shell?.cmd&&(0,_.jsxs)(`div`,{className:`mt-2`,children:[(0,_.jsx)(`button`,{type:`button`,onClick:()=>o(e.contract.shell.cmd),className:`min-h-[44px] min-w-[44px] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:g(`run.copyShellCommand`)}),a?(0,_.jsx)(`div`,{className:`mt-2 text-xs text-[var(--color-text-muted)]`,children:a}):null]}),(0,_.jsxs)(`details`,{className:`mt-4 text-sm`,children:[(0,_.jsx)(`summary`,{className:`cursor-pointer text-[var(--color-primary)]`,children:g(`run.advanced`)}),(0,_.jsxs)(`div`,{className:`mt-2 space-y-2 text-[var(--color-text-muted)]`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:g(`run.contractType`)}),`:`,` `,(0,_.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)]`,children:e.contract.type})]}),e.contract.description&&(0,_.jsx)(`p`,{className:`m-0 text-sm`,children:e.contract.description}),e.contract.nonce&&(0,_.jsxs)(`div`,{children:[g(`run.nonce`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.contract.nonce})]}),e.contract.proof_hash&&(0,_.jsxs)(`div`,{children:[g(`run.proofHash`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.contract.proof_hash})]}),e.previous_proof_hash&&(0,_.jsxs)(`div`,{children:[g(`run.previousProofHash`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.previous_proof_hash})]})]})]})]}),e.status!==`completed`&&e.status!==`ready_to_reward`&&(0,_.jsxs)(`section`,{"aria-labelledby":`run-solution`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-solution`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.solution`)}),(0,_.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:(0,_.jsx)(v,{contract:e.contract,disabled:p||m,onSubmit:d})})]}),e.status===`ready_to_reward`&&(0,_.jsxs)(`section`,{"aria-labelledby":`run-reward`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-reward`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.reward.title`)}),(0,_.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,_.jsx)(`div`,{className:`mb-4 text-sm text-[var(--color-text-muted)]`,children:g(`run.reward.subtitle`)}),(0,_.jsxs)(`div`,{className:`mb-4 flex flex-wrap gap-4`,role:`radiogroup`,"aria-label":g(`run.reward.outcomeLabel`),children:[(0,_.jsxs)(`label`,{className:`inline-flex min-h-[44px] items-center gap-2`,children:[(0,_.jsx)(`input`,{type:`radio`,name:`reward-outcome`,value:`success`,checked:t===`success`,onChange:()=>n(`success`)}),(0,_.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:g(`run.reward.success`)})]}),(0,_.jsxs)(`label`,{className:`inline-flex min-h-[44px] items-center gap-2`,children:[(0,_.jsx)(`input`,{type:`radio`,name:`reward-outcome`,value:`failure`,checked:t===`failure`,onChange:()=>n(`failure`)}),(0,_.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:g(`run.reward.failure`)})]})]}),(0,_.jsxs)(`div`,{className:`mb-4`,children:[(0,_.jsx)(`label`,{htmlFor:`run-reward-feedback`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:g(`run.reward.feedback`)}),(0,_.jsx)(`textarea`,{id:`run-reward-feedback`,value:r,onChange:e=>i(e.target.value),className:`min-h-[8rem] w-full resize-y rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,_.jsx)(`button`,{type:`button`,onClick:f,disabled:h,className:`min-h-[44px] min-w-[44px] cursor-pointer rounded-[var(--radius-md)] border-0 bg-[var(--color-primary)] px-4 py-2 font-medium text-white hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:opacity-60`,children:g(h?`run.reward.submitting`:`run.reward.submit`)})]})]}),e.history.length>0&&(0,_.jsxs)(`section`,{"aria-labelledby":`run-history`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-history`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.history`)}),(0,_.jsx)(`ul`,{className:`m-0 list-none space-y-2 p-0`,"aria-label":g(`run.historyLabel`),children:e.history.slice().reverse().map((e,t)=>(0,_.jsxs)(`li`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,_.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[new Date(e.submitted_at).toLocaleString(),` · `,e.contract.type,` ·`,` `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.layer.uri})]}),e.server_message&&(0,_.jsx)(`div`,{className:`mt-1 text-sm text-[var(--color-text)]`,children:e.server_message})]},`${e.layer.uri}:${t}`))})]}),e.status===`completed`&&(0,_.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--status-success-bg)] p-4 text-[var(--status-success-fg)]`,children:[(0,_.jsx)(`strong`,{className:`block`,children:g(`run.completed`)}),e.last_message&&(0,_.jsx)(`div`,{className:`mt-1 text-sm`,children:e.last_message})]})]})}async function S(e){let t=await p(`/api/forward`,{method:`POST`,body:JSON.stringify({uri:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return await t.json()}function C(){return i({mutationFn:e=>S(e)})}async function w(e){let t=await p(`/api/forward`,{method:`POST`,body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return await t.json()}function T(){return i({mutationFn:e=>w(e)})}async function E(e){let t=await p(`/api/reward`,{method:`POST`,body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return await t.json()}function D(){return i({mutationFn:e=>E(e)})}function O(e){if(e)return e.match(/squadrules:\/\/layer\/[0-9a-fA-F-]{36}(?:\?execution_id=[0-9a-fA-F-]{36})?/)?.[0]}function k(){return new Date().toISOString()}function A(){let{t:e}=s(),{uri:t}=a(),[n]=o(),i=t?decodeURIComponent(t):void 0,c=n.get(`session`),{session:l}=h(c),{upsert:u}=m(),p=C(),v=T(),y=D(),[b,S]=(0,g.useState)(null),[w,E]=(0,g.useState)(`success`),[A,j]=(0,g.useState)(``),[M,N]=(0,g.useState)(null);(0,g.useEffect)(()=>{l&&!b&&(S(l),E(`success`),j(``))},[l,b]);let P=e=>{S(e),u(e)},F=async()=>{if(i)try{let e=await p.mutateAsync(i),t=k(),n=`${i}:${t}`,r=e.next_action?.includes(`reward`)?`ready_to_reward`:`running`,a=O(e.next_action);P({id:n,adapter_uri:i,started_at:t,updated_at:t,status:r,current_layer:e.current_layer??null,contract:e.contract,next_action:e.next_action,last_message:e.message,previous_proof_hash:e.proof_hash,reward_uri:r===`ready_to_reward`?a:void 0,history:[]})}catch{S(null)}};return i?(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:e(`run.title`)}),(0,_.jsx)(`p`,{className:`mb-4 text-sm text-[var(--color-text-muted)]`,children:e(`run.guidedIntro`)}),(0,_.jsxs)(`p`,{className:`mb-4 text-sm text-[var(--color-text-muted)]`,children:[e(`run.adapterUri`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:i})]}),(0,_.jsxs)(`div`,{className:`flex flex-wrap gap-2 mb-6`,children:[(0,_.jsx)(r,{to:`/protocols/${encodeURIComponent(i)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`run.backToProtocol`)}),!b&&(0,_.jsx)(`button`,{type:`button`,onClick:F,disabled:p.isPending,className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:p.isPending?e(`run.starting`):e(`run.start`)})]}),(0,_.jsx)(d,{className:`mb-6`,title:e(`run.safety.title`),children:(0,_.jsx)(`p`,{className:`m-0 text-sm text-[var(--color-text-muted)]`,children:e(`run.safety.copy`)})}),p.isError&&(0,_.jsx)(f,{message:p.error instanceof Error?p.error.message:String(p.error),onRetry:()=>F(),showGoBack:!0}),b?.status===`error`&&b.last_message&&(0,_.jsx)(`div`,{className:`mb-6`,children:(0,_.jsx)(f,{message:b.last_message,onRetry:()=>F(),showGoBack:!0})}),b&&b.status!==`error`&&(0,_.jsx)(x,{run:b,rewardOutcome:w,setRewardOutcome:E,rewardFeedback:A,setRewardFeedback:j,copyStatus:M,onCopy:async t=>{N(null);try{await navigator.clipboard.writeText(t),N(e(`run.copied`)),setTimeout(()=>N(null),1500)}catch(e){N(e instanceof Error?e.message:String(e))}},onSubmitStep:async e=>{if(!b?.current_layer)return;let t=b.contract.nonce,n=b.previous_proof_hash??b.contract.proof_hash,r={...e,...t?{nonce:t}:{},...n?{proof_hash:n}:{}};try{let e=await v.mutateAsync({uri:b.current_layer.uri,solution:r}),t=k(),n=e.next_action?.includes(`reward`)||(e.message?.toLowerCase().includes(`call reward`)??!1),i=O(e.next_action)??b.reward_uri;P({...b,updated_at:t,status:n?`ready_to_reward`:`running`,current_layer:e.current_layer??null,contract:e.contract,next_action:e.next_action,last_message:e.message,previous_proof_hash:e.proof_hash??b.previous_proof_hash,reward_uri:n?i:void 0,history:[...b.history,{layer:b.current_layer,contract:b.contract,solution:r,submitted_at:t,proof_hash:e.proof_hash,server_message:e.message}]})}catch(e){P({...b,updated_at:k(),status:`error`,last_message:e instanceof Error?e.message:String(e)})}},onReward:async()=>{if(!b)return;let t=b.reward_uri??b.current_layer?.uri;if(t)try{let n=await y.mutateAsync({uri:t,outcome:w,feedback:A.trim()||e(`run.reward.defaultFeedback`)});P({...b,updated_at:k(),status:`completed`,last_message:n.results[0]?.feedback??b.last_message})}catch(e){P({...b,updated_at:k(),status:`error`,last_message:e instanceof Error?e.message:String(e)})}},isForwardStepPending:v.isPending,isForwardStartPending:p.isPending,isRewardPending:y.isPending})]}):(0,_.jsx)(f,{message:e(`run.missingUri`),showGoBack:!0})}export{A as RunGuidedPage};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{a as r,m as i,p as a,s as o,v as s}from"./vendor-DuiEbTOR.js";import{n as c}from"./ChallengeCard-BJf8kp0k.js";import{n as l,t as u}from"./StepFlowGraph-BiHocaMm.js";import{t as d}from"./SurfaceCard-DJ6PVBPM.js";import{t as f}from"./ErrorAlert-DK5iZ4a9.js";import{t as p}from"./api-BgTb-tmJ.js";import{n as m,t as h}from"./useRunSession-Cg4iouK8.js";var g=e(t(),1),_=n();function v({contract:e,disabled:t,onSubmit:n}){let{t:r}=s(),i=e.type,[a,o]=(0,g.useState)(0),[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)(``),f=e.forward?.target??``,[p,m]=(0,g.useState)(!0),h=e.user_input?.prompt??``,[v,y]=(0,g.useState)(``),b=e.comment?.min_length??10,[x,S]=(0,g.useState)(``),[C,w]=(0,g.useState)(null);(0,g.useEffect)(()=>{w(null),o(0),l(``),d(``),m(!0),y(``),S(``)},[i,f,h,b]);let T=(0,g.useMemo)(()=>i===`shell`?Number.isFinite(a):i===`forward`?f.trim().length>0:i===`user_input`?v.trim().length>0:i===`comment`&&x.trim().length>=b,[i,a,f,v,x,b]);return(0,_.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),w(null),T)try{if(i===`shell`){n({type:i,shell:{exit_code:a,...c.trim()?{stdout:c}:{},...u.trim()?{stderr:u}:{}}});return}if(i===`forward`){n({type:i,forward:{target:f,success:p}});return}if(i===`user_input`){n({type:i,user_input:{confirmation:v.trim(),timestamp:new Date().toISOString()}});return}if(i===`comment`){n({type:i,comment:{text:x.trim()}});return}}catch(e){w(e instanceof Error?e.message:String(e))}},"aria-label":r(`run.solutionFormLabel`),children:[C&&(0,_.jsx)(`div`,{className:`mb-4 p-4 rounded-[var(--radius-md)] bg-[var(--color-error-bg)] text-[var(--color-error)]`,role:`alert`,children:C}),i===`shell`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-shell-exit-code`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.exitCode`)}),(0,_.jsx)(`input`,{id:`run-shell-exit-code`,type:`number`,inputMode:`numeric`,value:a,onChange:e=>o(Number(e.target.value)),className:`w-full min-h-[44px] px-4 py-2 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,disabled:t,required:!0})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-shell-stdout`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.stdout`)}),(0,_.jsx)(`textarea`,{id:`run-shell-stdout`,value:c,onChange:e=>l(e.target.value),className:`w-full min-h-[8rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-shell-stderr`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.stderr`)}),(0,_.jsx)(`textarea`,{id:`run-shell-stderr`,value:u,onChange:e=>d(e.target.value),className:`w-full min-h-[6rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t})]})]}),i===`forward`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,_.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:r(`run.forward.target`)}),(0,_.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)] break-all`,children:f||r(`run.forward.targetMissing`)})]}),(0,_.jsxs)(`label`,{className:`inline-flex items-center gap-2 min-h-[44px]`,children:[(0,_.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked),disabled:t,className:`h-4 w-4`}),(0,_.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:r(`run.forward.success`)})]})]}),i===`user_input`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,_.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:r(`run.userInput.prompt`)}),(0,_.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:h||r(`run.userInput.promptMissing`)})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-user-confirmation`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.userInput.confirmation`)}),(0,_.jsx)(`textarea`,{id:`run-user-confirmation`,value:v,onChange:e=>y(e.target.value),className:`w-full min-h-[6rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] resize-y`,disabled:t,required:!0})]})]}),i===`comment`&&(0,_.jsxs)(`div`,{className:`space-y-2`,children:[(0,_.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[r(`run.comment.minLength`,{count:b}),` · `,r(`run.comment.count`,{count:x.length})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-comment-text`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.comment.text`)}),(0,_.jsx)(`textarea`,{id:`run-comment-text`,value:x,onChange:e=>S(e.target.value),className:`w-full min-h-[10rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] resize-y`,disabled:t,required:!0,"aria-invalid":x.trim().length>0&&x.trim().length<b})]})]}),(0,_.jsx)(`button`,{type:`submit`,disabled:t||!T,className:`mt-4 min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:r(`run.submitStep`)})]})}function y(e){let t=e.type;if(t===`shell`){let t=e.shell?.cmd;return{type:`shell`,...t?{payload:{cmd:t}}:{}}}if(t===`forward`){let t=e.forward?.target;return{type:`forward`,...t?{payload:{target:t}}:{}}}if(t===`user_input`){let t=e.user_input?.prompt;return{type:`user_input`,...t?{payload:{prompt:t}}:{}}}if(t===`comment`){let t=e.comment?.min_length;return{type:`comment`,...t==null?{}:{payload:{min_length:t}}}}return{type:t}}function b(e,t){let n=e.history.length,r=e.status===`running`,i=!!e.current_layer,a=e.status===`ready_to_reward`||e.status===`completed`||e.status===`error`,o=a?Math.max(n,1):Math.max(n+(r&&i?1:0),+!!r)||1;return{flowSteps:Array.from({length:o},(e,n)=>({label:t(n+1)})),currentFlowIndex:r&&i?n:void 0,displayCurrent:r&&i?n+1:a?o:Math.max(n,1),displayTotal:o}}function x({run:e,rewardOutcome:t,setRewardOutcome:n,rewardFeedback:r,setRewardFeedback:i,copyStatus:a,onCopy:o,onSubmitStep:d,onReward:f,isForwardStepPending:p,isForwardStartPending:m,isRewardPending:h}){let{t:g}=s(),{flowSteps:x,currentFlowIndex:S,displayCurrent:C,displayTotal:w}=b(e,e=>g(`run.flowStepN`,{n:e})),T=y(e.contract);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`section`,{className:`mb-6`,"aria-labelledby":`run-flow-heading`,children:[(0,_.jsx)(`h2`,{id:`run-flow-heading`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.progressHeading`)}),(0,_.jsx)(u,{steps:x,currentIndex:S})]}),(0,_.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2 text-sm text-[var(--color-text-muted)]`,role:`status`,children:[(0,_.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)]`,children:g(`run.stepProgress`,{current:C,total:w})}),(0,_.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,_.jsx)(`span`,{children:g(`run.sessionBadge`)})]}),e.last_message&&(0,_.jsxs)(`div`,{className:`mb-4 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,role:`status`,"aria-live":`polite`,children:[(0,_.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:g(`run.serverMessage`)}),(0,_.jsx)(`div`,{className:`text-[var(--color-text)]`,children:e.last_message})]}),(0,_.jsxs)(`section`,{"aria-labelledby":`run-current-step`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-current-step`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.currentStepHeading`)}),(0,_.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:e.current_layer?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`mb-2 text-sm text-[var(--color-text-muted)]`,children:[g(`run.layerUri`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.current_layer.uri})]}),e.current_layer.content?(0,_.jsx)(`div`,{className:`prose prose-sm max-w-none text-[var(--color-text)]`,children:(0,_.jsx)(l,{content:e.current_layer.content})}):(0,_.jsx)(`p`,{className:`m-0 text-sm text-[var(--color-text-muted)]`,children:g(`run.noLayerContent`)})]}):(0,_.jsx)(`p`,{className:`m-0 text-sm text-[var(--color-text-muted)]`,children:g(`run.noLayerContent`)})})]}),(0,_.jsxs)(`section`,{"aria-labelledby":`run-challenge`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-challenge`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.challengeHeading`)}),(0,_.jsx)(c,{type:T.type,payload:T.payload}),e.contract.type===`shell`&&e.contract.shell?.cmd&&(0,_.jsxs)(`div`,{className:`mt-2`,children:[(0,_.jsx)(`button`,{type:`button`,onClick:()=>o(e.contract.shell.cmd),className:`min-h-[44px] min-w-[44px] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:g(`run.copyShellCommand`)}),a?(0,_.jsx)(`div`,{className:`mt-2 text-xs text-[var(--color-text-muted)]`,children:a}):null]}),(0,_.jsxs)(`details`,{className:`mt-4 text-sm`,children:[(0,_.jsx)(`summary`,{className:`cursor-pointer text-[var(--color-primary)]`,children:g(`run.advanced`)}),(0,_.jsxs)(`div`,{className:`mt-2 space-y-2 text-[var(--color-text-muted)]`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:g(`run.contractType`)}),`:`,` `,(0,_.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)]`,children:e.contract.type})]}),e.contract.description&&(0,_.jsx)(`p`,{className:`m-0 text-sm`,children:e.contract.description}),e.contract.nonce&&(0,_.jsxs)(`div`,{children:[g(`run.nonce`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.contract.nonce})]}),e.contract.proof_hash&&(0,_.jsxs)(`div`,{children:[g(`run.proofHash`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.contract.proof_hash})]}),e.previous_proof_hash&&(0,_.jsxs)(`div`,{children:[g(`run.previousProofHash`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.previous_proof_hash})]})]})]})]}),e.status!==`completed`&&e.status!==`ready_to_reward`&&(0,_.jsxs)(`section`,{"aria-labelledby":`run-solution`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-solution`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.solution`)}),(0,_.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:(0,_.jsx)(v,{contract:e.contract,disabled:p||m,onSubmit:d})})]}),e.status===`ready_to_reward`&&(0,_.jsxs)(`section`,{"aria-labelledby":`run-reward`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-reward`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.reward.title`)}),(0,_.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,_.jsx)(`div`,{className:`mb-4 text-sm text-[var(--color-text-muted)]`,children:g(`run.reward.subtitle`)}),(0,_.jsxs)(`div`,{className:`mb-4 flex flex-wrap gap-4`,role:`radiogroup`,"aria-label":g(`run.reward.outcomeLabel`),children:[(0,_.jsxs)(`label`,{className:`inline-flex min-h-[44px] items-center gap-2`,children:[(0,_.jsx)(`input`,{type:`radio`,name:`reward-outcome`,value:`success`,checked:t===`success`,onChange:()=>n(`success`)}),(0,_.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:g(`run.reward.success`)})]}),(0,_.jsxs)(`label`,{className:`inline-flex min-h-[44px] items-center gap-2`,children:[(0,_.jsx)(`input`,{type:`radio`,name:`reward-outcome`,value:`failure`,checked:t===`failure`,onChange:()=>n(`failure`)}),(0,_.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:g(`run.reward.failure`)})]})]}),(0,_.jsxs)(`div`,{className:`mb-4`,children:[(0,_.jsx)(`label`,{htmlFor:`run-reward-feedback`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:g(`run.reward.feedback`)}),(0,_.jsx)(`textarea`,{id:`run-reward-feedback`,value:r,onChange:e=>i(e.target.value),className:`min-h-[8rem] w-full resize-y rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,_.jsx)(`button`,{type:`button`,onClick:f,disabled:h,className:`min-h-[44px] min-w-[44px] cursor-pointer rounded-[var(--radius-md)] border-0 bg-[var(--color-primary)] px-4 py-2 font-medium text-white hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:opacity-60`,children:g(h?`run.reward.submitting`:`run.reward.submit`)})]})]}),e.history.length>0&&(0,_.jsxs)(`section`,{"aria-labelledby":`run-history`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-history`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.history`)}),(0,_.jsx)(`ul`,{className:`m-0 list-none space-y-2 p-0`,"aria-label":g(`run.historyLabel`),children:e.history.slice().reverse().map((e,t)=>(0,_.jsxs)(`li`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,_.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[new Date(e.submitted_at).toLocaleString(),` · `,e.contract.type,` ·`,` `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.layer.uri})]}),e.server_message&&(0,_.jsx)(`div`,{className:`mt-1 text-sm text-[var(--color-text)]`,children:e.server_message})]},`${e.layer.uri}:${t}`))})]}),e.status===`completed`&&(0,_.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--status-success-bg)] p-4 text-[var(--status-success-fg)]`,children:[(0,_.jsx)(`strong`,{className:`block`,children:g(`run.completed`)}),e.last_message&&(0,_.jsx)(`div`,{className:`mt-1 text-sm`,children:e.last_message})]})]})}async function S(e){let t=await p(`/api/forward`,{method:`POST`,body:JSON.stringify({uri:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return await t.json()}function C(){return i({mutationFn:e=>S(e)})}async function w(e){let t=await p(`/api/forward`,{method:`POST`,body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return await t.json()}function T(){return i({mutationFn:e=>w(e)})}async function E(e){let t=await p(`/api/reward`,{method:`POST`,body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return await t.json()}function D(){return i({mutationFn:e=>E(e)})}function O(e){if(e)return e.match(/squadrules:\/\/layer\/[0-9a-fA-F-]{36}(?:\?execution_id=[0-9a-fA-F-]{36})?/)?.[0]}function k(){return new Date().toISOString()}function A(){let{t:e}=s(),{uri:t}=a(),[n]=o(),i=t?decodeURIComponent(t):void 0,c=n.get(`session`),{session:l}=h(c),{upsert:u}=m(),p=C(),v=T(),y=D(),[b,S]=(0,g.useState)(null),[w,E]=(0,g.useState)(`success`),[A,j]=(0,g.useState)(``),[M,N]=(0,g.useState)(null);(0,g.useEffect)(()=>{l&&!b&&(S(l),E(`success`),j(``))},[l,b]);let P=e=>{S(e),u(e)},F=async()=>{if(i)try{let e=await p.mutateAsync(i),t=k(),n=`${i}:${t}`,r=e.next_action?.includes(`reward`)?`ready_to_reward`:`running`,a=O(e.next_action);P({id:n,adapter_uri:i,started_at:t,updated_at:t,status:r,current_layer:e.current_layer??null,contract:e.contract,next_action:e.next_action,last_message:e.message,previous_proof_hash:e.proof_hash,reward_uri:r===`ready_to_reward`?a:void 0,history:[]})}catch{S(null)}};return i?(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:e(`run.title`)}),(0,_.jsx)(`p`,{className:`mb-4 text-sm text-[var(--color-text-muted)]`,children:e(`run.guidedIntro`)}),(0,_.jsxs)(`p`,{className:`mb-4 text-sm text-[var(--color-text-muted)]`,children:[e(`run.adapterUri`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:i})]}),(0,_.jsxs)(`div`,{className:`flex flex-wrap gap-2 mb-6`,children:[(0,_.jsx)(r,{to:`/protocols/${encodeURIComponent(i)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`run.backToProtocol`)}),!b&&(0,_.jsx)(`button`,{type:`button`,onClick:F,disabled:p.isPending,className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:p.isPending?e(`run.starting`):e(`run.start`)})]}),(0,_.jsx)(d,{className:`mb-6`,title:e(`run.safety.title`),children:(0,_.jsx)(`p`,{className:`m-0 text-sm text-[var(--color-text-muted)]`,children:e(`run.safety.copy`)})}),p.isError&&(0,_.jsx)(f,{message:p.error instanceof Error?p.error.message:String(p.error),onRetry:()=>F(),showGoBack:!0}),b?.status===`error`&&b.last_message&&(0,_.jsx)(`div`,{className:`mb-6`,children:(0,_.jsx)(f,{message:b.last_message,onRetry:()=>F(),showGoBack:!0})}),b&&b.status!==`error`&&(0,_.jsx)(x,{run:b,rewardOutcome:w,setRewardOutcome:E,rewardFeedback:A,setRewardFeedback:j,copyStatus:M,onCopy:async t=>{N(null);try{await navigator.clipboard.writeText(t),N(e(`run.copied`)),setTimeout(()=>N(null),1500)}catch(e){N(e instanceof Error?e.message:String(e))}},onSubmitStep:async e=>{if(!b?.current_layer)return;let t=b.contract.nonce,n=b.previous_proof_hash??b.contract.proof_hash,r={...e,...t?{nonce:t}:{},...n?{proof_hash:n}:{}};try{let e=await v.mutateAsync({uri:b.current_layer.uri,solution:r}),t=k(),n=e.next_action?.includes(`reward`)||(e.message?.toLowerCase().includes(`call reward`)??!1),i=O(e.next_action)??b.reward_uri;P({...b,updated_at:t,status:n?`ready_to_reward`:`running`,current_layer:e.current_layer??null,contract:e.contract,next_action:e.next_action,last_message:e.message,previous_proof_hash:e.proof_hash??b.previous_proof_hash,reward_uri:n?i:void 0,history:[...b.history,{layer:b.current_layer,contract:b.contract,solution:r,submitted_at:t,proof_hash:e.proof_hash,server_message:e.message}]})}catch(e){P({...b,updated_at:k(),status:`error`,last_message:e instanceof Error?e.message:String(e)})}},onReward:async()=>{if(!b)return;let t=b.reward_uri??b.current_layer?.uri;if(t)try{let n=await y.mutateAsync({uri:t,outcome:w,feedback:A.trim()||e(`run.reward.defaultFeedback`)});P({...b,updated_at:k(),status:`completed`,last_message:n.results[0]?.feedback??b.last_message})}catch(e){P({...b,updated_at:k(),status:`error`,last_message:e instanceof Error?e.message:String(e)})}},isForwardStepPending:v.isPending,isForwardStartPending:p.isPending,isRewardPending:y.isPending})]}):(0,_.jsx)(f,{message:e(`run.missingUri`),showGoBack:!0})}export{A as RunGuidedPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,v as t}from"./vendor-
|
|
1
|
+
import{a as e,v as t}from"./vendor-DuiEbTOR.js";import{n}from"./useRunSession-Cg4iouK8.js";import{t as r}from"./react-C1iE8mnY.js";var i=r();function a(){let{t:r}=t(),{sessions:a,remove:o}=n();return(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:r(`runs.title`)}),(0,i.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-6`,children:r(`runs.subtitle`)}),a.length===0?(0,i.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-6`,children:(0,i.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:r(`runs.empty`)})}):(0,i.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-3`,"aria-label":r(`runs.listLabel`),children:a.map(t=>(0,i.jsxs)(`li`,{className:`flex flex-col gap-3 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,i.jsxs)(`div`,{className:`min-w-0`,children:[(0,i.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)] truncate`,children:t.adapter_uri}),(0,i.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1`,children:[r(`runs.status`),`: `,t.status,` · `,r(`runs.updated`),`: `,new Date(t.updated_at).toLocaleString(),` · `,r(`runs.stepsDone`,{count:t.history.length})]}),t.last_message&&(0,i.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1`,children:t.last_message})]}),(0,i.jsxs)(`div`,{className:`flex flex-wrap gap-2 flex-shrink-0`,children:[(0,i.jsx)(e,{to:`/protocols/${encodeURIComponent(t.adapter_uri)}/run?session=${encodeURIComponent(t.id)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:r(`runs.resume`)}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>o(t.id),className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] bg-transparent hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:r(`runs.remove`)})]})]},t.id))})]})}export{a as RunsPage};
|